source: src/main/java/agents/anac/y2016/agenthp2/module_BidGenerate.java

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

Initial import : Genius 9.0.0

File size: 2.2 KB
Line 
1package agents.anac.y2016.agenthp2;
2
3import java.util.HashMap;
4
5import genius.core.Bid;
6import genius.core.issue.Issue;
7import genius.core.issue.Value;
8import genius.core.issue.ValueInteger;
9import genius.core.utility.AbstractUtilitySpace;
10import genius.core.utility.AdditiveUtilitySpace;
11import genius.core.utility.Evaluator;
12import genius.core.utility.EvaluatorDiscrete;
13import genius.core.utility.EvaluatorInteger;
14
15public class module_BidGenerate {
16
17 private Bid maximumEvaluationBid = null; // 評価が最大のBid格納用
18
19 /**
20 * コンストラクタ
21 *
22 * @param utilitySpace
23 * 自分の効用関数
24 */
25 public module_BidGenerate(AbstractUtilitySpace utilitySpace) {
26
27 // 評価が最大のBid作成
28 HashMap<Integer, Value> template = new HashMap<Integer, Value>();
29 for (Issue tmp : utilitySpace.getDomain().getIssues()) {
30
31 // 論点のEvaluator取得
32 int issue_num = tmp.getNumber(); // 論点番号
33 Evaluator evaluator = ((AdditiveUtilitySpace) utilitySpace)
34 .getEvaluator(issue_num);
35
36 switch (tmp.getType()) {
37
38 // 論点が離散値の場合
39 case DISCRETE:
40 EvaluatorDiscrete evaluatorDiscrete = (EvaluatorDiscrete) evaluator;
41 template.put(issue_num, evaluatorDiscrete.getMaxValue());
42 break;
43
44 // 論点が連続値の場合
45 case INTEGER:
46 EvaluatorInteger evaluatorInteger = (EvaluatorInteger) evaluator;
47 double upperValueEvaluation = evaluatorInteger
48 .getUtilHighestValue();
49 double lowerValueEvaluation = evaluatorInteger
50 .getUtilLowestValue();
51 int maxInt = -1;
52 if (upperValueEvaluation > lowerValueEvaluation) {
53 maxInt = evaluatorInteger.getUpperBound();
54 } else {
55 maxInt = evaluatorInteger.getLowerBound();
56 }
57 ValueInteger maxValue = new ValueInteger(maxInt);
58 template.put(issue_num, (Value) maxValue);
59 break;
60
61 case OBJECTIVE:
62 case REAL:
63 case UNKNOWN:
64 default:
65 break;
66 }
67 }
68 maximumEvaluationBid = new Bid(utilitySpace.getDomain(), template);
69 }
70
71 /**
72 * 自分の効用が最大になるBidを返す
73 *
74 * @return maximumEvaluationBid 自分の効用が最大のBid
75 */
76 public Bid getMaximumEvaluationBid() {
77
78 return maximumEvaluationBid;
79 }
80}
Note: See TracBrowser for help on using the repository browser.