source: src/main/java/agents/anac/y2015/fairy/strategy.java@ 345

Last change on this file since 345 was 1, checked in by Wouter Pasman, 6 years ago

Initial import : Genius 9.0.0

File size: 5.7 KB
Line 
1package agents.anac.y2015.fairy;
2
3import java.util.ArrayList;
4
5import genius.core.Bid;
6import genius.core.utility.AdditiveUtilitySpace;
7
8public class strategy {
9 private AdditiveUtilitySpace utilitySpace;
10 private negotiatingInfo negotiatingInfo;
11 //inamoto
12 public double minThreshold = 0.8;
13
14 private double df = 0.0; // 髯キ謇假スス�イ髯滄��ゥ繧托スス�ソ郢ァ閧イ�ス
15 private double rv = 0.0; // 鬨セ�。陷キ�ゥ�ス�ソ隴乗��ス�セ�ス�。髫エ�ャ�ス�シ
16
17 public strategy(AdditiveUtilitySpace utilitySpace, negotiatingInfo negotiatingInfo) {
18 this.utilitySpace = utilitySpace;
19 this.negotiatingInfo = negotiatingInfo;
20 df = utilitySpace.getDiscountFactor();
21 rv = utilitySpace.getReservationValue();
22 }
23
24 // 髯キ�ソ隲、諛カ�ス�ョ�ス�ケ髯具スサ�ス�、髯橸スウ�ス�ス
25 public boolean selectAccept(Bid offeredBid, double time) {
26 try {
27 double offeredBidUtil = utilitySpace.getUtility(offeredBid);
28
29 if(offeredBidUtil >= getThreshold(time)){ return true; }
30 else{ return false; }
31 } catch (Exception e) {
32 System.out.println("髯キ�ソ隲、諛カ�ス�ョ�ス�ケ髯具スサ�ス�、髯橸スウ陞「�ケ遶頑・「譽費ソス�ア髫ー�ィ陷会スア�ス�ス驍オ�コ�ス�セ驍オ�コ陷会スア隨ウ�ス");
33 e.printStackTrace();
34 return false;
35 }
36 }
37
38 // 髣費ソス�ス�、髮九j�ス�ス�オ郢ァ�ス�ス�コ�ス�ス隲「蟷�・懶ソス�ス
39 public boolean selectEndNegotiation(double time) {
40 if(rv * Math.pow(df,time) > getThreshold(time) ) return true;
41
42 return false;
43 }
44
45 // 鬯ョ�「�ス�セ髯区サゑスス�、驛「�ァ陞ウ螟イ�ス�ソ隴∫オカ�ス
46 public double getThreshold(double time) {
47
48
49 double a = minThreshold; //隴幢ソス闖エ蠑ア縲堤ケァ繧�イ玖ォ「荵怜�邵コ�ォ陟募干笳�クコ�ス��邵コ髦ェ�櫁屐�、(陷亥沺辟皮クコ�ョ陟托スキ雎鯉ソス)
50// double threshold = 1.0 - (1.0 - a) * time;
51 //boulware鬚ィ縺ォ險よュ」
52 double threshold = 1.0 - (1.0 - a ) * Math.pow(time, (1.0/0.5));
53//隰厄ソス�ョ螢ケ��ケァ蠕娯�サ邵コ�ス�玖屐�、邵コ�ォ陷キ莉」ツー邵コ�」邵コ�ヲ騾カ�エ驍ア螟ょ飭邵コ�ォ陞溽甥陌夂クコ蜷カ�狗クコ蜉ア窶ウ邵コ�ス�ス�、邵コ�ョ陞ウ貅ス讓溽クイ�ス
54
55// System.out.println("test round:"+time);
56// System.out.println("test time:"+(double)time/180);
57 /* 髣費ソス�ス�、髮九i蛻、陝具スカ鬨セ�。�ス�・驍オ�コ�ス�ォ髯憺屮�ス�コ驍オ�コ�ス�・驍オ�コ髯ヲ�。hreshold(t)驛「�ァ陞ウ螟イ�ス�ィ�ス�ュ鬮ォ�ェ陋ケ�サ隨假ソス�ケ�ァ�ス�ス */
58 /* negotiatingInfo驍オ�コ闕オ譎「�ス闃ス�ャ�ス陷郁肩�ス�。闔��・�ス�ア�ス�・髮趣ソス�ス�エ驍オ�コ�ス�ョ鬩搾スィ�ス�ア鬮ォ�ェ陜捺コ佩鈴劈�」�ス�ア驛「�ァ髮区ァォ蠕宣辧蜍溷ケイ邵イ蝣、�ク�コ鬮ヲ�ェ�ス迢暦スク�コ�ス�ョ驍オ�コ�ス�ァ髣厄スエ�ス�ソ驍オ�コ�ス�」驍オ�コ�ス�ヲ驛「�ァ郢ァ鬆托ソス驍オ�コ�ス�ス */
59 // 髣懃§�ス�ス�シ�ス�ス
60 ArrayList<Object> opponents = negotiatingInfo.getOpponents();
61 //闔臥エ具スコ�コ邵コ謔溽イ玖ォ「荳奇ス帝ィセ�イ郢ァ竏壺�サ邵コ�ス�狗クコ�ィ邵コ髦ェ竊鍋クコ�ッ髢セ�ェ髴�スォ郢ァ繧会スゥ閧エ�・�オ騾ァ�ス竊楢アャ竏夲シ�ケァ蠕鯉ス狗クイ�ス(陟墓「ァ辟皮クコ�ョ陟托スア雎鯉ソス)
62 int acceptNum = 0;
63 for(Object sender:opponents){
64 if(negotiatingInfo.getOpponentsBool(sender))
65 acceptNum += 1;
66 }
67 int negotiatorNum = negotiatingInfo.getNegotiatorNum()-1;//髢セ�ェ陋サ�ス�帝ォッ�、邵コ�ス笳�滋�、雋り歓�ス�ス�ス隰ィ�ー
68
69// System.out.println("test:"+(double)acceptNum/negotiatorNum);
70
71 threshold = threshold - (threshold - minThreshold)*(double)acceptNum/negotiatorNum;
72 //陷サ�ィ郢ァ鄙ォ窶イ陷キ蝓湲咲クコ蜉ア窶サ邵コ�ス笳�ケァ迚咏イ玖ォ「荳奇シ�邵コ�ヲ邵コ�ス�玖滋�コ隰ィ�ー邵コ�ョ驕抵スコ驍�ソス�ス邵コ�ス邵コ蜿ー�コ�、雋ょウィ�ス邵コ蜉ア窶ウ邵コ�ス�ス�、郢ァ蜑�スク荵敖」郢ァ荵晢ソス繧�螺邵コ�ス邵コ蜉ア�ス竏オ諤呵抄蠑ア縲堤ケァ�ョinThreshold邵コ�セ邵コ�ァ
73 //髫ェ閧イ�ョ蜉ア��邵コ貅假シ�邵コ髦ェ�櫁屐�、-(髫ェ閧イ�ョ蜉ア��邵コ貅假シ�邵コ髦ェ�櫁屐�、-隴幢ソス闖エ蠑ア�ス邵コ蜉ア窶ウ邵コ�ス�ス�、)*驕抵スコ驍�ソス
74
75 negotiatingInfo.clearOpponentsBool();//闔��、雋り�諞セ隲キ荵晢ソス郢ァ�ッ郢晢スェ郢ァ�「
76/*螯・蜊斐@縺吶℃縺ェ縺�h縺�↓菫ョ豁」縺吶k縺ォ縺ッ
77 *逶ク謇九′蜊泌鴨逧�°髱槫鵠蜉帷噪縺九r蛻、譁ュ縺吶k蠢�ヲ√′縺ゅk縲�
78 * 蜊泌鴨逧�°縺、雉帛酔竊偵%縺。繧峨�蠑キ豌励↓蜃コ縺ヲ繧ゅh縺�
79 * 髱槫鵠蜉帷噪縺九▽雉帛酔竊偵%縺。繧峨�蠑ア豌励↓蜃コ縺溘⊇縺�′繧医>
80 * */
81 //割引雇用の適用
82 threshold = threshold * Math.pow(df,time);
83 //最低の値は守る。です。
84 if(threshold < minThreshold) threshold = minThreshold;
85
86// System.out.println("threshold:"+threshold);
87 return threshold;
88 }
89}
Note: See TracBrowser for help on using the repository browser.