source: src/main/java/agents/bayesianopponentmodel/UtilitySpaceHypothesis.java@ 127

Last change on this file since 127 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: 1.5 KB
Line 
1package agents.bayesianopponentmodel;
2
3import java.util.List;
4
5import genius.core.Bid;
6import genius.core.Domain;
7import genius.core.issue.Issue;
8import genius.core.utility.AdditiveUtilitySpace;
9
10public class UtilitySpaceHypothesis extends Hypothesis {
11 private WeightHypothesis fWeightHyp;
12 private EvaluatorHypothesis[] fEvalHyp;
13 private Domain fDomain;
14 private AdditiveUtilitySpace fUS;
15 List<Issue> issues;
16
17 public UtilitySpaceHypothesis(Domain pDomain, AdditiveUtilitySpace pUS,
18 WeightHypothesis pWeightHyp, EvaluatorHypothesis[] pEvalHyp) {
19 fUS = pUS;
20 fDomain = pDomain;
21 issues = fDomain.getIssues();
22 fWeightHyp = pWeightHyp;
23 fEvalHyp = pEvalHyp;
24 }
25
26 public Domain getDomain() {
27 return fDomain;
28 }
29
30 public AdditiveUtilitySpace getUtilitySpace() {
31 return fUS;
32 }
33
34 public EvaluatorHypothesis[] getEvalHyp() {
35 return fEvalHyp;
36 }
37
38 public WeightHypothesis getHeightHyp() {
39 return fWeightHyp;
40 }
41
42 public double getUtility(Bid pBid) {
43 double u = 0;
44
45 for (int k = 0; k < fEvalHyp.length; k++) {
46 try {
47 u = u
48 + fWeightHyp.getWeight(k)
49 * fEvalHyp[k].getEvaluator().getEvaluation(fUS, pBid,
50 issues.get(k).getNumber());
51 } catch (Exception e) {
52 u = 0;
53 }
54 }
55 return u;
56
57 }
58
59 public String toString() {
60 String lResult = "";
61 lResult += fWeightHyp.toString();
62 for (EvaluatorHypothesis lHyp : fEvalHyp) {
63 lResult += lHyp.toString() + ";";
64 }
65 lResult += String.format("%1.5f", getProbability());
66 return lResult;
67 }
68}
Note: See TracBrowser for help on using the repository browser.