1 | package geniusweb.exampleparties.simpleboa;
|
---|
2 |
|
---|
3 | import geniusweb.boa.BoaState;
|
---|
4 | import geniusweb.boa.DefaultBoa;
|
---|
5 | import geniusweb.boa.InstantiationFailedException;
|
---|
6 | import geniusweb.boa.acceptancestrategy.AcceptanceStrategy;
|
---|
7 | import geniusweb.boa.acceptancestrategy.TimeDependentAcceptanceStrategy;
|
---|
8 | import geniusweb.boa.biddingstrategy.BiddingStrategy;
|
---|
9 | import geniusweb.boa.biddingstrategy.TimeDependentBiddingStrategy;
|
---|
10 | import geniusweb.inform.Settings;
|
---|
11 | import geniusweb.opponentmodel.FrequencyOpponentModel;
|
---|
12 | import geniusweb.opponentmodel.OpponentModel;
|
---|
13 | import geniusweb.party.Party;
|
---|
14 | import tudelft.utilities.logging.Reporter;
|
---|
15 |
|
---|
16 | /**
|
---|
17 | * This example illustrates how to make a custom party by extending Boa and
|
---|
18 | * plugging in some components. This is an easy way to make a {@link Party} that
|
---|
19 | * is not requiring configuration/parameters. This also demonstrates how to hard
|
---|
20 | * set parameters of strategies so that the party runs as expected without
|
---|
21 | * requiring any parameters to be set.
|
---|
22 | */
|
---|
23 | public class SimpleBoa extends DefaultBoa {
|
---|
24 | public SimpleBoa() {
|
---|
25 | super();
|
---|
26 | }
|
---|
27 |
|
---|
28 | public SimpleBoa(Reporter reporter) {
|
---|
29 | super(reporter); // for debugging
|
---|
30 | }
|
---|
31 |
|
---|
32 | @Override
|
---|
33 | protected Class<? extends OpponentModel> getOpponentModel(Settings settings)
|
---|
34 | throws InstantiationFailedException {
|
---|
35 | return FrequencyOpponentModel.class;
|
---|
36 | }
|
---|
37 |
|
---|
38 | @Override
|
---|
39 | protected BiddingStrategy getBiddingStrategy(Settings settings)
|
---|
40 | throws InstantiationFailedException {
|
---|
41 | return new TimeDependentBiddingStrategy() {
|
---|
42 | @Override
|
---|
43 | protected Double getE(BoaState state) {
|
---|
44 | return 0.7;
|
---|
45 | }
|
---|
46 |
|
---|
47 | @Override
|
---|
48 | protected Double getK(BoaState state) {
|
---|
49 | return 0.2;
|
---|
50 | }
|
---|
51 | };
|
---|
52 | }
|
---|
53 |
|
---|
54 | @Override
|
---|
55 | protected AcceptanceStrategy getAccceptanceStrategy(Settings settings)
|
---|
56 | throws InstantiationFailedException {
|
---|
57 | return new TimeDependentAcceptanceStrategy() {
|
---|
58 | @Override
|
---|
59 | protected Double getE(BoaState state) {
|
---|
60 | return 0.7;
|
---|
61 | }
|
---|
62 |
|
---|
63 | @Override
|
---|
64 | protected Double getK(BoaState state) {
|
---|
65 | return 0.2;
|
---|
66 | }
|
---|
67 | };
|
---|
68 | }
|
---|
69 |
|
---|
70 | @Override
|
---|
71 | public String getDescription() {
|
---|
72 | return "Demo of hard coding a party with Boa Components";
|
---|
73 | }
|
---|
74 | }
|
---|