source: src/main/java/negotiator/boaframework/sharedagentstate/anac2012/AgentMRSAS.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.9 KB
Line 
1package negotiator.boaframework.sharedagentstate.anac2012;
2
3import java.util.ArrayList;
4
5import genius.core.Bid;
6import genius.core.boaframework.NegotiationSession;
7import genius.core.boaframework.SharedAgentState;
8
9/**
10 * This is the shared code of the acceptance condition and bidding strategy of ANAC2012 AgentMR.
11 * The code was taken from the ANAC2012 Agent MR and adapted to work within the BOA framework.
12 *
13 * @author Alex Dirkzwager
14 */
15public class AgentMRSAS extends SharedAgentState {
16
17 private NegotiationSession negotiationSession;
18 private double sigmoidGain;
19 private double sigmoidX;
20 private double reservation = 0.0;
21 private double alpha;
22 private double percent;
23 private double p = 0.90;
24 private static double minimumBidUtility;
25 private static double minimumOffereDutil;
26 private ArrayList<Bid> bidRunk = new ArrayList<Bid>();
27 double firstOffereUtility;
28 boolean calulatedFirstBidUtility = false;
29
30 public AgentMRSAS (NegotiationSession negoSession) {
31 negotiationSession = negoSession;
32 NAME = "AgentMR";
33 }
34
35 public ArrayList<Bid> getBidRunk() {
36 return bidRunk;
37 }
38
39 public void setBidRunk(ArrayList<Bid> bidRunk) {
40 this.bidRunk = bidRunk;
41 }
42
43 public void updateMinimumBidUtility(double time) {
44 alpha = (1.0 - getFirstOffereUtility()) * percent;
45 //System.out.println("Decoupled percent: " + percent);
46 //System.out.println("Decoupled alpha: " + alpha);
47 //System.out.println("Decoupled sigmoidGain: " + sigmoidGain);
48
49
50 double mbuInfimum = getFirstOffereUtility() + alpha;
51
52
53 if (mbuInfimum >= 1.0) {
54 mbuInfimum = 0.999;
55 } else if (mbuInfimum <= 0.70) {
56 mbuInfimum = 0.70;
57 }
58 sigmoidX = 1 - ((1 / sigmoidGain) * Math.log(mbuInfimum / (1 - mbuInfimum)));
59
60 minimumBidUtility = 1 - (1 / (1 + Math.exp(sigmoidGain
61 * (time - sigmoidX))));
62 //System.out.println("Decoupled sigmoidX: " + sigmoidX);
63 //System.out.println("Decoupled sigmoidGain: " + sigmoidGain);
64
65 if (minimumBidUtility < reservation) {
66 minimumBidUtility = reservation;
67 }
68
69 minimumOffereDutil = minimumBidUtility * p;
70
71 }
72
73 public void calculateFirstOffereUtility(){
74 if (negotiationSession.getUtilitySpace().isDiscounted()) {
75 firstOffereUtility = negotiationSession.getOpponentBidHistory().getFirstBidDetails().getMyUndiscountedUtil()
76 * (1 / Math.pow(negotiationSession.getUtilitySpace().getDiscountFactor(),
77 negotiationSession.getOpponentBidHistory().getFirstBidDetails().getTime()));
78 } else {
79 firstOffereUtility = negotiationSession.getOpponentBidHistory().getFirstBidDetails().getMyUndiscountedUtil();
80 }
81 }
82
83
84 public double getFirstOffereUtility(){
85 return firstOffereUtility;
86 }
87
88 public void setFirstOffereUtility(double value){
89 firstOffereUtility = value;
90 }
91
92 public double getSigmoidGain() {
93 return sigmoidGain;
94 }
95
96 public void setSigmoidGain(double sigmoidGain) {
97 this.sigmoidGain = sigmoidGain;
98 }
99
100 public NegotiationSession getNegotiationSession() {
101 return negotiationSession;
102 }
103
104 public void setNegotiationSession(NegotiationSession negotiationSession) {
105 this.negotiationSession = negotiationSession;
106 }
107
108 public double getSigmoidX() {
109 return sigmoidX;
110 }
111
112 public void setSigmoidX(double sigmoidX) {
113 this.sigmoidX = sigmoidX;
114 }
115
116 public double getReservation() {
117 return reservation;
118 }
119
120 public void setReservation(double reservation) {
121 this.reservation = reservation;
122 }
123
124 public double getAlpha() {
125 return alpha;
126 }
127
128 public void setAlpha(double alpha) {
129 this.alpha = alpha;
130 }
131
132 public double getP() {
133 return p;
134 }
135
136 public void setP(double p) {
137 this.p = p;
138 }
139
140 public double getMinimumBidUtility() {
141 return minimumBidUtility;
142 }
143
144 public double getMinimumOffereDutil() {
145 return minimumOffereDutil;
146 }
147
148 public double getPercent() {
149 return percent;
150 }
151
152 public void setPercent(double percent) {
153 this.percent = percent;
154 }
155}
Note: See TracBrowser for help on using the repository browser.