source: src/main/java/agents/anac/y2014/E2Agent/myUtility/AgentKStorategy.java

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

Initial import : Genius 9.0.0

File size: 4.7 KB
Line 
1package agents.anac.y2014.E2Agent.myUtility;
2
3import java.util.ArrayList;
4import java.util.Collection;
5import java.util.Collections;
6import java.util.Comparator;
7import java.util.HashMap;
8import java.util.List;
9import java.util.Random;
10
11import agents.anac.y2011.TheNegotiator.BidsCollection;
12import agents.anac.y2012.MetaAgent.agents.WinnerAgent.opponentOffers;
13import genius.core.Agent;
14import genius.core.Bid;
15import genius.core.actions.Accept;
16import genius.core.actions.Action;
17import genius.core.actions.Offer;
18import genius.core.issue.Issue;
19import genius.core.issue.IssueInteger;
20import genius.core.issue.Value;
21import genius.core.issue.ValueInteger;
22import genius.core.timeline.Timeline;
23import genius.core.utility.*;
24
25public class AgentKStorategy {
26 private Random randomnr = null;
27 private IAgentKStorategyComponent component = null;
28
29 public AgentKStorategy(Random r, IAgentKStorategyComponent com) {
30 randomnr = r;
31 component = com;
32 }
33
34 /**
35 * 相手�将�的��案�る����Bid�推測最大効用値
36 */
37 public double emax(double myu, double var) {
38 return myu + (1 - myu) * d(var);
39 }
40
41
42 /**
43 * 相手�Bid�広�り
44 * @param var 相手�Bid�よる自身�効用空間���る効用値�分散
45 */
46 private double d(double var) {
47 return Math.sqrt(12.0 * var);
48 }
49
50
51 /**
52 * �案�るBid
53 * @param t 時間
54 * @param a 妥��る速度を調整
55 */
56 private double target(double t, double myu, double var, double a) {
57 return 1 - (1 - emax(myu, var)) * Math.pow(t, a);
58 }
59
60 /**
61 * �案�るBid(ratioを導入)
62 * @param t 時間
63 * @param var 分散
64 * @param a 妥��る速度を調節
65 */
66 public double targetRatio(double t, double myu, double var, double a) {
67 double r = ratio(t, myu, var, a, component.g(t));
68 return r * (1 - (1 - emax(myu, var)) * Math.pow(t, a)) + (1 - r);
69 }
70
71 /**
72 * �互��譲歩�度��
73 * @param t 時間
74 * @param a 妥��る速度を調整
75 * @param g 最低譲歩度��
76 */
77 private double ratio(double t, double myu, double var, double a, double g) {
78 double val = (d(var) + g) / (1 - target(t, myu, var, a));
79 if (2 <= val) {
80 val = 2;
81 }
82 return val;
83 }
84
85 /**
86 * 相手�Bid�対�����る����を判断�る時�用�る係数
87 */
88 private double alpha(double myu, double tau) {
89 return 1 + tau + 10 * myu - 2 * tau * myu;
90 }
91
92 /**
93 * 相手�Bid�る時��ら�をも��る���係数
94 */
95 private double beta(double myu, double tau) {
96 return alpha(myu, tau) + randomnr.nextFloat() * tau - tau / 2.0;
97 }
98
99 /**
100 * ��確率
101 * @param t 時間
102 * @param u 相手�効用値
103 * @param tau ä¿‚æ•°
104 */
105 public double pAccept(double t, double u, double myu, double var, double tau) {
106 return (Math.pow(t, 5) / 5.0) +
107 (u - emax(myu, var)) + (u - targetRatio(t, myu, var, alpha(myu, tau)));
108 }
109
110
111 /**
112 * 相手�強固�場��歩�寄り関数
113 */
114 private double approach(double t, double myu, double var, double a) {
115 double ganma = -300 * t + 400;
116 double delta = targetRatio(t, myu, var, a) - emax(myu, var);
117 double epsilon = 1.0 / Math.pow(delta, 2);
118 if (ganma <= epsilon) {
119 epsilon = ganma;
120 }
121 return (delta * epsilon) / ganma;
122 }
123
124
125 /**
126 * 最終的�Bid�基準関数
127 */
128 public double fintarget(double t, double myu, double var, double tau) {
129 double b = beta(myu, tau);
130 double em = emax(myu, var);
131 double tar = targetRatio(t, myu, var, b);
132 double ret = em;
133 if (em < tar) {
134 ret = tar - approach(t, myu, var, b);
135 }
136 return ret;
137 }
138}
Note: See TracBrowser for help on using the repository browser.