1 | package ai2020.group6;
|
---|
2 |
|
---|
3 | import java.math.BigDecimal;
|
---|
4 |
|
---|
5 | import geniusweb.inform.Settings;
|
---|
6 |
|
---|
7 | /**
|
---|
8 | * MAStatic is an agent that accepts bids that exceed the minimum threshold,
|
---|
9 | * provided to the agent as the "lowerThreshold" parameter (defaulting to 0),
|
---|
10 | * and creates random bids between the minimum and maximum thresholds,
|
---|
11 | * provided to the agent as the "lowerThreshold" and "upperThreshold" parameters
|
---|
12 | * (defaulting to 0 and 1).
|
---|
13 | *
|
---|
14 | * @author Group 6
|
---|
15 | */
|
---|
16 | public class MAStatic extends MADefaultParty {
|
---|
17 |
|
---|
18 | @Override
|
---|
19 | protected IAcceptanceStrategy getAccceptanceStrategy(Settings settings) {
|
---|
20 | Object val = settings.getParameters().get("minPower");
|
---|
21 | Integer minpower = (val instanceof Integer) ? (Integer) val : 2;
|
---|
22 | val = settings.getParameters().get("maxPower");
|
---|
23 | Integer maxpower = (val instanceof Integer) ? (Integer) val : Integer.MAX_VALUE;
|
---|
24 | val = settings.getParameters().get("lowerThreshold");
|
---|
25 | Double lowerThreshold = (val instanceof Double) ? (Double) val : 0.0;
|
---|
26 | return new UtilityBasedAcceptanceStrategy(minpower, maxpower) {
|
---|
27 | @Override
|
---|
28 | public BigDecimal getUtilityThreshold ( MAState state ) {
|
---|
29 | return BigDecimal.valueOf(lowerThreshold);
|
---|
30 | }
|
---|
31 | };
|
---|
32 | }
|
---|
33 |
|
---|
34 | @Override
|
---|
35 | protected IBiddingStrategy getBiddingStrategy(Settings settings) {
|
---|
36 | Object val = settings.getParameters().get("minPower");
|
---|
37 | Integer minpower = (val instanceof Integer) ? (Integer) val : 2;
|
---|
38 | val = settings.getParameters().get("maxPower");
|
---|
39 | Integer maxpower = (val instanceof Integer) ? (Integer) val : Integer.MAX_VALUE;
|
---|
40 | val = settings.getParameters().get("upperThreshold");
|
---|
41 | Double upperThreshold = (val instanceof Double) ? (Double) val : 1.0;
|
---|
42 | val = settings.getParameters().get("lowerThreshold");
|
---|
43 | Double lowerThreshold = (val instanceof Double) ? (Double) val : 0.0;
|
---|
44 | return new UtilityBasedBiddingStrategy(minpower, maxpower) {
|
---|
45 | @Override
|
---|
46 | public BigDecimal getUpperUtilityThreshold ( MAState state ) {
|
---|
47 | return BigDecimal.valueOf(upperThreshold);
|
---|
48 | }
|
---|
49 | @Override
|
---|
50 | public BigDecimal getLowerUtilityThreshold ( MAState state ) {
|
---|
51 | return BigDecimal.valueOf(lowerThreshold);
|
---|
52 | }
|
---|
53 | };
|
---|
54 | }
|
---|
55 |
|
---|
56 | @Override
|
---|
57 | protected IOptInStrategy getOptInStrategy ( Settings settings ) {
|
---|
58 | return new NoOptInStrategy();
|
---|
59 | }
|
---|
60 |
|
---|
61 | // @Override
|
---|
62 | // protected IOpponentModel initNewOpponentModel ( Settings settings ) {
|
---|
63 | // return new EmptyOpponentModel();
|
---|
64 | // }
|
---|
65 |
|
---|
66 | }
|
---|