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