[184] | 1 | package bilateralexamples;
|
---|
[167] | 2 |
|
---|
[178] | 3 | import java.util.List;
|
---|
| 4 |
|
---|
[172] | 5 | import java.util.Collections;
|
---|
[167] | 6 | import java.util.HashMap;
|
---|
[179] | 7 | import java.util.Map;
|
---|
[167] | 8 |
|
---|
[184] | 9 | import bilateralexamples.boacomponents.AC_Next;
|
---|
| 10 | import bilateralexamples.boacomponents.BestBid;
|
---|
| 11 | import bilateralexamples.boacomponents.HardHeadedFrequencyModel;
|
---|
| 12 | import bilateralexamples.boacomponents.TimeDependent_Offering;
|
---|
[178] | 13 | import genius.core.boaframework.AcceptanceStrategy;
|
---|
[167] | 14 | import genius.core.boaframework.BoaParty;
|
---|
[178] | 15 | import genius.core.boaframework.OMStrategy;
|
---|
| 16 | import genius.core.boaframework.OfferingStrategy;
|
---|
| 17 | import genius.core.boaframework.OpponentModel;
|
---|
| 18 | import genius.core.issue.IssueDiscrete;
|
---|
| 19 | import genius.core.issue.ValueDiscrete;
|
---|
[174] | 20 | import genius.core.parties.NegotiationInfo;
|
---|
[178] | 21 | import genius.core.uncertainty.AdditiveUtilitySpaceFactory;
|
---|
[167] | 22 | import genius.core.utility.AbstractUtilitySpace;
|
---|
| 23 |
|
---|
| 24 | /**
|
---|
[172] | 25 | * This example shows how BOA components can be made into an independent
|
---|
[183] | 26 | * negotiation party and which can handle preference uncertainty.
|
---|
[167] | 27 | *
|
---|
[172] | 28 | * Note that this is equivalent to adding a BOA party via the GUI by selecting
|
---|
| 29 | * the components and parameters. However, this method gives more control over
|
---|
| 30 | * the implementation, as the agent designer can choose to override behavior
|
---|
| 31 | * (such as handling preference uncertainty).
|
---|
[186] | 32 | * <p>
|
---|
| 33 | * For more information, see: Baarslag T., Hindriks K.V., Hendrikx M.,
|
---|
| 34 | * Dirkzwager A., Jonker C.M. Decoupling Negotiating Agents to Explore the Space
|
---|
| 35 | * of Negotiation Strategies. Proceedings of The Fifth International Workshop on
|
---|
| 36 | * Agent-based Complex Automated Negotiations (ACAN 2012), 2012.
|
---|
| 37 | * https://homepages.cwi.nl/~baarslag/pub/Decoupling_Negotiating_Agents_to_Explore_the_Space_of_Negotiation_Strategies_ACAN_2012.pdf
|
---|
| 38 | *
|
---|
| 39 | * @author Tim Baarslag
|
---|
[167] | 40 | */
|
---|
[177] | 41 | @SuppressWarnings("serial")
|
---|
[178] | 42 | public class BoaPartyExample extends BoaParty
|
---|
| 43 | {
|
---|
[172] | 44 | @Override
|
---|
[178] | 45 | public void init(NegotiationInfo info)
|
---|
| 46 | {
|
---|
| 47 | // The choice for each component is made here
|
---|
| 48 | AcceptanceStrategy ac = new AC_Next();
|
---|
| 49 | OfferingStrategy os = new TimeDependent_Offering();
|
---|
| 50 | OpponentModel om = new HardHeadedFrequencyModel();
|
---|
| 51 | OMStrategy oms = new BestBid();
|
---|
| 52 |
|
---|
| 53 | // All component parameters can be set below.
|
---|
[179] | 54 | Map<String, Double> noparams = Collections.emptyMap();
|
---|
| 55 | Map<String, Double> osParams = new HashMap<String, Double>();
|
---|
[181] | 56 | // Set the concession parameter "e" for the offering strategy to yield Boulware-like behavior
|
---|
[169] | 57 | osParams.put("e", 0.2);
|
---|
[178] | 58 |
|
---|
| 59 | // Initialize all the components of this party to the choices defined above
|
---|
| 60 | configure(ac, noparams,
|
---|
| 61 | os, osParams,
|
---|
| 62 | om, noparams,
|
---|
| 63 | oms, noparams);
|
---|
[172] | 64 | super.init(info);
|
---|
[167] | 65 | }
|
---|
[172] | 66 |
|
---|
[167] | 67 | /**
|
---|
[172] | 68 | * Specific functionality, such as the estimate of the utility space in the
|
---|
| 69 | * face of preference uncertainty, can be specified by overriding the
|
---|
| 70 | * default behavior.
|
---|
[178] | 71 | *
|
---|
| 72 | * This example estimator sets all weights and all evaluator values randomly.
|
---|
[167] | 73 | */
|
---|
| 74 | @Override
|
---|
[181] | 75 | public AbstractUtilitySpace estimateUtilitySpace()
|
---|
| 76 | {
|
---|
[178] | 77 | AdditiveUtilitySpaceFactory additiveUtilitySpaceFactory = new AdditiveUtilitySpaceFactory(getDomain());
|
---|
| 78 | List<IssueDiscrete> issues = additiveUtilitySpaceFactory.getIssues();
|
---|
| 79 | for (IssueDiscrete i : issues)
|
---|
| 80 | {
|
---|
| 81 | additiveUtilitySpaceFactory.setWeight(i, rand.nextDouble());
|
---|
| 82 | for (ValueDiscrete v : i.getValues())
|
---|
| 83 | additiveUtilitySpaceFactory.setUtility(i, v, rand.nextDouble());
|
---|
| 84 | }
|
---|
| 85 |
|
---|
| 86 | // Normalize the weights, since we picked them randomly in [0, 1]
|
---|
| 87 | additiveUtilitySpaceFactory.normalizeWeights();
|
---|
| 88 |
|
---|
[181] | 89 | // The factory is done with setting all parameters, now return the estimated utility space
|
---|
[178] | 90 | return additiveUtilitySpaceFactory.getUtilitySpace();
|
---|
[167] | 91 | }
|
---|
[178] | 92 |
|
---|
[177] | 93 | @Override
|
---|
[178] | 94 | public String getDescription()
|
---|
| 95 | {
|
---|
[177] | 96 | return "Boa Party Example";
|
---|
| 97 | }
|
---|
| 98 |
|
---|
[186] | 99 | // All the rest of the agent functionality is defined by the components selected above, using the BOA framework
|
---|
[167] | 100 | }
|
---|