source: src/main/java/agents/anac/y2010/Southampton/similarity/VariableConcessionSimilarityAgent.java

Last change on this file was 1, checked in by Wouter Pasman, 6 years ago

Initial import : Genius 9.0.0

File size: 1.3 KB
RevLine 
[1]1package agents.anac.y2010.Southampton.similarity;
2
3import agents.anac.y2010.Southampton.utils.concession.ConcessionFunction;
4import agents.anac.y2010.Southampton.utils.concession.TimeConcessionFunction;
5import genius.core.AgentParam;
6import genius.core.tournament.VariablesAndValues.AgentParameterVariable;
7
8/**
9 * @author Colin Williams
10 * A 'similarity' agent with a variable concession strategy.
11 *
12 */
13public class VariableConcessionSimilarityAgent extends SimilarityAgent {
14
15 protected ConcessionFunction cf;
16
17 /** (non-Javadoc)
18 * @see agents.southampton.similarity.SimilarityAgent#getTargetUtility(double, double)
19 */
20 @Override
21 protected double getTargetUtility(double myUtility, double oppntUtility) {
22 try {
23 return getConcession(utilitySpace.getUtility(myPreviousBids.get(0)));
24 } catch (Exception e) {
25 e.printStackTrace();
26 return 0;
27 }
28 }
29
30 private double getConcession(double startUtility) {
31 if (cf == null)
32 cf = new TimeConcessionFunction(parametervalues.get(new AgentParameterVariable(new AgentParam("common", "beta", 0.0, 10.0))).getValue(),
33 TimeConcessionFunction.BREAKOFF);
34 double currentTime = timeline.getTime() * timeline.getTotalTime() * 1000;
35 double totalTime = timeline.getTotalTime() * 1000;
36 return cf.getConcession(startUtility, Math.round(currentTime), totalTime);
37 }
38}
Note: See TracBrowser for help on using the repository browser.