1 | package negotiator.boaframework.offeringstrategy.anac2010;
|
---|
2 |
|
---|
3 | import java.util.HashSet;
|
---|
4 | import java.util.Map;
|
---|
5 | import java.util.Random;
|
---|
6 | import java.util.Set;
|
---|
7 |
|
---|
8 | import genius.core.Bid;
|
---|
9 | import genius.core.bidding.BidDetails;
|
---|
10 | import genius.core.boaframework.BOAparameter;
|
---|
11 | import genius.core.boaframework.NegotiationSession;
|
---|
12 | import genius.core.boaframework.NoModel;
|
---|
13 | import genius.core.boaframework.OMStrategy;
|
---|
14 | import genius.core.boaframework.OfferingStrategy;
|
---|
15 | import genius.core.boaframework.OpponentModel;
|
---|
16 | import genius.core.boaframework.SortedOutcomeSpace;
|
---|
17 | import genius.core.misc.Range;
|
---|
18 | import negotiator.boaframework.opponentmodel.DefaultModel;
|
---|
19 |
|
---|
20 | /**
|
---|
21 | * This is the decoupled Offering Strategy for IAMCrazyHaggler (ANAC2010). The
|
---|
22 | * code was taken from the ANAC2010 IAMCrazyHaggler and adapted to work within
|
---|
23 | * the BOA framework.
|
---|
24 | *
|
---|
25 | * An opponent model was added, which selects the best set of bids for the
|
---|
26 | * opponent with a utility above 0.9.
|
---|
27 | *
|
---|
28 | * DEFAULT OM: None
|
---|
29 | *
|
---|
30 | * Decoupling Negotiating Agents to Explore the Space of Negotiation Strategies
|
---|
31 | * T. Baarslag, K. Hindriks, M. Hendrikx, A. Dirkzwager, C.M. Jonker
|
---|
32 | *
|
---|
33 | * @author Alex Dirkzwager, Mark Hendrikx
|
---|
34 | */
|
---|
35 | public class IAMCrazyHaggler_Offering extends OfferingStrategy {
|
---|
36 |
|
---|
37 | private double breakoff = 0.9;
|
---|
38 | private Random random100;
|
---|
39 | private final boolean TEST_EQUIVALENCE = false;
|
---|
40 |
|
---|
41 | /**
|
---|
42 | * Empty constructor called by BOA framework.
|
---|
43 | */
|
---|
44 | public IAMCrazyHaggler_Offering() {
|
---|
45 | }
|
---|
46 |
|
---|
47 | @Override
|
---|
48 | public void init(NegotiationSession domainKnow, OpponentModel model, OMStrategy oms, Map<String, Double> parameters)
|
---|
49 | throws Exception {
|
---|
50 | initializeAgent(domainKnow, model, oms);
|
---|
51 | if (parameters != null && parameters.get("b") != null) {
|
---|
52 | breakoff = parameters.get("b");
|
---|
53 | }
|
---|
54 | }
|
---|
55 |
|
---|
56 | private void initializeAgent(NegotiationSession negoSession, OpponentModel model, OMStrategy oms) {
|
---|
57 | if (model instanceof DefaultModel) {
|
---|
58 | model = new NoModel();
|
---|
59 | }
|
---|
60 | this.negotiationSession = negoSession;
|
---|
61 | this.opponentModel = model;
|
---|
62 | this.omStrategy = oms;
|
---|
63 | if (negoSession.getDiscountFactor() == 0) {
|
---|
64 | breakoff = 0.95;
|
---|
65 | }
|
---|
66 | if (TEST_EQUIVALENCE) {
|
---|
67 | random100 = new Random(100);
|
---|
68 | } else {
|
---|
69 | random100 = new Random();
|
---|
70 | }
|
---|
71 |
|
---|
72 | if (!(opponentModel instanceof NoModel)) {
|
---|
73 | SortedOutcomeSpace space = new SortedOutcomeSpace(negotiationSession.getUtilitySpace());
|
---|
74 | negotiationSession.setOutcomeSpace(space);
|
---|
75 | }
|
---|
76 | }
|
---|
77 |
|
---|
78 | @Override
|
---|
79 | public BidDetails determineOpeningBid() {
|
---|
80 | return determineNextBid();
|
---|
81 | }
|
---|
82 |
|
---|
83 | @Override
|
---|
84 | public BidDetails determineNextBid() {
|
---|
85 | if (opponentModel instanceof NoModel) {
|
---|
86 | Bid bid = null;
|
---|
87 | try {
|
---|
88 | do {
|
---|
89 | bid = negotiationSession.getUtilitySpace().getDomain().getRandomBid(random100);
|
---|
90 | } while (negotiationSession.getUtilitySpace().getUtility(bid) <= breakoff);
|
---|
91 | nextBid = new BidDetails(bid, negotiationSession.getUtilitySpace().getUtility(bid));
|
---|
92 | } catch (Exception e) {
|
---|
93 | e.printStackTrace();
|
---|
94 | }
|
---|
95 | } else {
|
---|
96 | nextBid = omStrategy.getBid(negotiationSession.getOutcomeSpace(), new Range(breakoff, 1.1));
|
---|
97 | }
|
---|
98 | return nextBid;
|
---|
99 | }
|
---|
100 |
|
---|
101 | @Override
|
---|
102 | public Set<BOAparameter> getParameterSpec() {
|
---|
103 | Set<BOAparameter> set = new HashSet<BOAparameter>();
|
---|
104 | set.add(new BOAparameter("b", 0.9, "Minimum utility"));
|
---|
105 |
|
---|
106 | return set;
|
---|
107 | }
|
---|
108 |
|
---|
109 | @Override
|
---|
110 | public String getName() {
|
---|
111 | return "2010 - IAMCrazyHaggler";
|
---|
112 | }
|
---|
113 | } |
---|