[126] | 1 | package agents.bayesianopponentmodel;
|
---|
| 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,
|
---|
| 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 | }
|
---|