source: src/test/java/boaexample/BoaPartyExample.java@ 169

Last change on this file since 169 was 169, checked in by Tim Baarslag, 6 years ago

Improved BoaPartyExample

File size: 2.6 KB
Line 
1package boaexample;
2
3import java.util.HashMap;
4import java.util.Map;
5
6import negotiator.boaframework.opponentmodel.HardHeadedFrequencyModel;
7
8import genius.core.boaframework.AcceptanceStrategy;
9import genius.core.boaframework.BoaParty;
10import genius.core.boaframework.OMStrategy;
11import genius.core.boaframework.OfferingStrategy;
12import genius.core.boaframework.OpponentModel;
13import genius.core.utility.AbstractUtilitySpace;
14
15/**
16 * This example shows how BOA components can be made into an independent negotiation party.
17 *
18 * Note that this is equivalent to adding a BOA party via the GUI by selecting the components and parameters.
19 * However, this method gives more control over the implementation, as the agent designer can
20 * choose to override behavior (such as handling preference uncertainty).
21 */
22public class BoaPartyExample extends BoaParty
23{
24 // The choice for each component is made here
25 private static AcceptanceStrategy acceptanceStrategy() {return new AC_Next();}
26 private static OfferingStrategy offeringStrategy() {return new TimeDependent_Offering();}
27 private static OpponentModel opponentModel() {return new HardHeadedFrequencyModel();}
28 private static OMStrategy opponentModelStrategy() {return new BestBid();}
29
30 // All component parameters can be set below. Static initialization is used purely for convenience as the
31 // constructor call to super() needs to be the first statement
32 private static Map<String, Double> acParams() {return new HashMap<String, Double>();}
33 private static Map<String, Double> omParams() {return new HashMap<String, Double>();}
34 private static Map<String, Double> omsParams() {return new HashMap<String, Double>();}
35
36 // Set the concession parameter "e" for the offering strategy to yield Boulware-like behavior
37 private static Map<String, Double> osParams()
38 {
39 HashMap<String, Double> osParams = new HashMap<String, Double>();
40 osParams.put("e", 0.2);
41 return osParams;
42 }
43
44 public BoaPartyExample()
45 {
46 // This initializes all the components of this party to the choices defined above
47 super(acceptanceStrategy(), acParams(),
48 offeringStrategy(), osParams(),
49 opponentModel(), omParams(),
50 opponentModelStrategy(), omsParams());
51 }
52
53 // All the rest of the functionality is defined by the BOA framework
54
55 /**
56 * Specific functionality, such as the estimate of the utility space in the face of preference uncertainty,
57 * can be specified by overriding the default behavior.
58 */
59 @Override
60 public AbstractUtilitySpace estimateUtilitySpace()
61 {
62 return super.estimateUtilitySpace();
63 }
64
65}
Note: See TracBrowser for help on using the repository browser.