source: src/main/java/negotiator/boaframework/opponentmodel/SmithFrequencyModelV2.java

Last change on this file was 127, checked in by Wouter Pasman, 6 years ago

#41 ROLL BACK of rev.126 . So this version is equal to rev. 125

File size: 1.7 KB
Line 
1package negotiator.boaframework.opponentmodel;
2
3import java.util.Map;
4
5import agents.bayesianopponentmodel.OpponentModelUtilSpace;
6import genius.core.Bid;
7import genius.core.boaframework.NegotiationSession;
8import genius.core.boaframework.OpponentModel;
9import genius.core.issue.Issue;
10import genius.core.utility.AbstractUtilitySpace;
11import negotiator.boaframework.opponentmodel.agentsmithv2.SmithModelV2;
12
13/**
14 * Adapter for the optimized version of the Frequency Model of Agent Smith.
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 */
22public class SmithFrequencyModelV2 extends OpponentModel {
23
24 private SmithModelV2 model;
25 private int round = 0;
26
27 @Override
28 public void init(NegotiationSession negotiationSession, Map<String, Double> parameters) {
29 model = new SmithModelV2(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 V2";
64 }
65
66 public void cleanUp() {
67 super.cleanUp();
68 model = null;
69 }
70}
Note: See TracBrowser for help on using the repository browser.