[1] | 1 | package agents.anac.y2017.tucagent;
|
---|
| 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 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 | }
|
---|