source: exampleparties/simpleboa/src/main/java/geniusweb/exampleparties/simpleboa/SimpleBoa.java@ 52

Last change on this file since 52 was 52, checked in by ruud, 14 months ago

Fixed small issues in domaineditor.

File size: 2.0 KB
Line 
1package geniusweb.exampleparties.simpleboa;
2
3import geniusweb.boa.BoaState;
4import geniusweb.boa.DefaultBoa;
5import geniusweb.boa.InstantiationFailedException;
6import geniusweb.boa.acceptancestrategy.AcceptanceStrategy;
7import geniusweb.boa.acceptancestrategy.TimeDependentAcceptanceStrategy;
8import geniusweb.boa.biddingstrategy.BiddingStrategy;
9import geniusweb.boa.biddingstrategy.TimeDependentBiddingStrategy;
10import geniusweb.inform.Settings;
11import geniusweb.opponentmodel.FrequencyOpponentModel;
12import geniusweb.opponentmodel.OpponentModel;
13import geniusweb.party.Party;
14import 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 */
23public 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}
Note: See TracBrowser for help on using the repository browser.