1 | package agents.anac.y2014.AgentTRP;
|
---|
2 |
|
---|
3 | import java.io.Serializable;
|
---|
4 | import java.util.List;
|
---|
5 | import java.util.Random;
|
---|
6 |
|
---|
7 | import genius.core.Agent;
|
---|
8 | import genius.core.Bid;
|
---|
9 | import genius.core.NegotiationResult;
|
---|
10 | import genius.core.actions.Accept;
|
---|
11 | import genius.core.actions.Action;
|
---|
12 | import genius.core.actions.DefaultAction;
|
---|
13 | import genius.core.actions.Offer;
|
---|
14 | import genius.core.issue.Issue;
|
---|
15 | import genius.core.issue.IssueInteger;
|
---|
16 | import genius.core.issue.Value;
|
---|
17 | import genius.core.issue.ValueInteger;
|
---|
18 |
|
---|
19 | /**
|
---|
20 | * This agent is an example of how to create an ANAC2013 agent which learns
|
---|
21 | * during the tournament. This agent is a variant of the random agent.
|
---|
22 | *
|
---|
23 | * @author M. Hendrikx
|
---|
24 | */
|
---|
25 | public class AgentTRP extends Agent {
|
---|
26 |
|
---|
27 | /** The minimum utility a bid should have to be accepted or offered. */
|
---|
28 | private double MINIMUM_BID_UTILITY;
|
---|
29 | /** The opponent's last action. */
|
---|
30 | private Bid opponentLastBid;
|
---|
31 | /** çââ¬ÂºÃ¸Ã¦ââ¬Â°Ã¢â¬Â¹Ã£ï¿½Ã®Bid */
|
---|
32 | private Bid opponentBid;
|
---|
33 | /**
|
---|
34 | * èââ¬Â¡ÃªÃÂ¥Ãâ ââ¬Â ã�ëã�èã�ãã�æäøââ¬Ã§ââ¬Â¢ÃªÃ¨ââ¬Â°Ã¯Ã£ï¿½ââ¬Å¾Ã§
|
---|
35 | * ââ¬ÂºÃ¸Ã¦ââ¬Â°Ã¢â¬Â¹Ã£ï¿½Ã
|
---|
36 | âæ��æáÃâ ã�ââ¬âã�Ã
|
---|
37 | ¸Bid
|
---|
38 | */
|
---|
39 | private Bid myBestBidByOpponent;
|
---|
40 | /**
|
---|
41 | * èââ¬Â¡ÃªÃÂ¥Ãâ ââ¬Â ã�ëã�èã�ãã�æäøââ¬Ã§ââ¬Â¢ÃªÃ¨ââ¬Â°Ã¯Ã£ï¿½
|
---|
42 | * ââ¬Å¾Bid
|
---|
43 | */
|
---|
44 | private Bid myBestBid;
|
---|
45 | /**
|
---|
46 | * ã�Ã
|
---|
47 |  Ã¤Ãºââ¬â¢Ã£ï¿½ââ¬Å¾Ã£ï¿½Ã«Ã£ï¿½Ã¨Ã£ï¿½Ã£Ã£ï¿½Ã¦Ã¨ââ¬Â°Ã¯Ã£ï¿½ââ¬Â¢Ã£ï¿½ï¿½
|
---|
48 | * ã�ââ¬Â ã�êæââ¬Â°Ã¢â¬Â¹
|
---|
49 | */
|
---|
50 | private Bid bestBid;
|
---|
51 | /** Ã¥æÃ¥å�ââ¬ï¿½Ã£ï¿½Ã®Ã¥âÃâçââ¬Â¢Ã
|
---|
52 | â */
|
---|
53 | private double[] minimumUtilities;
|
---|
54 |
|
---|
55 | // Ã¥ü÷æðââ¬âã�èã�ââ¬Â¹Ã¥üñæðââ¬âã�èã�ââ¬Â¹Ã£ï¿½Ã®Ã¦Ãâ æçââ¬Â¢ÃÂ¥
|
---|
56 | /**
|
---|
57 | * 0 é�Ã
|
---|
58 | ¾Ã¥æÃ¥å�ââ¬ï¿½ +
|
---|
59 | * æÃ
|
---|
60 | ½Ã¢Ã§Ã´Ã¢Ã¦Ã°ââ¬âÃ¥ââ¬Ëó 1
|
---|
61 | * çââ¬ÂºÃ¸Ã¦ââ¬Â°Ã¢â¬Â¹Ã£ï¿½Ã
|
---|
62 | âÃ¥ü÷æðââ¬âã�èÃÂ¥Ãâ äæââ¬âÃÂ
|
---|
63 | * -> çââ¬ÂºÃ¸Ã¦ââ¬Â°Ã¢â¬Â¹
|
---|
64 | * ã�îãÃâââ¢Ã£ââ¬Å¡Ã¹Ã£ÃâÃâ ãÃâââ¬ÅãÃâÃâãÃâââ¬Â°Ã¦Ã
|
---|
65 |  ââ¬Â¢Ã£ï¿½ââ¬â¢Ã£ââ¬Å¡Ã¢â¬Â¹
|
---|
66 | * 2 æââ¢Ã®Ã©ââ¬Ã
|
---|
67 | ¡ -> SA
|
---|
68 | */
|
---|
69 | private int mode;
|
---|
70 |
|
---|
71 | /** 1èéæå�Ãâ ã�îç÷�äúäæøââ¬Â°Ã¥ââ¬ÂºÃ
|
---|
72 | ¾Ã¦ââ¬Â¢Ã° */
|
---|
73 | private int round;
|
---|
74 |
|
---|
75 | private Random rand = new Random();
|
---|
76 |
|
---|
77 | private TRPSessionData mySessionData;
|
---|
78 |
|
---|
79 | public AgentTRP() {
|
---|
80 | }
|
---|
81 |
|
---|
82 | /**
|
---|
83 | * Initialize the target utility to MAX(rv, max). Where rv is the
|
---|
84 | * reservation value of the preference profile and max is the highest
|
---|
85 | * utility received on the current preference profile.
|
---|
86 | */
|
---|
87 | @Override
|
---|
88 | public void init() {
|
---|
89 | // System.out.println("SessionsNr : " + sessionNr);
|
---|
90 | round = 0;
|
---|
91 | /*
|
---|
92 | * æÃâ æçââ¬Â¢Ã¥ãââ¬Å¡Ã¢â¬â¢Ã¨Ã¨ÃÂÃ¥î
|
---|
93 | * Ã
|
---|
94 | ¡Ã£ï¿½ââ¢Ã£ââ¬Å¡Ã¢â¬Â¹
|
---|
95 | * é�øæÃ
|
---|
96 | Â Ã
|
---|
97 | ¾Ã£ï¿½Ã®Ã¦ââ¬âùæóââ¬
|
---|
98 | * ¢ 1.Ã¥ïþæÃâ æåââ¬ÂºÃ
|
---|
99 | ¾Ã¦ââ¬Â¢Ã°
|
---|
100 | * 2.æñúèãââ¬Å¡Ã¥ââ¬ÂºÃ
|
---|
101 | ¾Ã¦ââ¬Â¢Ã°
|
---|
102 | * 3.æÃ
|
---|
103 | âââ¬Ã¥þÃ
|
---|
104 | âã�îãÃâââ¬
|
---|
105 | * ÅãÃâÃâãÃâââ¬Â°
|
---|
106 | * 4.Ã¥ââ¬Â°Ã¯Â¿Â½Ã¥ââ¬ÂºÃ
|
---|
107 | ¾Ã£ï¿½Ã®Ã§ÃµÃ
|
---|
108 | âéï¿
|
---|
109 | * ½Ã
|
---|
110 | ½Ã¦ââ¢ââ¬Å¡Ã©ââ¬âââ¬Å
|
---|
111 | */
|
---|
112 |
|
---|
113 | // å�Ãâ æââ¬Å¾Ã¯Â¿Â½Ã§Ã
|
---|
114 | ½ââ¬Â¡
|
---|
115 | double rate;
|
---|
116 |
|
---|
117 | // System.out.print(mySessionData.breakCount);
|
---|
118 | // æÃâ æçøþãââ¬Å¡Ã¢â¬â¢Ã£ÃâÃÂãÃâüãÃâââ¬Â°
|
---|
119 | if (sessionNr == 0) {
|
---|
120 | mySessionData = null;
|
---|
121 | rate = 0;
|
---|
122 | } else {
|
---|
123 | mySessionData = initPrevSessionData();
|
---|
124 | myBestBidByOpponent = new Bid(mySessionData.opponentBestBid);
|
---|
125 | rate = (sessionNr - mySessionData.breakCount) / sessionNr;
|
---|
126 | }
|
---|
127 |
|
---|
128 | // ÃÂ¥Ãâ �æÃâ æ
|
---|
129 | if (sessionNr < 2) {
|
---|
130 | // minimumUtilities = new
|
---|
131 | // double[]{0.9,0.9,0.9,0.9,0.9,0.8,0.8,0.8,0.8,0.8};
|
---|
132 | mode = 0; // 0
|
---|
133 | return;
|
---|
134 | } else if (rate > 0.5) {
|
---|
135 | // minimumUtilities = new
|
---|
136 | // double[]{0.9,0.9,0.9,0.9,0.9,0.8,0.8,0.8,0.75,0.75};
|
---|
137 | mode = 3;
|
---|
138 | return;
|
---|
139 | } else {
|
---|
140 | // minimumUtilities = new
|
---|
141 | // double[]{0.9,0.9,0.9,0.9,0.9,0.8,0.8,0.8,0.75,0.75};
|
---|
142 | mode = 2;
|
---|
143 | return;
|
---|
144 | }
|
---|
145 | }
|
---|
146 |
|
---|
147 | @Override
|
---|
148 | public String getVersion() {
|
---|
149 | return "1.0";
|
---|
150 | }
|
---|
151 |
|
---|
152 | @Override
|
---|
153 | public String getName() {
|
---|
154 | return "AgentTRP";
|
---|
155 | }
|
---|
156 |
|
---|
157 | // Ã¥ââ¬Â°Ã¯Â¿Â½Ã¥ââ¬ÂºÃ
|
---|
158 | ¾Ã£ï¿½Ã®Ã¤ÃºÃ¤Ã¦Ã¸ââ¬Â°Ã§Ãµï¿½Ã¦Ã
|
---|
159 | ¾Ã
|
---|
160 | âãââ¬Å¡Ã¢â¬â¢Ã¥ââ¬Ëüã�óåââ¬Â¡ÃºÃ£ï¿½ââ¢
|
---|
161 | public TRPSessionData initPrevSessionData() {
|
---|
162 | TRPSessionData prev = (TRPSessionData) this.loadSessionData();
|
---|
163 | prev.printAll();
|
---|
164 | myBestBidByOpponent = prev.opponentBestBid;
|
---|
165 | myBestBid = prev.myBestBid;
|
---|
166 | return prev;
|
---|
167 | }
|
---|
168 |
|
---|
169 | /**
|
---|
170 | * Set the target utility for the next match on the same preference profile.
|
---|
171 | * If the received utility is higher than the current target, save the
|
---|
172 | * received utility as the new target utility.
|
---|
173 | */
|
---|
174 | // çõââ¬Å¡Ã£ââ¬Å¡Ã¯Â¿Â½Ã£ï¿½Ã£Ã£ï¿½Ã
|
---|
175 | ¸Ã£ï¿½Ã¨Ã£ï¿½ï¿½Ã£ï¿½Ã«Ã¥ââ¬Ëüã�ðãââ¬Å¡Ã
|
---|
176 | âãââ¬Å¡Ã¢â¬Â¹
|
---|
177 | @Override
|
---|
178 | public void endSession(NegotiationResult result) {
|
---|
179 |
|
---|
180 | /*
|
---|
181 | * --
|
---|
182 | * äúäæøââ¬Â°Ã§Ãµï¿½Ã¦Ã
|
---|
183 | ¾Ã
|
---|
184 | âãââ¬Å¡Ã¢â
|
---|
185 | * ¬â¢Ã¤Ã¿ï¿½ÃÂ¥ÃÂÃÅ --
|
---|
186 | * äÿ�ÃÂ¥ÃÂÃÅã�ââ¢Ã£ï¿½Ã¹Ã£ï¿½ï
|
---|
187 | * ¿½Ã¦Ãâââ¬Â¦Ã¥àñ
|
---|
188 | * å�Ãâ æââ¬Å¾Ã¯Â¿Â½Ã£Ãâââ¬ÅãÃ
|
---|
189 | * âÃâãÃâââ¬Â°Ã¯Ã¼Ã
|
---|
190 | âå�Ãâ æââ¬Å¾Ã¯Â¿Â½
|
---|
191 | * æââ¢ââ¬Å¡Ã©ââ¬âââ¬Å,
|
---|
192 | * å�Ãâ æââ¬Å¾Ã¯Â¿Â½Ã£ï¿½ââ¬âã�Ã
|
---|
193 | ¸Ã£Ã
|
---|
194 | * ¯Â¿Â½Ã¢â¬Â¹,
|
---|
195 | * æñúèãââ¬Å¡Ã¥ââ¬ÂºÃ
|
---|
196 | ¾Ã¦ââ¬Â¢Ã°Ã¯Ã
|
---|
197 | * ¼Ã
|
---|
198 | âæäÃ
|
---|
199 | âçôâïüÃ
|
---|
200 | âãÃâéãââ¬Å¡
|
---|
201 | * æãÃâóãÃâââ¬Â°Ã¦ââ¬Â¢Ã°
|
---|
202 | */
|
---|
203 |
|
---|
204 | Bid lastBid;
|
---|
205 | // æÃ
|
---|
206 | âââ¬Ã¥þÃ
|
---|
207 | âã�îãÃâââ¬ÅãÃâÃâãÃâââ¬Â°
|
---|
208 | if (mySessionData == null) {
|
---|
209 | lastBid = result.getLastBid();
|
---|
210 | } else {
|
---|
211 | // äûÃ
|
---|
212 |  Ã£ï¿½Ã¾Ã£ï¿½Ã§Ã£ï¿½Ã§Ã¤Ã¸ââ¬Ã§ââ¬Â¢ÃªÃ£ï¿½ââ¬Å¾Ã£ï¿½ââ¬Å¾Ã¥ï¿½Ãâ æââ¬Å¾Ã¯Â¿Â½Ã§Ãµï¿½Ã¦Ã
|
---|
213 | ¾Ã
|
---|
214 | âãââ¬Å¡Ã¢â¬â¢Ã¦Ã Ã¼Ã§Ã´ï¿½
|
---|
215 | if (getUtility(mySessionData.lastBid) < getUtility(
|
---|
216 | result.getLastBid())) {
|
---|
217 | lastBid = result.getLastBid();
|
---|
218 | } else {
|
---|
219 | lastBid = mySessionData.lastBid;
|
---|
220 | }
|
---|
221 | }
|
---|
222 | // æÃ
|
---|
223 | âââ¬Ã¥þÃ
|
---|
224 | âã�îæââ¢ââ¬Å¡Ã©ââ¬âââ¬Å
|
---|
225 | double lastTime = timeline.getTime();
|
---|
226 | // å�Ãâ æââ¬Å¾Ã¯Â¿Â½Ã£ï¿½ââ¬âã�Ã
|
---|
227 | ¸Ã£ï¿½ââ¬Â¹Ã¥ï¿½Ã¦Ã£ï¿½ââ¬Â¹
|
---|
228 | Boolean isAgree = result.isAgreement();
|
---|
229 |
|
---|
230 | boolean reset = false;
|
---|
231 | if (sessionNr == 0) {
|
---|
232 | reset = true;
|
---|
233 | }
|
---|
234 | TRPSessionData mySessionData = new TRPSessionData(lastBid, lastTime,
|
---|
235 | isAgree, myBestBid, myBestBidByOpponent, round, reset);
|
---|
236 | this.saveSessionData(mySessionData);
|
---|
237 | }
|
---|
238 |
|
---|
239 | /**
|
---|
240 | * Retrieve the bid from the opponent's last action.
|
---|
241 | */
|
---|
242 | // ãÃâáãÃâÃâãââ¬Å¡Ã»Ã£Ãâüãââ¬Å¡Ã¸Ã£ââ¬Å¡Ã¢â¬â¢Ã¥ï¿½ââ¬âã�ââ¬Ëå�ââ¬âã�ãã�Ã
|
---|
243 | ¸Ã£ï¿½Ã¨Ã£ï¿½ï¿½Ã£ï¿½Ã®Ã¥ââ¬Â¡Ã¦Ã§ï¿½ââ¬Â
|
---|
244 | @Override
|
---|
245 | public void ReceiveMessage(Action opponentAction) {
|
---|
246 | opponentLastBid = DefaultAction.getBidFromAction(opponentAction);
|
---|
247 | opponentBid = DefaultAction.getBidFromAction(opponentAction);
|
---|
248 | if (myBestBidByOpponent == null || opponentBid == null) { // bestBidã�Ã
|
---|
249 | âã�êã�ââ¬Å¾Ã£ï¿½Ã¨Ã£ï¿½ï¿½
|
---|
250 | myBestBidByOpponent = utilitySpace.getDomain().getRandomBid(null);
|
---|
251 | } else {
|
---|
252 | if (getUtility(opponentBid) >= getUtility(myBestBidByOpponent)) { // bestBid
|
---|
253 | // ãââ¬Å¡Ãâ ãââ¬Å¡Ã
|
---|
254 |  Ã£ââ¬Å¡Ãâ ã�ââ¬Å¾Ã£ââ¬Å¡Ã¢â¬Å¡Ã£ï¿½Ã®Ã£ââ¬Å¡Ã¢â¬â¢Ã¦ï¿½ï¿½Ã¦Ã¡Ãâ ã�ââ¬âã�Ã
|
---|
255 | ¸Ã£ï¿½Ã¨Ã£ï¿½ï¿½
|
---|
256 | myBestBidByOpponent = new Bid(opponentBid);
|
---|
257 | }
|
---|
258 | if (myBestBid == null
|
---|
259 | || getUtility(opponentBid) >= getUtility(myBestBid)) {
|
---|
260 | myBestBid = new Bid(opponentBid);
|
---|
261 | }
|
---|
262 | }
|
---|
263 | }
|
---|
264 |
|
---|
265 | /**
|
---|
266 | * Accept if the utility of the opponent's is higher than the target
|
---|
267 | * utility; else return a random bid with a utility at least equal to the
|
---|
268 | * target utility.
|
---|
269 | */
|
---|
270 | @Override
|
---|
271 | public Action chooseAction() {
|
---|
272 | double time = timeline.getTime(); // ç�þÃÂ¥Ã
|
---|
273 | âèæââ¢ââ¬Å¡ÃÂ¥Ãâ û
|
---|
274 |
|
---|
275 | // ã�ââ¬Åã�îåââ¬Ã¤Ã£ââ¬Å¡Ãâ ãââ¬Å¡Ã
|
---|
276 |  Ã¥äçã��ã�ââ¬Å¾Bidã�ïå�ââ¬âç�ââ¬Â ã�ââ¢Ã£ââ¬Å¡Ã¢â¬Â¹
|
---|
277 | double minimun_utility = acceptBorder(time);
|
---|
278 | round += 1; // äúäæøââ¬Â°Ã¥ââ¬ÂºÃ
|
---|
279 | ¾Ã¦ââ¬Â¢Ã°Ã£ââ¬Å¡Ã¢â¬â¢Ã£ââ¬Å¡Ã«Ã£ââ¬Å¡Ã¦Ã£ÃâóãÃâÃâ
|
---|
280 |
|
---|
281 | /** Accept */
|
---|
282 | if (opponentLastBid != null
|
---|
283 | && getUtility(opponentLastBid) >= minimun_utility) {
|
---|
284 | return new Accept(getAgentID(), opponentLastBid);
|
---|
285 | }
|
---|
286 | if (mySessionData != null && getUtility(mySessionData.lastBid) < 0.6) {
|
---|
287 | return mode(time);
|
---|
288 | }
|
---|
289 |
|
---|
290 | // æÃ
|
---|
291 | âââ¬ÃÂ¥Ãâ �ã�ââ¬Â¹Ã¦Ã
|
---|
292 | âââ¬Ã¥þÃ
|
---|
293 | âã�ç1æÃâ æäûÃ¥äøÃ
|
---|
294 |  Ã¤ÃºÃ¤Ã¦Ã¸ââ¬Â°Ã£ï¿½ââ¬âã�æãÃâââ¬Â¡Ã£Ãâüãââ¬Å¡Ã¿Ã£ï¿½Ã
|
---|
295 | âã�ââ¬Å¡Ã£ââ¬Å¡Ã¢â¬Â¹Ã£ï¿½Ã¨Ã£ï¿½ï¿½
|
---|
296 | if ((time < 0.15 || time >= 0.85) && mySessionData != null) {
|
---|
297 | // çââ¬ÂºÃ¸Ã¦ââ¬Â°Ã¢â¬Â¹Ã£ï¿½Ã
|
---|
298 | âéÃâýå�Ãâ ã�îã�ââ¬Å¾Ã£ï¿½ââ¬Å¾Ã£Ãâââ¬ÅãÃâÃâãÃâÃâ ãââ¬Å¡Ã¢â¬â¢Ã¦ï¿½ï¿½Ã¦Ã¡Ãâ ã�ââ¬âã�Ã
|
---|
299 | ¸Ã¥àôå�Ãâ
|
---|
300 | // 0.85äûÃ¥äøÃ
|
---|
301 |  Ã¥ï¿½ââ¬âãââ¬Å¡Ã
|
---|
302 | âãââ¬Å¡Ã¢â¬Â¹Ã£ï¿½ÃªÃ£ââ¬Å¡Ã¢â¬Â°
|
---|
303 | if (mySessionData.isAgree
|
---|
304 | && getUtility(mySessionData.lastBid) > 0.85) {
|
---|
305 | if (mySessionData.isAgree && round < 100) {
|
---|
306 | return new Offer(getAgentID(), mySessionData.lastBid);
|
---|
307 | }
|
---|
308 | }
|
---|
309 | }
|
---|
310 |
|
---|
311 | switch (mode) {
|
---|
312 | case 0:
|
---|
313 | try {
|
---|
314 | return mode0(time);
|
---|
315 | } catch (Exception e) {
|
---|
316 | e.printStackTrace();
|
---|
317 | }
|
---|
318 | case 1:
|
---|
319 | return mode1(time);
|
---|
320 | case 2:
|
---|
321 | try {
|
---|
322 | return mode2(time);
|
---|
323 | } catch (Exception e) {
|
---|
324 | e.printStackTrace();
|
---|
325 | }
|
---|
326 | case 3:
|
---|
327 | return mode3(time);
|
---|
328 | default:
|
---|
329 | return mode(time);
|
---|
330 | }
|
---|
331 | }
|
---|
332 |
|
---|
333 | // Ã¥ü÷æðââ¬â
|
---|
334 | private double acceptBorder(double time) {
|
---|
335 | return 0.85;
|
---|
336 | }
|
---|
337 |
|
---|
338 | // Ã¥æÃ¥å�ââ¬ï¿½Ã£ââ¬Å¡Ã¢â¬â¢Ã£ï¿½Ã»Ã£ï¿½Ã¼Ã£ï¿½ââ¬âã�êã�ââ¬Å¾Ã£ÃââãÃâüãÃâââ¬Â°
|
---|
339 | private Action mode0(double time) throws Exception {
|
---|
340 | if (time < 0.05) {
|
---|
341 | return getBid0();
|
---|
342 | } else if (time < 0.1) {
|
---|
343 | return getBidA();
|
---|
344 | } else if (time < 0.5) {
|
---|
345 | return getBid0();
|
---|
346 | } else if (time < 0.98) {
|
---|
347 | return getBidA();
|
---|
348 | } else {
|
---|
349 | return getBidC();
|
---|
350 | }
|
---|
351 | // if(time< 0.99){
|
---|
352 | // return getBidC();
|
---|
353 | // } else {
|
---|
354 | // //
|
---|
355 | // ã�õã�ââ¬âã�ââ¬Ëã�Ã
|
---|
356 | ¸Ã£Ãâââ¬ÅãÃâÃâãÃâââ¬Â°
|
---|
357 | // return getBidD();
|
---|
358 | // }
|
---|
359 | }
|
---|
360 |
|
---|
361 | // æÃ
|
---|
362 |  ÃÅãââ¬Å¡Ã
|
---|
363 | âãââ¬Å¡Ã¢â¬Â¹Ã£ÃââãÃâüãÃâââ¬Â°
|
---|
364 | private Action mode1(double time) {
|
---|
365 | if (time < 0.95) {
|
---|
366 | return getBid0();
|
---|
367 | } else {
|
---|
368 | return new Offer(getAgentID(), myBestBidByOpponent);
|
---|
369 | }
|
---|
370 | }
|
---|
371 |
|
---|
372 | // èÿââ¬ËÃ¥ââ¬Å¡Ã¯Â¿Â½Ã¦Ã
|
---|
373 | ½Ã¢Ã§Ã´Ã¢
|
---|
374 | private Action mode2(double time) throws Exception {
|
---|
375 | if (time < 0.05) {
|
---|
376 | return getBid0();
|
---|
377 | } else {
|
---|
378 | return getBidB();
|
---|
379 | }
|
---|
380 | }
|
---|
381 |
|
---|
382 | // Ã¥ü÷èêÿã�ââ¢Ã£ââ¬Å¡Ã¢â¬Â¹Ã£ÃââãÃâüãÃâââ¬Â°
|
---|
383 | private Action mode3(double time) {
|
---|
384 | if (getUtility(myBestBidByOpponent) > getUtility(
|
---|
385 | mySessionData.lastBid)) {
|
---|
386 | return new Offer(getAgentID(), myBestBidByOpponent);
|
---|
387 | } else {
|
---|
388 | return new Offer(getAgentID(), mySessionData.lastBid);
|
---|
389 | }
|
---|
390 | }
|
---|
391 |
|
---|
392 | // äøââ¬ÃÂ¥Ãâ ââ¬Â¡Ã¥æÃ¥å�ââ¬ï¿½Ã£ï¿½ââ¬âã�êã�ââ¬Å¾
|
---|
393 | private Action mode(double time) {
|
---|
394 | if (time < 0.99) {
|
---|
395 | return getBidA();
|
---|
396 | } else {
|
---|
397 | return getBidC();
|
---|
398 | }
|
---|
399 | }
|
---|
400 |
|
---|
401 | private void beforeOffer(Bid bid) {
|
---|
402 | // System.out.println("offer : " + getUtility(bid));
|
---|
403 | }
|
---|
404 |
|
---|
405 | // Ã¥üñSA(ÃÂ¥Ãâ öéââ¢ï¿½Ã£ï¿½Ã
|
---|
406 | âç÷éã�ââ¬Å¾)
|
---|
407 | private Action getBid0() {
|
---|
408 | Bid bid = utilitySpace.getDomain().getRandomBid(null);
|
---|
409 | if (getUtility(bid) > 0.80) {
|
---|
410 | // ã�Ã
|
---|
411 | ¸Ã£ï¿½Ã¾Ã£ï¿½Ã«Ã£ï¿½ââ¬Â ã�þã��ã�ââ¬Å¾Ã£ï¿½ï¿½
|
---|
412 | beforeOffer(bid);
|
---|
413 | return new Offer(getAgentID(), bid);
|
---|
414 | } else {
|
---|
415 | return getBidA();
|
---|
416 | }
|
---|
417 | }
|
---|
418 |
|
---|
419 | // Ã¥ü÷SA(æââ¢Ã®Ã©ââ¬Ã
|
---|
420 | ¡Ã£ï¿½Ã®SA
|
---|
421 | // èââ¬Â¡ÃªÃÂ¥Ãâ ââ¬Â ã�ëã�èã�ãã�æéëÃÅã�ââ¬Å¾Ã£ââ¬Å¡Ã¢â¬Å¡Ã£ï¿½Ã®Ã£ââ¬Å¡Ã¢â¬â¢Ã©ï¿½Ã¸Ã¦Ã
|
---|
422 | Â Ã
|
---|
423 | ¾)
|
---|
424 | private Action getBidA() {
|
---|
425 | double t0 = 10000;
|
---|
426 | double t1 = 0.001;
|
---|
427 | Bid baseBid;
|
---|
428 | if (myBestBid == null || rand.nextInt(10) != 0) {
|
---|
429 | baseBid = utilitySpace.getDomain().getRandomBid(null);
|
---|
430 | Bid bid = getSA(baseBid, t0, t1);
|
---|
431 | beforeOffer(bid);
|
---|
432 | return new Offer(getAgentID(), bid);
|
---|
433 | } else {
|
---|
434 | return new Offer(getAgentID(), myBestBid);
|
---|
435 | }
|
---|
436 | // ãÃâéãÃâóãÃâââ¬Ã£ÃâàBidãââ¬Å¡Ã¢â¬â¢Ã¥ââ¬Â¦Ãâã�ëSA
|
---|
437 | }
|
---|
438 |
|
---|
439 | // bidãââ¬Å¡Ã¢â¬â¢SAã�ëãââ¬Å¡Ãâ ãââ¬Å¡Ã
|
---|
440 |  Ã¦ââ¬ï¿½Ã¹Ã¥ââ¬âââ¬Å¾Ã£ï¿½ââ¢Ã£ââ¬Å¡Ã¢â¬Â¹
|
---|
441 | private Bid getSA(Bid bid, double t0, double t1) {
|
---|
442 | int step = 1;
|
---|
443 | double def = 0.99;
|
---|
444 | int issueSize = bid.getIssues().size();
|
---|
445 | double bid_util;
|
---|
446 |
|
---|
447 | try {
|
---|
448 | do {
|
---|
449 | double current_util = utilitySpace.getUtility(bid); // ç�þÃÂ¥Ã
|
---|
450 | âèã�îbidã�îutil
|
---|
451 | Bid newBid = new Bid(bid); // Ã¥äââ¬Â°Ã¦ââ¬ÂºÃ´Ã£ï¿½ââ¬Â¢Ã£ââ¬Å¡Ã
|
---|
452 | âãââ¬Å¡Ã¢â¬Â¹Ã§ï¿½Ã¾ÃÂ¥Ã
|
---|
453 | âèã�îbid
|
---|
454 | int selectedIssueId = rand.nextInt(issueSize); // issueã�îé�øæÃ
|
---|
455 | Â Ã
|
---|
456 | ¾
|
---|
457 | IssueInteger issueInteger = (IssueInteger) bid.getIssues()
|
---|
458 | .get(selectedIssueId); // ãââ‰â¬Ã©ï¿½Ã¸Ã¦Ã
|
---|
459 | Â Ã
|
---|
460 | ¾Ã£ï¿½ââ¬Â¢Ã£ââ¬Å¡Ã
|
---|
461 | âã�Ã
|
---|
462 | ¸issue
|
---|
463 | int issueId = issueInteger.getNumber(); // é�øæÃ
|
---|
464 | Â Ã
|
---|
465 | ¾Ã£ï¿½ââ¬âã�Ã
|
---|
466 | ¸issueã�îindex
|
---|
467 | ValueInteger issueValue = (ValueInteger) bid.getValue(issueId); // issueã�îindexã�îéÃâèÃÂ¥Ãâ ââ¬Â ã�îåââ¬Ã¤
|
---|
468 | int issueValueInt = Integer.valueOf(issueValue.toString())
|
---|
469 | .intValue(); // intÃÂ¥Ã
|
---|
470 | ¾ââ¬Â¹Ã£ï¿½Ã¸
|
---|
471 | int max = issueInteger.getUpperBound(); // é�øæÃ
|
---|
472 | Â Ã
|
---|
473 | ¾Ã£ï¿½ââ¬Â¢Ã£ââ¬Å¡Ã
|
---|
474 | âã�Ã
|
---|
475 | ¸issueã�îãÃâââ¬Â°Ã£Ãâáãââ¬Å¡Ã¤Ã£Ãâóã�îæÃ
|
---|
476 | âââ¬Ã¥äçåââ¬Ã¤
|
---|
477 | int min = issueInteger.getLowerBound(); // é�øæÃ
|
---|
478 | Â Ã
|
---|
479 | ¾Ã£ï¿½ââ¬Â¢Ã£ââ¬Å¡Ã
|
---|
480 | âã�Ã
|
---|
481 | ¸issueã�îãÃâââ¬Â°Ã£Ãâáãââ¬Å¡Ã¤Ã£Ãâóã�îæÃ
|
---|
482 | âââ¬Ã¥ð�åââ¬Ã¤
|
---|
483 |
|
---|
484 | int flag = rand.nextBoolean() ? 1 : -1;
|
---|
485 |
|
---|
486 | if (issueValueInt >= min && issueValueInt <= max) {
|
---|
487 | if (issueValueInt + step > max) {
|
---|
488 | flag = -1;
|
---|
489 | } else if (issueValueInt - step < min) {
|
---|
490 | flag = 1;
|
---|
491 | }
|
---|
492 | }
|
---|
493 |
|
---|
494 | Value valueInteger = new ValueInteger(
|
---|
495 | issueValueInt + flag * step);
|
---|
496 | newBid = newBid.putValue(issueId, valueInteger);
|
---|
497 |
|
---|
498 | double newBid_util;
|
---|
499 | newBid_util = utilitySpace.getUtility(newBid);
|
---|
500 | double bf_cost = 1.0 - current_util;
|
---|
501 | double af_cost = 1.0 - newBid_util;
|
---|
502 |
|
---|
503 | double p = Math.pow(Math.E, -Math.abs(af_cost - bf_cost) / t0);
|
---|
504 |
|
---|
505 | if (af_cost < bf_cost || rand.nextDouble() < p) {
|
---|
506 | bid = new Bid(newBid); // bidãââ¬Å¡Ã¢â¬â¢Ã¦ââ¬ÂºÃ´Ã¦ââ¬âð
|
---|
507 | }
|
---|
508 | t0 *= def;
|
---|
509 | bid_util = newBid_util;
|
---|
510 | } while (t0 > t1);
|
---|
511 |
|
---|
512 | // myBestBidã�îèèÃÂÃ¥îÃ
|
---|
513 | ¡
|
---|
514 | // myBestBidã�Ã
|
---|
515 | âã�êã�ââ¬Å¾Ã£ï¿½Ã¨Ã£ï¿½ï¿½
|
---|
516 | if (myBestBid == null) {
|
---|
517 | myBestBid = new Bid(bid);
|
---|
518 | } else {
|
---|
519 | renewBids(bid);
|
---|
520 | }
|
---|
521 |
|
---|
522 | if (bid_util <= 0.9 && myBestBid != null) {
|
---|
523 | bid = new Bid(myBestBid); // 0.9äûÃ¥äøÃ
|
---|
524 |  Ã£ï¿½Ã®Ã¥ââ¬Ã¤Ã£ï¿½Ã
|
---|
525 | âå�ââ¬âãââ¬Å¡Ã
|
---|
526 | âã�êã�ââ¬Â¹Ã£ï¿½Ã£Ã£ï¿½Ã
|
---|
527 | ¸Ã£ï¿½Ã¨Ã£ï¿½ï¿½
|
---|
528 | }
|
---|
529 |
|
---|
530 | } catch (Exception e) {
|
---|
531 | e.printStackTrace();
|
---|
532 | }
|
---|
533 | return bid;
|
---|
534 | }
|
---|
535 |
|
---|
536 | // èÿââ¬ËÃ¥ââ¬Å¡Ã¯Â¿Â½Ã¦Ã
|
---|
537 | ½Ã¢Ã§Ã´Ã¢(çââ¬ÂºÃ¸Ã¦ââ¬Â°Ã¢â¬Â¹Ã£ï¿½Ã®Ã¥ââ¬Â¡ÃºÃ¦ââ¬âù)ã�ëãââ¬Å¡Ãâ ãââ¬Å¡Ã¢â¬Â¹Bidã�îå�ââ¬âÃ¥þââ¬â
|
---|
538 | private Action getBidB() throws Exception {
|
---|
539 | try {
|
---|
540 | if (myBestBidByOpponent == null) {
|
---|
541 | return getBidA();
|
---|
542 | } else {
|
---|
543 | Bid bid = new Bid(myBestBidByOpponent);
|
---|
544 | System.out.println("before : " + getUtility(bid));
|
---|
545 | Bid newBid = new Bid(nearSearch(bid));
|
---|
546 | System.out.println("after :" + getUtility(newBid));
|
---|
547 | if (bestBid == null
|
---|
548 | || getUtility(newBid) > getUtility(bestBid)) {
|
---|
549 | bestBid = new Bid(newBid);
|
---|
550 | }
|
---|
551 | // newBidã�Ã
|
---|
552 | â0.8äûÃ¥äøââ¬Â¹Ã£ï¿½ÃªÃ£ââ¬Å¡Ã¢â¬Â°Ã¦Ã
|
---|
553 | ½Ã¡Ã§ââ¬ï¿½Ã¨Ã£ï¿½ââ¬âã�êã�ââ¬Å¾
|
---|
554 | if (getUtility(newBid) < 0.8) {
|
---|
555 | return getBidA();
|
---|
556 | } else {
|
---|
557 | return new Offer(getAgentID(), newBid);
|
---|
558 | }
|
---|
559 | }
|
---|
560 | } catch (Exception e) {
|
---|
561 | e.printStackTrace();
|
---|
562 | }
|
---|
563 | return getBidA();
|
---|
564 | }
|
---|
565 |
|
---|
566 | // baseBidã�îèÿââ¬ËÃ¥ââ¬Å¡Ã¯Â¿Â½Ã£ââ¬Å¡Ã¢â¬â¢Ã¦Ã
|
---|
567 | ½Ã¢Ã§Ã´Ã¢Ã£ï¿½ââ¢Ã£ââ¬Å¡Ã¢â¬Â¹
|
---|
568 | private Bid nearSearch(Bid baseBid) throws Exception {
|
---|
569 |
|
---|
570 | List<Issue> issues = utilitySpace.getDomain().getIssues(); // Ã¥ââ¬Â¦Ã¨issueã�îå�ââ¬âÃ¥þââ¬â
|
---|
571 | Bid nextBid = new Bid(baseBid); // ç�þÃÂ¥Ã
|
---|
572 | âèã�îBidãââ¬Å¡Ã¢â¬â¢Ã£ââ¬Å¡Ã³Ã£Ãâââ¬ï¿½Ã£Ãâü
|
---|
573 | int numberIndexes = utilitySpace.getDomain().getIssues().size(); // ãââ¬Å¡Ã¤Ã£ââ¬Å¡Ã·Ã£ÃâÃ¥ãÃâüã�îæââ¬Â¢Ã°
|
---|
574 | for (int i = 0; i < numberIndexes; i++) {
|
---|
575 | int index = rand.nextInt(issues.size());
|
---|
576 | IssueInteger lIssueInteger = (IssueInteger) issues.get(index); // æÃ
|
---|
577 | âââ¬Â¡Ã¥îÃ
|
---|
578 | ¡Ã£ï¿½ââ¬âã�Ã
|
---|
579 | ¸indexã�îissueãââ¬Å¡Ã¢â¬â¢Ã¥ï¿½ââ¬âÃ¥þââ¬â
|
---|
580 | int issueNumber = lIssueInteger.getNumber(); // issueã�îindex
|
---|
581 | // 0
|
---|
582 | // ãââ¬Ã
|
---|
583 | â
|
---|
584 | // 9
|
---|
585 |
|
---|
586 | int optionIndex = 0; // Ã¥äââ¬Â°Ã¦ââ¬ÂºÃ´Ã£ï¿½ââ¢Ã£ââ¬Å¡Ã¢â¬Â¹ValueÃ¥ââ¬Ã¤
|
---|
587 |
|
---|
588 | optionIndex = selectIndex(lIssueInteger, baseBid);
|
---|
589 |
|
---|
590 | nextBid = nextBid.putValue(issueNumber,
|
---|
591 | new ValueInteger(optionIndex)); // ç�þÃÂ¥Ã
|
---|
592 | âèã�îBidã�ââ¬Â¹Ã£ââ¬Å¡Ã¢â¬Â°Issueã�îåââ¬Ã¤Ã£ââ¬Å¡Ã¢â¬â¢Ã¥ââ¬Â¦Ã¥ãââ¬Å¡Ã
|
---|
593 | âæââ¬ÂºÃ¿Ã£ï¿½Ãâ ãââ¬Å¡Ã¢â¬Â¹
|
---|
594 | }
|
---|
595 | return nextBid;
|
---|
596 | }
|
---|
597 |
|
---|
598 | private int selectIndex(IssueInteger issue, Bid baseBid) {
|
---|
599 | int issueNumber = issue.getNumber();
|
---|
600 | int issueIndexMin = issue.getLowerBound(); // issueã�îäøââ¬Â¹Ã©ââ¢ï¿½Ã¥ââ¬Ã¤
|
---|
601 | int issueIndexMax = issue.getUpperBound(); // issueã�îäøÃ
|
---|
602 |  Ã©ââ¢ï¿½Ã¥ââ¬Ã¤
|
---|
603 | int candidate = issueIndexMin;
|
---|
604 | Bid sBid = new Bid(baseBid);
|
---|
605 | for (int i = issueIndexMin; i < issueIndexMax; i++) {
|
---|
606 | Bid tempBid = new Bid(baseBid);
|
---|
607 | tempBid = tempBid.putValue(issueNumber, new ValueInteger(i));
|
---|
608 | if (getUtility(sBid) <= getUtility(tempBid)) {
|
---|
609 | candidate = i;
|
---|
610 | }
|
---|
611 | sBid = sBid.putValue(issueNumber, new ValueInteger(candidate));
|
---|
612 | }
|
---|
613 | return candidate;
|
---|
614 | }
|
---|
615 |
|
---|
616 | // Ã¥ââ¬Â°Ã¯Â¿Â½Ã¥ââ¬ÂºÃ
|
---|
617 | ¾Ã¥ï¿½Ãâ æââ¬Å¾Ã¯Â¿Â½Ã£ï¿½ââ¬âã�Ã
|
---|
618 | ¸Ã£Ãâââ¬ÅãÃâÃâãÃâââ¬Â°Ã£ââ¬Å¡Ã¢â¬â¢Ã¦ï¿½ï¿½Ã¦Ã¡Ãâ
|
---|
619 | private Action getBidC() {
|
---|
620 | if (mySessionData != null) {
|
---|
621 | renewBids(mySessionData.lastBid);
|
---|
622 | return new Offer(getAgentID(), mySessionData.lastBid);
|
---|
623 | } else {
|
---|
624 | return getBidA();
|
---|
625 | }
|
---|
626 | }
|
---|
627 |
|
---|
628 | // æââ¬Å¾Ã¯Â¿Â½Ã¥ââ¬ÂºÃ³Ã§Ã
|
---|
629 | ¡ââ¬Å¾Ã£ï¿½Ã«Ã£ï¿½Ã
|
---|
630 | ¡Ã£ââ¬Å¡Ã¢â¬Â°Ã£ï¿½ââ¬âã�Ã
|
---|
631 | ¸Ã£Ãâââ¬ÅãÃâÃâãÃâââ¬Â°Ã£ââ¬Å¡Ã¢â¬â¢Ã¨Ã¿ââ¬ï¿½Ã£ï¿½ââ¢
|
---|
632 | private Action getBidD() throws Exception {
|
---|
633 | Bid baseBid = utilitySpace.getDomain().getRandomBid(null);
|
---|
634 | System.out.println("noisy!!");
|
---|
635 | do {
|
---|
636 | baseBid = nearSearchWithNoise(baseBid);
|
---|
637 | } while (getUtility(baseBid) > 0.55);
|
---|
638 | return new Offer(getAgentID(), nearSearchWithNoise(baseBid));
|
---|
639 | }
|
---|
640 |
|
---|
641 | private Bid nearSearchWithNoise(Bid baseBid) throws Exception {
|
---|
642 |
|
---|
643 | List<Issue> issues = utilitySpace.getDomain().getIssues(); // Ã¥ââ¬Â¦Ã¨issueã�îå�ââ¬âÃ¥þââ¬â
|
---|
644 | Bid nextBid = new Bid(baseBid); // ç�þÃÂ¥Ã
|
---|
645 | âèã�îBidãââ¬Å¡Ã¢â¬â¢Ã£ââ¬Å¡Ã³Ã£Ãâââ¬ï¿½Ã£Ãâü
|
---|
646 | int numberIndexes = utilitySpace.getDomain().getIssues().size(); // ãââ¬Å¡Ã¤Ã£ââ¬Å¡Ã·Ã£ÃâÃ¥ãÃâüã�îæââ¬Â¢Ã°
|
---|
647 | for (int i = 0; i < numberIndexes; i++) {
|
---|
648 | int index = rand.nextInt(issues.size());
|
---|
649 | IssueInteger lIssueInteger = (IssueInteger) issues.get(index); // æÃ
|
---|
650 | âââ¬Â¡Ã¥îÃ
|
---|
651 | ¡Ã£ï¿½ââ¬âã�Ã
|
---|
652 | ¸indexã�îissueãââ¬Å¡Ã¢â¬â¢Ã¥ï¿½ââ¬âÃ¥þââ¬â
|
---|
653 | int issueNumber = lIssueInteger.getNumber(); // issueã�îindex
|
---|
654 | // 0
|
---|
655 | // ãââ¬Ã
|
---|
656 | â
|
---|
657 | // 9
|
---|
658 |
|
---|
659 | int optionIndex = 0; // Ã¥äââ¬Â°Ã¦ââ¬ÂºÃ´Ã£ï¿½ââ¢Ã£ââ¬Å¡Ã¢â¬Â¹ValueÃ¥ââ¬Ã¤
|
---|
660 |
|
---|
661 | optionIndex = selectIndexWithNoise(lIssueInteger, baseBid);
|
---|
662 |
|
---|
663 | nextBid = nextBid.putValue(issueNumber,
|
---|
664 | new ValueInteger(optionIndex)); // ç�þÃÂ¥Ã
|
---|
665 | âèã�îBidã�ââ¬Â¹Ã£ââ¬Å¡Ã¢â¬Â°Issueã�îåââ¬Ã¤Ã£ââ¬Å¡Ã¢â¬â¢Ã¥ââ¬Â¦Ã¥ãââ¬Å¡Ã
|
---|
666 | âæââ¬ÂºÃ¿Ã£ï¿½Ãâ ãââ¬Å¡Ã¢â¬Â¹
|
---|
667 | }
|
---|
668 | return nextBid;
|
---|
669 | }
|
---|
670 |
|
---|
671 | private int selectIndexWithNoise(IssueInteger issue, Bid baseBid) {
|
---|
672 | int issueNumber = issue.getNumber();
|
---|
673 | int issueIndexMin = issue.getLowerBound(); // issueã�îäøââ¬Â¹Ã©ââ¢ï¿½Ã¥ââ¬Ã¤
|
---|
674 | int issueIndexMax = issue.getUpperBound(); // issueã�îäøÃ
|
---|
675 |  Ã©ââ¢ï¿½Ã¥ââ¬Ã¤
|
---|
676 | int candidate = issueIndexMin;
|
---|
677 | Bid sBid = new Bid(baseBid);
|
---|
678 | for (int i = issueIndexMin; i < issueIndexMax; i++) {
|
---|
679 | Bid tempBid = new Bid(baseBid);
|
---|
680 | tempBid = tempBid.putValue(issueNumber, new ValueInteger(i));
|
---|
681 | // Ã¥äÃ
|
---|
682 | ¡Ã¥ðââ¬Ëèââ¬Â¡ÃªÃÂ¥Ãâ ââ¬Â ã�ëã�èã�ãã�ææÃ
|
---|
683 | âââ¬Â°ÃÂ¥Ãâ éã�ëã�ââ¢Ã£ââ¬Å¡Ã¢â¬Â¹
|
---|
684 | if (getUtility(sBid) <= getUtility(tempBid)
|
---|
685 | && rand.nextInt(10) == 0) {
|
---|
686 | candidate = i;
|
---|
687 | }
|
---|
688 | sBid = sBid.putValue(issueNumber, new ValueInteger(candidate));
|
---|
689 | }
|
---|
690 | return candidate;
|
---|
691 | }
|
---|
692 |
|
---|
693 | private void renewBids(Bid bid) {
|
---|
694 | if (myBestBid == null) {
|
---|
695 | myBestBid = new Bid(bid);
|
---|
696 | } else if (getUtility(myBestBid) < getUtility(bid)) {
|
---|
697 | // System.out.printf("modified %f to %f\n",
|
---|
698 | // getUtility(myBestBid), getUtility(bid));
|
---|
699 | myBestBid = new Bid(bid);
|
---|
700 | }
|
---|
701 | }
|
---|
702 |
|
---|
703 | @Override
|
---|
704 | public String getDescription() {
|
---|
705 | return "ANAC2014 compatible with non-linear utility spaces";
|
---|
706 | }
|
---|
707 | }
|
---|
708 |
|
---|
709 | class TRPSessionData implements Serializable {
|
---|
710 | Bid lastBid; // çââ¬ÂºÃ´Ã¥ââ¬Â°Ã¯Â¿Â½Ã£ï¿½Ã®Ã¥ï¿½Ãâ æââ¬Å¾Ã¯Â¿Â½Ã£ï¿½ââ¬âã�Ã
|
---|
711 | ¸Ã£Ãâââ¬ÅãÃâÃâãÃâÃâ
|
---|
712 | double lastTime; // çââ¬ÂºÃ´Ã¥ââ¬Â°Ã¯Â¿Â½Ã£ï¿½Ã®Ã¦ââ¢ââ¬Å¡Ã©ââ¬âââ¬Å
|
---|
713 | boolean isAgree; // Ã¥îÃ
|
---|
714 | ¸Ã©Ã
|
---|
715 | ¡ââ¬ÂºÃ¥ï¿½Ãâ æââ¬Å¾Ã¯Â¿Â½Ã£ï¿½ââ¬âã�Ã
|
---|
716 | ¸Ã£ï¿½ââ¬Â¹
|
---|
717 | static int breakCount = 0; // æñúèãââ¬Å¡Ã¥ââ¬ÂºÃ
|
---|
718 | ¾Ã¦ââ¬Â¢Ã°
|
---|
719 | Bid myBestBid; // æÃ
|
---|
720 | âââ¬Ã£ââ¬Å¡Ã¢â¬Å¡ÃÂ¥Ã
|
---|
721 |  Ã¹Ã§ââ¬ï¿½Ã¨Ã£ï¿½Ã®Ã©Ã«ÃÅã�ââ¬Å¾Ã£Ãâââ¬ÅãÃâÃâãÃâÃâ
|
---|
722 | Bid opponentBestBid; // çââ¬ÂºÃ¸Ã¦ââ¬Â°Ã¢â¬Â¹Ã£ï¿½Ã
|
---|
723 | âæ��æáÃâ ã�ââ¬âã�Ã
|
---|
724 | ¸Ã¤Ã¸ââ¬Ã§ââ¬Â¢ÃªÃ¨ââ¬Â°Ã¯Ã£ï¿½ââ¬Å¾Ã£Ãâââ¬ÅãÃâÃâãÃâÃâ
|
---|
725 | int round;
|
---|
726 |
|
---|
727 | public TRPSessionData(Bid lastBid, double lastTime, boolean isAgree,
|
---|
728 | Bid myBestBid, Bid myBestBidByOpponent, int round, boolean reset) {
|
---|
729 | this.lastBid = lastBid;
|
---|
730 | this.lastTime = lastTime;
|
---|
731 | this.isAgree = isAgree;
|
---|
732 |
|
---|
733 | if (reset) {
|
---|
734 | this.breakCount = 0;
|
---|
735 | }
|
---|
736 | if (!isAgree) {
|
---|
737 | this.breakCount++;
|
---|
738 | }
|
---|
739 | this.myBestBid = myBestBid;
|
---|
740 | this.opponentBestBid = myBestBidByOpponent;
|
---|
741 | this.round = round;
|
---|
742 | }
|
---|
743 |
|
---|
744 | public void printAll() {
|
---|
745 | // System.out.println("----------------------------------");
|
---|
746 | // System.out.println("lastBid :" + lastBid);
|
---|
747 | // System.out.println("time :" + lastTime);
|
---|
748 | // System.out.println("isAgree :" + isAgree);
|
---|
749 | // System.out.println("breakCo :" + breakCount);
|
---|
750 | // System.out.println("round :" + round);
|
---|
751 | }
|
---|
752 |
|
---|
753 | }
|
---|