[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
|
---|
| 25 | private static AcceptanceStrategy acceptanceStrategy = new AC_Next();
|
---|
| 26 | private static OfferingStrategy offeringStrategy = new TimeDependent_Offering();
|
---|
| 27 | private static OpponentModel opponentModel = new HardHeadedFrequencyModel();
|
---|
| 28 | private static OMStrategy opponentModelStrategy = new BestBid();
|
---|
| 29 |
|
---|
| 30 | // All component parameters can be set below. A static block 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 = new HashMap<String, Double>();
|
---|
| 33 | private static Map<String, Double> osParams = new HashMap<String, Double>();
|
---|
| 34 | private static Map<String, Double> omParams = new HashMap<String, Double>();
|
---|
| 35 | private static Map<String, Double> omsParams = new HashMap<String, Double>();
|
---|
| 36 |
|
---|
| 37 | static
|
---|
| 38 | {
|
---|
| 39 | // Set the concession parameter "e" for the offering strategy to yield Boulware-like behavior
|
---|
| 40 | osParams.put("e", 0.2);
|
---|
| 41 | }
|
---|
| 42 |
|
---|
| 43 | public BoaPartyExample()
|
---|
| 44 | {
|
---|
| 45 | // This initializes all the components of this party to the static fields defined above
|
---|
| 46 | super(acceptanceStrategy, acParams,
|
---|
| 47 | offeringStrategy, osParams,
|
---|
| 48 | opponentModel, omParams,
|
---|
| 49 | opponentModelStrategy, omsParams);
|
---|
| 50 | }
|
---|
| 51 |
|
---|
| 52 | // All the rest of the functionality is defined by the BOA framework
|
---|
| 53 |
|
---|
| 54 | /**
|
---|
| 55 | * Specific functionality, such as the estimate of the utility space in the face of preference uncertainty,
|
---|
| 56 | * can be specified by overriding the default behavior.
|
---|
| 57 | */
|
---|
| 58 | @Override
|
---|
| 59 | public AbstractUtilitySpace estimateUtilitySpace()
|
---|
| 60 | {
|
---|
| 61 | return super.estimateUtilitySpace();
|
---|
| 62 | }
|
---|
| 63 | }
|
---|