[167] | 1 | package boaexample;
|
---|
| 2 |
|
---|
| 3 | import java.util.HashMap;
|
---|
| 4 | import java.util.Map;
|
---|
| 5 |
|
---|
| 6 | import negotiator.boaframework.opponentmodel.HardHeadedFrequencyModel;
|
---|
| 7 |
|
---|
| 8 | import genius.core.boaframework.AcceptanceStrategy;
|
---|
| 9 | import genius.core.boaframework.BoaParty;
|
---|
| 10 | import genius.core.boaframework.OMStrategy;
|
---|
| 11 | import genius.core.boaframework.OfferingStrategy;
|
---|
| 12 | import genius.core.boaframework.OpponentModel;
|
---|
| 13 | import 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 | */
|
---|
| 22 | public class BoaPartyExample extends BoaParty
|
---|
| 23 | {
|
---|
| 24 | // The choice for each component is made here
|
---|
[169] | 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();}
|
---|
[167] | 29 |
|
---|
[169] | 30 | // All component parameters can be set below. Static initialization is used purely for convenience as the
|
---|
[167] | 31 | // constructor call to super() needs to be the first statement
|
---|
[169] | 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()
|
---|
[167] | 38 | {
|
---|
[169] | 39 | HashMap<String, Double> osParams = new HashMap<String, Double>();
|
---|
| 40 | osParams.put("e", 0.2);
|
---|
| 41 | return osParams;
|
---|
[167] | 42 | }
|
---|
| 43 |
|
---|
| 44 | public BoaPartyExample()
|
---|
| 45 | {
|
---|
[169] | 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());
|
---|
[167] | 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 | }
|
---|
[169] | 64 |
|
---|
[167] | 65 | }
|
---|