Changeset 8 for exampleparties/timedependentparty/src
- Timestamp:
- 09/30/19 15:37:05 (5 years ago)
- Location:
- exampleparties/timedependentparty/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
exampleparties/timedependentparty/src/main/java/geniusweb/exampleparties/timedependentparty/TimeDependentParty.java
r4 r8 39 39 * on bidspaces > 10000 bids. In special cases it may even run out of memory, 40 40 */ 41 public abstractclass TimeDependentParty extends DefaultParty {41 public class TimeDependentParty extends DefaultParty { 42 42 43 43 private static final BigDecimal DEC0001 = new BigDecimal("0.0001"); … … 49 49 private Bid lastReceivedBid = null; 50 50 private ExtendedUtilSpace extendedspace; 51 private double e = 1.2; 51 52 52 53 public TimeDependentParty() { … … 79 80 this.me = settings.getID(); 80 81 this.progress = settings.getProgress(); 82 Object newe = settings.getParemeters().get("e"); 83 if (newe != null) { 84 if (newe instanceof Double) { 85 this.e = (Double) newe; 86 } else { 87 getReporter().log(Level.WARNING, 88 "parameter e should be Double but found " 89 + newe); 90 } 91 } 92 81 93 } else if (info instanceof ActionDone) { 82 94 Action otheract = ((ActionDone) info).getAction(); … … 113 125 * 4. When e = 0, the agent plays hardball. 114 126 */ 115 public abstract double getE(); 127 public double getE() { 128 return e; 129 } 116 130 117 131 /******************* private support funcs ************************/ … … 177 191 .min(maxUtil).max(minUtil); 178 192 } 193 194 @Override 195 public String getDescription() { 196 return "Time-dependent conceder. Aims at utility u(t) = scale * t^(1/e) " 197 + "where t is the time (0=start, 1=end), e is a parameter (default 1.1), and scale such that u(0)=minimum and " 198 + "u(1) = maximum possible utility. "; 199 } 179 200 } -
exampleparties/timedependentparty/src/test/java/geniusweb/exampleparties/timedependentparty/TimeDependentPartyTest.java
r3 r8 44 44 import geniusweb.profile.utilityspace.LinearAdditiveUtilitySpace; 45 45 import geniusweb.progress.ProgressRounds; 46 import geniusweb.references.Parameters; 46 47 import geniusweb.references.ProfileRef; 47 48 import geniusweb.references.ProtocolRef; … … 61 62 private ProtocolRef protocol = mock(ProtocolRef.class); 62 63 private ProgressRounds progress = mock(ProgressRounds.class); 64 private Parameters parameters = new Parameters(); 63 65 private Settings settings; 64 66 private LinearAdditiveUtilitySpace profile; … … 80 82 }; 81 83 settings = new Settings(new PartyId("party1"), 82 new ProfileRef(new URI("file:" + PROFILE)), protocol, progress); 84 new ProfileRef(new URI("file:" + PROFILE)), protocol, progress, 85 parameters); 83 86 84 87 String serialized = new String(Files.readAllBytes(Paths.get(PROFILE)),
Note:
See TracChangeset
for help on using the changeset viewer.