Skip to content

Accessing the evaluation of a value

Taha Doğan Güneş edited this page Nov 21, 2017 · 1 revision

You can access the evaluation of all discrete values of all discrete issues (and the weights of issues) by:

AbstractUtilitySpace utilitySpace = info.getUtilitySpace();

AdditiveUtilitySpace additiveUtilitySpace = (AdditiveUtilitySpace) utilitySpace;

List<Issue> issues = additiveUtilitySpace.getDomain().getIssues();

for (Issue issue : issues) {
    int issueNumber = issue.getNumber();
    System.out.println(">> " + issue.getName() + " weight: " + additiveUtilitySpace.getWeight(issueNumber));

    // Assuming that issues are discrete only
    IssueDiscrete issueDiscrete = (IssueDiscrete) issue;
    EvaluatorDiscrete evaluatorDiscrete = (EvaluatorDiscrete) additiveUtilitySpace.getEvaluator(issueNumber);

    for (ValueDiscrete valueDiscrete : issueDiscrete.getValues()) {
        System.out.println(valueDiscrete.getValue());
        System.out.println("Evaluation(getValue): " + evaluatorDiscrete.getValue(valueDiscrete));
        System.out.println("Evaluation(getEvaluation): " + evaluatorDiscrete.getEvaluation(valueDiscrete));
    }

}

For instance for the preference profile given as an example (party1_utility.xml) here, the output is going to be:

>> `Food` weight: 0.19
> Chips and Nuts
Evaluation(getEvaluation): 1.0
Evaluation(getValue): 3
> Finger-Food
Evaluation(getEvaluation): 0.6666666666666666
Evaluation(getValue): 2
> Handmade Food
Evaluation(getEvaluation): 0.6666666666666666
Evaluation(getValue): 2
> Catering
Evaluation(getEvaluation): 0.3333333333333333
Evaluation(getValue): 1

A bid for Food issue having the Handmade Food value, is the best option in terms of the preference profile that the agent received. As stated in the Basics, to calculate the utility of a bid:

 u(i1, i2, i3, i4) = w1 * u(i1) + w2 * u(i2 ) + w3 · u(i3) + w4 * u(i4)

More concretely, it can be seen that for example: Let's say i1 is Food. Then w1 is going to be 0.19 and u(i1) is going to be 0.66, according to this preference profile.

Clone this wiki locally