source: src/main/java/agents/anac/y2017/tucagent/UtilitySpaceHypothesis.java@ 346

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

Initial import : Genius 9.0.0

File size: 1.5 KB
Line 
1package agents.anac.y2017.tucagent;
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, WeightHypothesis pWeightHyp,
18 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.0D;
44
45 for (int k = 0; k < fEvalHyp.length; k++) {
46 try {
47 u = u + fWeightHyp.getWeight(k) * fEvalHyp[k].getEvaluator()
48 .getEvaluation(fUS, pBid, ((Issue) issues.get(k)).getNumber()).doubleValue();
49 } catch (Exception e) {
50 u = 0.0D;
51 }
52 }
53 return u;
54 }
55
56 public String toString() {
57 String lResult = "";
58 lResult = lResult + fWeightHyp.toString();
59 for (EvaluatorHypothesis lHyp : fEvalHyp) {
60 lResult = lResult + lHyp.toString() + ";";
61 }
62 lResult = lResult + String.format("%1.5f", new Object[] { Double.valueOf(getProbability()) });
63 return lResult;
64 }
65}
Note: See TracBrowser for help on using the repository browser.