source: src/main/java/negotiator/boaframework/opponentmodel/PerfectModel.java@ 346

Last change on this file since 346 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: 2.1 KB
Line 
1package negotiator.boaframework.opponentmodel;
2
3import javax.swing.JOptionPane;
4
5import genius.core.Bid;
6import genius.core.boaframework.OpponentModel;
7import genius.core.protocol.BilateralAtomicNegotiationSession;
8import genius.core.tournament.TournamentConfiguration;
9import genius.core.utility.AdditiveUtilitySpace;
10
11/**
12 * An opponent model symbolizing perfect knowledge about the opponent's
13 * preferences. Note that for using this model experimentalSetup should be
14 * enabled in global. Since this extends OpponentModel, it only supports
15 * {@link AdditiveUtilitySpace}.
16 *
17 * Tim Baarslag, Koen Hindriks, Mark Hendrikx, Alex Dirkzwager and Catholijn M.
18 * Jonker. Decoupling Negotiating Agents to Explore the Space of Negotiation
19 * Strategies
20 *
21 * @author Mark Hendrikx
22 */
23public class PerfectModel extends OpponentModel {
24
25 @Override
26 public void setOpponentUtilitySpace(
27 BilateralAtomicNegotiationSession session) {
28
29 if (TournamentConfiguration.getBooleanOption(
30 "accessPartnerPreferences", false)) {
31 opponentUtilitySpace = (AdditiveUtilitySpace) session
32 .getAgentAUtilitySpace();
33 if (negotiationSession.getUtilitySpace().getFileName()
34 .equals(opponentUtilitySpace.getFileName())) {
35 opponentUtilitySpace = (AdditiveUtilitySpace) session
36 .getAgentBUtilitySpace();
37 }
38 } else {
39 JOptionPane
40 .showMessageDialog(
41 null,
42 "This opponent model needs access to the opponent's\npreferences. See tournament options.",
43 "Model error", 0);
44 System.err.println("Global.experimentalSetup should be enabled!");
45 }
46 }
47
48 @Override
49 public void setOpponentUtilitySpace(
50 AdditiveUtilitySpace opponentUtilitySpace) {
51 this.opponentUtilitySpace = opponentUtilitySpace;
52 }
53
54 @Override
55 public double getBidEvaluation(Bid bid) {
56 try {
57 return opponentUtilitySpace.getUtility(bid);
58 } catch (Exception e) {
59 e.printStackTrace();
60 }
61 return 0;
62 }
63
64 @Override
65 public String getName() {
66 return "Perfect Model";
67 }
68
69 public void updateModel(Bid opponentBid, double time) {
70 }
71}
Note: See TracBrowser for help on using the repository browser.