1 | package negotiator.boaframework.opponentmodel;
|
---|
2 |
|
---|
3 | import java.util.Map;
|
---|
4 |
|
---|
5 | import agents.bayesianopponentmodel.OpponentModelUtilSpace;
|
---|
6 | import genius.core.Bid;
|
---|
7 | import genius.core.boaframework.NegotiationSession;
|
---|
8 | import genius.core.boaframework.OpponentModel;
|
---|
9 | import genius.core.issue.Issue;
|
---|
10 | import genius.core.utility.AbstractUtilitySpace;
|
---|
11 | import negotiator.boaframework.opponentmodel.agentsmith.SmithModel;
|
---|
12 |
|
---|
13 | /**
|
---|
14 | * Adapter for the Frequency Model for the BOA framework.
|
---|
15 | *
|
---|
16 | * Tim Baarslag, Koen Hindriks, Mark Hendrikx, Alex Dirkzwager and Catholijn M.
|
---|
17 | * Jonker. Decoupling Negotiating Agents to Explore the Space of Negotiation
|
---|
18 | * Strategies
|
---|
19 | *
|
---|
20 | * @author Mark Hendrikx
|
---|
21 | */
|
---|
22 | public class SmithFrequencyModel extends OpponentModel {
|
---|
23 |
|
---|
24 | private SmithModel model;
|
---|
25 | private int round = 0;
|
---|
26 |
|
---|
27 | @Override
|
---|
28 | public void init(NegotiationSession negotiationSession, Map<String, Double> parameters) {
|
---|
29 | model = new SmithModel(negotiationSession.getUtilitySpace());
|
---|
30 | this.negotiationSession = negotiationSession;
|
---|
31 | }
|
---|
32 |
|
---|
33 | @Override
|
---|
34 | public void updateModel(Bid opponentBid, double time) {
|
---|
35 | round++;
|
---|
36 | model.addBid(opponentBid);
|
---|
37 | }
|
---|
38 |
|
---|
39 | @Override
|
---|
40 | public double getBidEvaluation(Bid bid) {
|
---|
41 | if (round > 0) {
|
---|
42 | return model.getNormalizedUtility(bid);
|
---|
43 | } else {
|
---|
44 | return 0;
|
---|
45 | }
|
---|
46 | }
|
---|
47 |
|
---|
48 | @Override
|
---|
49 | public AbstractUtilitySpace getOpponentUtilitySpace() {
|
---|
50 | if (round > 0) {
|
---|
51 | return new OpponentModelUtilSpace(model);
|
---|
52 | } else {
|
---|
53 | return negotiationSession.getUtilitySpace();
|
---|
54 | }
|
---|
55 | }
|
---|
56 |
|
---|
57 | public double getWeight(Issue issue) {
|
---|
58 | return model.getWeight(issue.getNumber());
|
---|
59 | }
|
---|
60 |
|
---|
61 | @Override
|
---|
62 | public String getName() {
|
---|
63 | return "Smith Frequency Model";
|
---|
64 | }
|
---|
65 |
|
---|
66 | public void cleanUp() {
|
---|
67 | super.cleanUp();
|
---|
68 | model = null;
|
---|
69 | }
|
---|
70 | } |
---|