source: ai2020/group6/MAMirroredExponential.java@ 3

Last change on this file since 3 was 3, checked in by wouter, 4 years ago

#1925 added group6 code.

File size: 3.5 KB
RevLine 
[3]1package ai2020.group6;
2
3import java.math.BigDecimal;
4
5import geniusweb.inform.Settings;
6
7/**
8 * MAMirroredExponential accepts and generates bids above a threshold exponentially
9 * decreasing as a function of time.
10 * The threshold starts at the "upperThreshold" (defaulting to 1) and decreases
11 * to the "lowerThreshold" (defaulting to 0) by scaling with 1-t^(1/e), where t is
12 * the progress over time and e is the parameter "e" (defaulting to 1).
13 *
14 * This is the default behaviour of the exampleparties provided by the geniusweb
15 * framework;
16 * Hardliner: e = 0'
17 * Boulware: e = 0.2
18 * Linear: e = 1
19 * TimeDependentParty: e = 1.2
20 * Conceder: e = 2
21 *
22 * ' e = 0 would theoretically give the same result, but is not allowed for this agent,
23 * as this would leave this agent with a static threshold of "upperThreshold" and
24 * is therefore replaceable with the MAStatic agent.
25 *
26 * @author Group 6
27 */
28public class MAMirroredExponential extends MADefaultParty {
29
30 @Override
31 protected IAcceptanceStrategy getAccceptanceStrategy ( Settings settings ) {
32 Object val = settings.getParameters().get("minPower");
33 Integer minpower = (val instanceof Integer) ? (Integer) val : 2;
34 val = settings.getParameters().get("maxPower");
35 Integer maxpower = (val instanceof Integer) ? (Integer) val : Integer.MAX_VALUE;
36 val = settings.getParameters().get("upperThreshold");
37 Double upperThreshold = (val instanceof Double) ? (Double) val : 1.0;
38 val = settings.getParameters().get("lowerThreshold");
39 Double lowerThreshold = (val instanceof Double) ? (Double) val : 0.0;
40 val = settings.getParameters().get("e");
41 Double e = (val instanceof Double) ? (Double) val : 1.0;
42 return new UtilityBasedAcceptanceStrategy(minpower, maxpower) {
43 @Override
44 public BigDecimal getUtilityThreshold ( MAState state ) {
45 Double t = state.getProgressTime().doubleValue();
46 Double scale = 1-Math.pow(t, 1/e);
47 return BigDecimal.valueOf(lowerThreshold + scale * (upperThreshold - lowerThreshold));
48 }
49 };
50 }
51
52 @Override
53 protected IBiddingStrategy getBiddingStrategy ( Settings settings ) {
54 Object val = settings.getParameters().get("minPower");
55 Integer minpower = (val instanceof Integer) ? (Integer) val : 2;
56 val = settings.getParameters().get("maxPower");
57 Integer maxpower = (val instanceof Integer) ? (Integer) val : Integer.MAX_VALUE;
58 val = settings.getParameters().get("upperThreshold");
59 Double upperThreshold = (val instanceof Double) ? (Double) val : 1.0;
60 val = settings.getParameters().get("lowerThreshold");
61 Double lowerThreshold = (val instanceof Double) ? (Double) val : 0.0;
62 val = settings.getParameters().get("e");
63 Double e = (val instanceof Double) ? (Double) val : 1.0;
64 return new UtilityBasedBiddingStrategy(minpower, maxpower) {
65 @Override
66 public BigDecimal getUpperUtilityThreshold ( MAState state ) {
67 return BigDecimal.valueOf(upperThreshold);
68 }
69 @Override
70 public BigDecimal getLowerUtilityThreshold ( MAState state ) {
71 Double t = state.getProgressTime().doubleValue();
72 Double scale = 1-Math.pow(t, 1/e);
73 return BigDecimal.valueOf(lowerThreshold + scale * (upperThreshold - lowerThreshold));
74 }
75 };
76 }
77
78 @Override
79 protected IOptInStrategy getOptInStrategy ( Settings settings ) {
80 return new NoOptInStrategy();
81 }
82
83 // @Override
84 // protected IOpponentModel initNewOpponentModel ( Settings settings ) {
85 // return new EmptyOpponentModel();
86 // }
87
88}
Note: See TracBrowser for help on using the repository browser.