1 | package agents.anac.y2019.kagent;
|
---|
2 |
|
---|
3 | import java.util.List;
|
---|
4 |
|
---|
5 | import java.util.Collections;
|
---|
6 | import java.util.HashMap;
|
---|
7 | import java.util.Map;
|
---|
8 |
|
---|
9 | import kagent.boacomponents.AC_Uncertain_Kindly;
|
---|
10 | import kagent.boacomponents.BestBid;
|
---|
11 | import kagent.boacomponents.HardHeadedFrequencyModel;
|
---|
12 | import kagent.boacomponents.TimeDependent_Offering;
|
---|
13 | import genius.core.boaframework.AcceptanceStrategy;
|
---|
14 | import genius.core.boaframework.BoaParty;
|
---|
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;
|
---|
20 | import genius.core.parties.NegotiationInfo;
|
---|
21 | import genius.core.uncertainty.AdditiveUtilitySpaceFactory;
|
---|
22 | import genius.core.utility.AbstractUtilitySpace;
|
---|
23 |
|
---|
24 | /**
|
---|
25 | * This example shows how BOA components can be made into an independent
|
---|
26 | * negotiation party and which can handle preference uncertainty.
|
---|
27 | *
|
---|
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).
|
---|
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
|
---|
40 | */
|
---|
41 | @SuppressWarnings("serial")
|
---|
42 | public class KAgent extends BoaParty
|
---|
43 | {
|
---|
44 | @Override
|
---|
45 | public void init(NegotiationInfo info)
|
---|
46 | {
|
---|
47 | // The choice for each component is made here
|
---|
48 | AcceptanceStrategy ac = new AC_Uncertain_Kindly();
|
---|
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.
|
---|
54 | Map<String, Double> noparams = Collections.emptyMap();
|
---|
55 | Map<String, Double> osParams = new HashMap<String, Double>();
|
---|
56 | // Set the concession parameter "e" for the offering strategy to yield Boulware-like behavior
|
---|
57 | osParams.put("e", 0.01);
|
---|
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);
|
---|
64 | super.init(info);
|
---|
65 | }
|
---|
66 |
|
---|
67 | /**
|
---|
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.
|
---|
71 | *
|
---|
72 | * This example estimator sets all weights and all evaluator values randomly.
|
---|
73 | */
|
---|
74 | @Override
|
---|
75 | public AbstractUtilitySpace estimateUtilitySpace()
|
---|
76 | {
|
---|
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 |
|
---|
89 | // The factory is done with setting all parameters, now return the estimated utility space
|
---|
90 | return additiveUtilitySpaceFactory.getUtilitySpace();
|
---|
91 | }
|
---|
92 |
|
---|
93 | @Override
|
---|
94 | public String getDescription()
|
---|
95 | {
|
---|
96 | return "Boa Party with Uncertainity(copy)";
|
---|
97 | }
|
---|
98 |
|
---|
99 | // All the rest of the agent functionality is defined by the components selected above, using the BOA framework
|
---|
100 | }
|
---|