1 | package genius.core.utility;
|
---|
2 |
|
---|
3 | import java.io.Serializable;
|
---|
4 |
|
---|
5 | import genius.core.Bid;
|
---|
6 | import genius.core.issue.Objective;
|
---|
7 | import genius.core.xml.SimpleElement;
|
---|
8 |
|
---|
9 | /**
|
---|
10 | * Evaluator is an object that translates discrete values into an evaluation
|
---|
11 | * value. The UtilitySpace attaches it to an issue.
|
---|
12 | *
|
---|
13 | * @author Dmytro
|
---|
14 | */
|
---|
15 | public interface Evaluator extends Serializable {
|
---|
16 |
|
---|
17 | // Interface methods
|
---|
18 | /**
|
---|
19 | * @return the weight associated with this, a value in [0,1]
|
---|
20 | */
|
---|
21 | public double getWeight();
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * Sets the weigth with which an Objective or Issue is evaluated.
|
---|
25 | *
|
---|
26 | * @param wt
|
---|
27 | * The new weight, a value in [0,1].
|
---|
28 | */
|
---|
29 | public void setWeight(double wt);
|
---|
30 |
|
---|
31 | /**
|
---|
32 | * lockWeight is a flag affecting the behaviour of the normalize function in
|
---|
33 | * the utility space. This is used to change behaviour when users drag
|
---|
34 | * sliders
|
---|
35 | */
|
---|
36 | public void lockWeight();
|
---|
37 |
|
---|
38 | /**
|
---|
39 | * Method to unlock a weight. A weight must be unlocked to modify it.
|
---|
40 | */
|
---|
41 | public void unlockWeight();
|
---|
42 |
|
---|
43 | /**
|
---|
44 | * @return true if weight is locked.
|
---|
45 | */
|
---|
46 | public boolean weightLocked();
|
---|
47 |
|
---|
48 | /**
|
---|
49 | * This method returns the utility of the value of an issue. Note that the
|
---|
50 | * value is not multiplied by the issue weight, and is therefore
|
---|
51 | * non-normalized.
|
---|
52 | *
|
---|
53 | * @param uspace
|
---|
54 | * preference profile
|
---|
55 | * @param bid
|
---|
56 | * in which the value is contained.
|
---|
57 | * @param index
|
---|
58 | * unique ID of the issue in the bid for which we want an
|
---|
59 | * evaluation.
|
---|
60 | * @return utility of the value for an issue, not normalized by the issue
|
---|
61 | * weight.
|
---|
62 | */
|
---|
63 | public Double getEvaluation(AdditiveUtilitySpace uspace, Bid bid,
|
---|
64 | int index);
|
---|
65 |
|
---|
66 | /**
|
---|
67 | * @return type of evaluation function, for example EVALUATORTYPE.LINEAR.
|
---|
68 | */
|
---|
69 | public EVALUATORTYPE getType();
|
---|
70 |
|
---|
71 | /**
|
---|
72 | * Load the evaluator from an XML file
|
---|
73 | *
|
---|
74 | * @param pRoot
|
---|
75 | */
|
---|
76 | public void loadFromXML(SimpleElement pRoot);
|
---|
77 |
|
---|
78 | /**
|
---|
79 | * Check whether the evaluator has enough information to make an evaluation.
|
---|
80 | *
|
---|
81 | * @param whichObjective
|
---|
82 | * is the objective/issue to which this evaluator is attached.
|
---|
83 | * @return String describing lacking component, or null if the evaluator is
|
---|
84 | * complete.
|
---|
85 | */
|
---|
86 | public String isComplete(Objective whichObjective);
|
---|
87 |
|
---|
88 | /**
|
---|
89 | * @return clone of the current object.
|
---|
90 | */
|
---|
91 | public Evaluator clone();
|
---|
92 | }
|
---|