public class EvaluatorDiscrete extends java.lang.Object implements Evaluator
ValueDiscrete
is evaluated, there are two possibilities:
Integer
utilities.
This is because we need to stay backwards compatible with older versions of
Genius.Constructor and Description |
---|
EvaluatorDiscrete()
Creates a new discrete evaluator with weight 0 and no values.
|
Modifier and Type | Method and Description |
---|---|
void |
addEvaluation(ValueDiscrete value,
java.lang.Integer evaluation)
Add a new possible value to the issue.
|
void |
clear()
wipe evaluation values.
|
EvaluatorDiscrete |
clone() |
boolean |
equals(java.lang.Object obj) |
java.lang.Double |
getDoubleValue(ValueDiscrete value) |
java.lang.Integer |
getEvalMax() |
java.lang.Double |
getEvaluation(AdditiveUtilitySpace uspace,
Bid bid,
int issueID)
Returns the evaluation of the value of the issue of the bid.
|
java.lang.Double |
getEvaluation(ValueDiscrete value) |
java.lang.Integer |
getEvaluationNotNormalized(Bid bid,
int ID) |
java.lang.Integer |
getEvaluationNotNormalized(ValueDiscrete value) |
Value |
getMaxValue() |
Value |
getMinValue() |
EVALUATORTYPE |
getType() |
java.lang.Integer |
getValue(ValueDiscrete value) |
java.util.Set<ValueDiscrete> |
getValues() |
double |
getWeight() |
int |
hashCode() |
java.lang.String |
isComplete(Objective whichobj)
Check whether the evaluator has enough information to make an evaluation.
|
void |
loadFromXML(SimpleElement pRoot)
Loads
fEval from a SimpleElement containing something like this:
<item index="1" description="Buy bags of chips and party nuts for all guests."
value="Chips and Nuts" cost="100.0" evaluation="3"> . |
void |
lockWeight()
Locks the weight of this Evaluator.
|
java.lang.Double |
normalize(java.lang.Integer EvalValueL) |
void |
setEvaluation(Value val,
int evaluation)
Sets the evaluation for Value
val . |
void |
setEvaluationDouble(ValueDiscrete val,
double evaluation)
identical to
setEvaluation(Value, int) but accepts double. |
void |
setWeight(double wt)
Sets the weigth with which an Objective or Issue is evaluated.
|
SimpleElement |
setXML(SimpleElement evalObj)
Sets weights and evaluator properties for the object in SimpleElement
representation that is passed to it.
|
java.lang.String |
toString() |
void |
unlockWeight()
Unlock the weight of this evaluator.
|
boolean |
weightLocked() |
public EvaluatorDiscrete()
public double getWeight()
public void setWeight(double wt)
Evaluator
public void lockWeight()
lockWeight
in interface Evaluator
public void unlockWeight()
unlockWeight
in interface Evaluator
public boolean weightLocked()
weightLocked
in interface Evaluator
public java.lang.Integer getValue(ValueDiscrete value)
value
- of which the evaluation is requested. ALways returns rounded
values, to be compatible with the old version of PN where
values could be only integers.public java.lang.Double getDoubleValue(ValueDiscrete value)
value
- public java.lang.Integer getEvalMax()
java.lang.Exception
- if there are no alternatives.public java.lang.Double getEvaluation(AdditiveUtilitySpace uspace, Bid bid, int issueID)
getEvaluation
in interface Evaluator
uspace
- preference profile.bid
- of which we want a value evaluated.issueID
- unique id of the issue of which we want the evaluation.public java.lang.Double getEvaluation(ValueDiscrete value) throws java.lang.Exception
value
- of the issue.java.lang.Exception
- if value is null.public java.lang.Integer getEvaluationNotNormalized(Bid bid, int ID) throws java.lang.Exception
bid
- ID
- of the issue of which we are interested in the valuejava.lang.Exception
- if bid or value is null.public java.lang.Integer getEvaluationNotNormalized(ValueDiscrete value) throws java.lang.Exception
value
- of the issue.getValue(ValueDiscrete)
.java.lang.Exception
- if value is null.public java.lang.Double normalize(java.lang.Integer EvalValueL)
EvalValueL
- java.lang.Exception
- if no evaluators or illegal values in evaluator.
ASSUMED that Max value is at least 1, because EVERY
evaluatordiscrete is at least 1.public EVALUATORTYPE getType()
public void setEvaluation(Value val, int evaluation) throws java.lang.Exception
val
. If this value doesn't
exist yet in this Evaluator, adds it as well.val
- The value to add or have its evaluation modified.evaluation
- The new evaluation.java.lang.Exception
- if evaluationpublic void setEvaluationDouble(ValueDiscrete val, double evaluation) throws java.lang.Exception
setEvaluation(Value, int)
but accepts double.val
- evaluation
- java.lang.Exception
public void clear()
public void loadFromXML(SimpleElement pRoot)
fEval
from a SimpleElement containing something like this:
<item index="1" description="Buy bags of chips and party nuts for all guests."
value="Chips and Nuts" cost="100.0" evaluation="3">
.
Only the value and evaluation are used, the rest is ignored. NOTICE: the
fWeight of this EvaluatorDiscrete is not set.loadFromXML
in interface Evaluator
public SimpleElement setXML(SimpleElement evalObj)
evalObj
- The object of which to set the evaluation properties.public java.lang.String isComplete(Objective whichobj)
Evaluator
isComplete
in interface Evaluator
whichobj
- is the objective/issue to which this evaluator is attached.public void addEvaluation(ValueDiscrete value, java.lang.Integer evaluation)
setEvaluation(Value, int)
. To set Double values, use
setEvaluationDouble(ValueDiscrete, double)
.value
- to be added to the issue.evaluation
- of the value.public Value getMaxValue()
public Value getMinValue()
public EvaluatorDiscrete clone()
public java.util.Set<ValueDiscrete> getValues()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object