org.jamesframework.core.problems.objectives.evaluations

## Class PenalizedEvaluation

• java.lang.Object
• org.jamesframework.core.problems.objectives.evaluations.PenalizedEvaluation
• All Implemented Interfaces:
Evaluation

public class PenalizedEvaluation
extends Object
implements Evaluation
A penalized evaluation consists of an original evaluation and a number of penalizing validations. The final double value is computed by subtracting or adding the assigned penalties from/to the original evaluation, depending on whether evaluations are being maximized or minimized, respectively.
Author:
Herman De Beukelaer
• ### Constructor Summary

Constructors
Constructor and Description
PenalizedEvaluation(Evaluation evaluation, boolean minimizing)
Create a new penalized evaluation, given the original evaluation.
• ### Method Summary

All Methods
Modifier and Type Method and Description
void addPenalizingValidation(Object key, PenalizingValidation penalizingValidation)
Add a penalty expressed by a penalizing validation object.
Evaluation getEvaluation()
Get the original unpenalized evaluation.
PenalizingValidation getPenalizingValidation(Object key)
Retrieve the penalizing validation object corresponding to the given key.
double getValue()
Get the penalized value.
String toString()
Get a string representation that contains both the penalized and unpenalized evaluation, where the latter is only included if penalties have actually been assigned.
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
• ### Constructor Detail

• #### PenalizedEvaluation

public PenalizedEvaluation(Evaluation evaluation,
boolean minimizing)
Create a new penalized evaluation, given the original evaluation. Penalties can be added later by calling addPenalizingValidation(Object, PenalizingValidation). If minimizing is true, penalties are added to the original evaluation, else they are subtracted from it.
Parameters:
evaluation - original evaluation
minimizing - true if evaluations are minimized
• ### Method Detail

public void addPenalizingValidation(Object key,
PenalizingValidation penalizingValidation)
Add a penalty expressed by a penalizing validation object. A key is required that can be used to retrieve the validation object later.
Parameters:
key - key used to retrieve the validation object later
penalizingValidation - penalizing validation that indicates the assigned penalty
• #### getPenalizingValidation

public PenalizingValidation getPenalizingValidation(Object key)
Retrieve the penalizing validation object corresponding to the given key. If no penalty has been added with this key, null is returned.
Parameters:
key - key specified when adding the penalizing validation
Returns:
retrieved validation object, or null if no validation object was added with this key
• #### getEvaluation

public Evaluation getEvaluation()
Get the original unpenalized evaluation.
Returns:
original evaluation
• #### getValue

public double getValue()
Get the penalized value. The returned value is only guaranteed to be correct if the original evaluation and penalizing validation objects have not been modified after they were added to this penalized evaluation.
Specified by:
getValue in interface Evaluation
Returns:
penalized evaluation
• #### toString

public String toString()
Get a string representation that contains both the penalized and unpenalized evaluation, where the latter is only included if penalties have actually been assigned.
Overrides:
toString in class Object
Returns:
string representation