source: src/main/java/negotiator/boaframework/opponentmodel/FSEGABayesianModel.java@ 126

Last change on this file since 126 was 126, checked in by Aron Hammond, 6 years ago

Added function to calculate opposition to MultiLateralAnalysis.java

Moved code to add RLBOA listeners to RLBOAUtils is misc package

Added input for strategyParameters to SessionPanel (gui)

!! close SessionInfo after tournament; this caused /tmp/ to fill up with GeniusData files

Our own package:

  • Added opponents and strategies that are mentioned in the report
  • Change class hierarchy, agents can now extend from RLBOAagentBilateral to inherit RL functionality.
  • States extend from AbstractState
File size: 2.4 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.issue.ValueDiscrete;
11import genius.core.utility.AdditiveUtilitySpace;
12import negotiator.boaframework.opponentmodel.fsegaagent.FSEGAOpponentModel;
13
14/**
15 * Adapter to opponent model of FSEGA. This opponent model gives a nullpointer
16 * in UtilitySpaceHypothesis and therefore does not work.
17 *
18 * Adapted by Mark Hendrikx to be compatible with the BOA framework.
19 *
20 * Tim Baarslag, Koen Hindriks, Mark Hendrikx, Alex Dirkzwager and Catholijn M.
21 * Jonker. Decoupling Negotiating Agents to Explore the Space of Negotiation
22 * Strategies
23 *
24 * @author Mark Hendrikx
25 */
26public class FSEGABayesianModel extends OpponentModel {
27
28 FSEGAOpponentModel model;
29 private int startingBidIssue = 0;
30
31 @Override
32 public void init(NegotiationSession negotiationSession, Map<String, Double> parameters) {
33 this.negotiationSession = negotiationSession;
34 model = new FSEGAOpponentModel((AdditiveUtilitySpace) negotiationSession.getUtilitySpace());
35 while (!testIndexOfFirstIssue(negotiationSession.getUtilitySpace().getDomain().getRandomBid(null),
36 startingBidIssue)) {
37 startingBidIssue++;
38 }
39 }
40
41 /**
42 * Just an auxiliary function to calculate the index where issues start on a
43 * bid because we found out that it depends on the domain.
44 *
45 * @return true when the received index is the proper index
46 */
47 private boolean testIndexOfFirstIssue(Bid bid, int i) {
48 try {
49 @SuppressWarnings("unused")
50 ValueDiscrete valueOfIssue = (ValueDiscrete) bid.getValue(i);
51 } catch (Exception e) {
52 return false;
53 }
54 return true;
55 }
56
57 @Override
58 public void updateModel(Bid opponentBid, double time) {
59 try {
60 model.updateBeliefs(opponentBid);
61 } catch (Exception e) {
62 e.printStackTrace();
63 }
64 }
65
66 @Override
67 public double getBidEvaluation(Bid bid) {
68 try {
69 return model.getNormalizedUtility(bid);
70 } catch (Exception e) {
71 e.printStackTrace();
72 }
73 return 0;
74 }
75
76 @Override
77 public AdditiveUtilitySpace getOpponentUtilitySpace() {
78 return new OpponentModelUtilSpace(model);
79 }
80
81 public double getWeight(Issue issue) {
82 return model.getNormalizedWeight(issue, startingBidIssue);
83 }
84
85 public void cleanUp() {
86 super.cleanUp();
87 model = null;
88 }
89}
Note: See TracBrowser for help on using the repository browser.