SolutionType
- solution type to be evaluated, required to extend Solution
DataType
- underlying data typepublic class WeightedIndex<SolutionType extends org.jamesframework.core.problems.Solution,DataType> extends Object implements org.jamesframework.core.problems.objectives.Objective<SolutionType,DataType>
Constructor and Description |
---|
WeightedIndex()
Create an empty weighted index.
|
Modifier and Type | Method and Description |
---|---|
void |
addObjective(org.jamesframework.core.problems.objectives.Objective<? super SolutionType,? super DataType> objective,
double weight)
Add an objective with corresponding weight.
|
<ActualSolutionType extends SolutionType> |
evaluate(org.jamesframework.core.search.neigh.Move<? super ActualSolutionType> move,
ActualSolutionType curSolution,
org.jamesframework.core.problems.objectives.evaluations.Evaluation curEvaluation,
DataType data)
Delta evaluation.
|
WeightedIndexEvaluation |
evaluate(SolutionType solution,
DataType data)
Produces an evaluation object that reflects the weighted sum of evaluations of all underlying objectives.
|
boolean |
isMinimizing()
Weighted index is always maximizing, so this method always returns
false . |
boolean |
removeObjective(org.jamesframework.core.problems.objectives.Objective<? super SolutionType,? super DataType> objective)
Remove an objective, if present.
|
public void addObjective(org.jamesframework.core.problems.objectives.Objective<? super SolutionType,? super DataType> objective, double weight)
objective
- objective to be addedweight
- corresponding weight (strictly positive)IllegalArgumentException
- if the specified weight is not strictly positivepublic boolean removeObjective(org.jamesframework.core.problems.objectives.Objective<? super SolutionType,? super DataType> objective)
true
if the objective has been successfully
removed, false
if it was not contained in the index.objective
- objective to removetrue
if the objective has been successfully removedpublic boolean isMinimizing()
false
.
Scores for contained minimizing objectives are negated, i.e. their sign is flipped.isMinimizing
in interface org.jamesframework.core.problems.objectives.Objective<SolutionType extends org.jamesframework.core.problems.Solution,DataType>
false
public WeightedIndexEvaluation evaluate(SolutionType solution, DataType data)
evaluate
in interface org.jamesframework.core.problems.objectives.Objective<SolutionType extends org.jamesframework.core.problems.Solution,DataType>
solution
- solution to evaluatedata
- data to be used for evaluationpublic <ActualSolutionType extends SolutionType> WeightedIndexEvaluation evaluate(org.jamesframework.core.search.neigh.Move<? super ActualSolutionType> move, ActualSolutionType curSolution, org.jamesframework.core.problems.objectives.evaluations.Evaluation curEvaluation, DataType data)
evaluate
in interface org.jamesframework.core.problems.objectives.Objective<SolutionType extends org.jamesframework.core.problems.Solution,DataType>
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 movemove
- move to be evaluatedcurSolution
- current solution of a local searchcurEvaluation
- evaluation of current solutiondata
- data to be used for evaluationCopyright © 2015. All rights reserved.