1 | package negotiator.boaframework.opponentmodel;
|
---|
2 |
|
---|
3 | import javax.swing.JOptionPane;
|
---|
4 |
|
---|
5 | import genius.core.Bid;
|
---|
6 | import genius.core.boaframework.OpponentModel;
|
---|
7 | import genius.core.protocol.BilateralAtomicNegotiationSession;
|
---|
8 | import genius.core.tournament.TournamentConfiguration;
|
---|
9 | import 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 | */
|
---|
23 | public 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 | } |
---|