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