org.jamesframework.ext.problems.objectives

## Class NormalizedObjective<SolutionType extends Solution,DataType>

• java.lang.Object
• org.jamesframework.ext.problems.objectives.NormalizedObjective<SolutionType,DataType>
• Type Parameters:
SolutionType - solution type to be evaluated, required to extend Solution
DataType - underlying data type
All Implemented Interfaces:
Objective<SolutionType,DataType>

public class NormalizedObjective<SolutionType extends Solution,DataType>
extends Object
implements Objective<SolutionType,DataType>
A normalized objective wraps another objective and normalizes all produces evaluations from a given interval [min, max] to [0, 1]. Normalization is linear, using the formula $normalized = \frac{value - min}{max - min}.$ Both methods used for full and delta evaluation return a NormalizedEvaluation.
Author:
Herman De Beukelaer
• ### Constructor Summary

Constructors
Constructor and Description
NormalizedObjective(Objective<? super SolutionType,? super DataType> obj, double min, double max)
Create a normalized objective that wraps the given objective and normalizes all produced evaluation from [min, max] to [0, 1].
• ### Method Summary

All Methods
Modifier and Type Method and Description
<ActualSolutionType extends SolutionType>NormalizedEvaluation evaluate(Move<? super ActualSolutionType> move, ActualSolutionType curSolution, Evaluation curEvaluation, DataType data)
Computes the normalized evaluation of the solution obtained by applying the given move to the current solution.
NormalizedEvaluation evaluate(SolutionType solution, DataType data)
Computes the normalized evaluation of the given solution.
double getMax()
Get upper bound of normalization interval
double getMin()
Get lower bound of normalization interval.
Objective<? super SolutionType,? super DataType> getUnnormalizedObjective()
Get the original, unnormalized objective.
boolean isMinimizing()
Indicates whether the produced evaluations are to be minimized.
String toString()
Create string representation of normalized objective, indicating the original, unnormalized objective and normalization interval.
• ### Methods inherited from class java.lang.Object

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

• #### NormalizedObjective

public NormalizedObjective(Objective<? super SolutionType,? super DataType> obj,
double min,
double max)
Create a normalized objective that wraps the given objective and normalizes all produced evaluation from [min, max] to [0, 1].
Parameters:
obj - original, unnormalized objective
min - lower bound of normalization interval
max - upper bound of normalization interval
Throws:
NullPointerException - if obj is null
• ### Method Detail

• #### getUnnormalizedObjective

public Objective<? super SolutionType,? super DataType> getUnnormalizedObjective()
Get the original, unnormalized objective.
Returns:
unnormalized objective
• #### getMin

public double getMin()
Get lower bound of normalization interval.
Returns:
lower bound
• #### getMax

public double getMax()
Get upper bound of normalization interval
Returns:
upper bound
• #### evaluate

public NormalizedEvaluation evaluate(SolutionType solution,
DataType data)
Computes the normalized evaluation of the given solution. The solution is first evaluated using the original, unnormalized objective after which the returned evaluation is wrapped in a NormalizedEvaluation.
Specified by:
evaluate in interface Objective<SolutionType extends Solution,DataType>
Parameters:
solution - solution to evaluate
data - underlying data
Returns:
normalized evaluation
• #### evaluate

public <ActualSolutionType extends SolutionType> NormalizedEvaluation evaluate(Move<? super ActualSolutionType> move,
ActualSolutionType curSolution,
Evaluation curEvaluation,
DataType data)
Computes the normalized evaluation of the solution obtained by applying the given move to the current solution. Relies on delta evaluation performed by the original, unnormalized objective, whose result is wrapped in a NormalizedEvaluation.
Specified by:
evaluate in interface Objective<SolutionType extends Solution,DataType>
Type Parameters:
ActualSolutionType - the actual solution type of the problem that is being solved; a subtype of the solution types of both the objective and the applied move
Parameters:
move - move to evaluate
curSolution - current solution
curEvaluation - evaluation of current solution
data - underlying data used for evaluation
Returns:
evaluation of modified solution obtained when applying the move to the current solution
Throws:
IncompatibleDeltaEvaluationException - if the delta evaluation of the original objective is not compatible with the received move type
• #### isMinimizing

public boolean isMinimizing()
Indicates whether the produced evaluations are to be minimized. Delegates to the original, unnormalized evaluation.
Specified by:
isMinimizing in interface Objective<SolutionType extends Solution,DataType>
Returns:
true if evaluations are to be minimized, false if they are to be maximized
• #### toString

public String toString()
Create string representation of normalized objective, indicating the original, unnormalized objective and normalization interval.
Overrides:
toString in class Object
Returns:
string representation