source: src/main/java/agents/anac/y2014/BraveCat/necessaryClasses/NegotiationSession.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: 3.4 KB
Line 
1package agents.anac.y2014.BraveCat.necessaryClasses;
2
3import java.io.Serializable;
4import java.util.List;
5
6import genius.core.Bid;
7import genius.core.Domain;
8import genius.core.bidding.BidDetails;
9import genius.core.boaframework.BoaType;
10import genius.core.boaframework.SessionData;
11import genius.core.issue.Issue;
12import genius.core.timeline.TimeLineInfo;
13import genius.core.utility.AbstractUtilitySpace;
14
15public class NegotiationSession {
16 protected OutcomeSpace outcomeSpace;
17 protected BidHistory opponentBidHistory;
18 protected BidHistory ownBidHistory;
19 protected Domain domain;
20 protected AbstractUtilitySpace utilitySpace;
21 protected TimeLineInfo timeline;
22 private SessionData sessionData;
23
24 protected NegotiationSession() {
25 }
26
27 public NegotiationSession(SessionData sessionData, AbstractUtilitySpace utilitySpace, TimeLineInfo timeline) {
28 this(sessionData, utilitySpace, timeline, null);
29 }
30
31 public NegotiationSession(SessionData sessionData, AbstractUtilitySpace utilitySpace, TimeLineInfo timeline,
32 OutcomeSpace outcomeSpace) {
33 this.sessionData = sessionData;
34 this.utilitySpace = utilitySpace;
35 this.timeline = timeline;
36 this.domain = utilitySpace.getDomain();
37 this.opponentBidHistory = new BidHistory();
38 this.ownBidHistory = new BidHistory();
39 this.outcomeSpace = outcomeSpace;
40 sessionData = new SessionData();
41 }
42
43 public BidHistory getOpponentBidHistory() {
44 return this.opponentBidHistory;
45 }
46
47 public BidHistory getOwnBidHistory() {
48 return this.ownBidHistory;
49 }
50
51 public double getDiscountFactor() {
52 return this.utilitySpace.getDiscountFactor();
53 }
54
55 public List<Issue> getIssues() {
56 return this.domain.getIssues();
57 }
58
59 public TimeLineInfo getTimeline() {
60 return this.timeline;
61 }
62
63 public double getTime() {
64 return this.timeline.getTime();
65 }
66
67 public Domain getDomain() {
68 if (this.utilitySpace != null) {
69 return this.utilitySpace.getDomain();
70 }
71 return null;
72 }
73
74 public AbstractUtilitySpace getUtilitySpace() {
75 return this.utilitySpace;
76 }
77
78 public OutcomeSpace getOutcomeSpace() {
79 return this.outcomeSpace;
80 }
81
82 public void setOutcomeSpace(OutcomeSpace outcomeSpace) {
83 this.outcomeSpace = outcomeSpace;
84 }
85
86 public BidDetails getMaxBidinDomain() {
87 BidDetails maxBid = null;
88 if (this.outcomeSpace == null)
89 try {
90 Bid maximumBid = this.utilitySpace.getMaxUtilityBid();
91 maxBid = new BidDetails(maximumBid, this.utilitySpace.getUtility(maximumBid), -1.0D);
92 } catch (Exception e) {
93 e.printStackTrace();
94 }
95 else {
96 maxBid = this.outcomeSpace.getMaxBidPossible();
97 }
98 return maxBid;
99 }
100
101 public BidDetails getMinBidinDomain() {
102 BidDetails minBid = null;
103 if (this.outcomeSpace == null)
104 try {
105 Bid minimumBidBid = this.utilitySpace.getMinUtilityBid();
106 minBid = new BidDetails(minimumBidBid, this.utilitySpace.getUtility(minimumBidBid), -1.0D);
107 } catch (Exception e) {
108 e.printStackTrace();
109 }
110 else {
111 minBid = this.outcomeSpace.getMinBidPossible();
112 }
113 return minBid;
114 }
115
116 public void setData(BoaType component, Serializable data) {
117 this.sessionData.setData(component, data);
118 }
119
120 public Serializable getData(BoaType component) {
121 return this.sessionData.getData(component);
122 }
123
124 public double getDiscountedUtility(Bid bid, double time) {
125 return this.utilitySpace.getUtilityWithDiscount(bid, time);
126 }
127
128 public SessionData getSessionData() {
129 return this.sessionData;
130 }
131}
Note: See TracBrowser for help on using the repository browser.