public interface IObjective
Objectives can be either hard or soft objectives. Hard objectives can be satisfied or unsatisfied. If all of the hard objectives are satisfied on a single solution, then it is considered to be a valid (or goal) solution.
Certain objectives can have inner state for calculating the fitness value. In this case a new instance is necessary
for every new thread, and the createNew method should not return the same instance more than once.
| Modifier and Type | Method and Description |
|---|---|
IObjective |
createNew()
Returns an instance of the
IObjective. |
java.util.Comparator<java.lang.Double> |
getComparator()
Returns a
Comparator which is used to compare fitness (doubles). |
java.lang.Double |
getFitness(ThreadContext context)
Calculates the value of the objective on a given solution (trajectory).
|
int |
getLevel()
Gets the level of the objective.
|
java.lang.String |
getName()
Returns the name of the objective.
|
void |
init(ThreadContext context)
Initializes the objective.
|
boolean |
isHardObjective()
Returns true if the objective is a hard objective.
|
boolean |
satisifiesHardObjective(java.lang.Double fitness)
Determines if the given fitness value satisfies the hard objective.
|
void |
setComparator(java.util.Comparator<java.lang.Double> comparator)
Sets the
Comparator which is used to compare fitness (doubles). |
void |
setLevel(int level)
Set the level of the objective.
|
java.lang.String getName()
void setComparator(java.util.Comparator<java.lang.Double> comparator)
Comparator which is used to compare fitness (doubles). It determines whether the objective is to
minimize or maximize (or minimize or maximize a delta from a given number).comparator - The comparator.java.util.Comparator<java.lang.Double> getComparator()
Comparator which is used to compare fitness (doubles). It determines whether the objective is
to minimize or maximize (or minimize or maximize a delta from a given number).java.lang.Double getFitness(ThreadContext context)
context - The ThreadContextvoid init(ThreadContext context)
context - The ThreadContext.IObjective createNew()
IObjective. If it returns the same instance, all the methods has to be thread
save as they are called concurrently.boolean isHardObjective()
satisifiesHardObjective(Double) is called.satisifiesHardObjective(Double),
IObjectiveboolean satisifiesHardObjective(java.lang.Double fitness)
fitness - The fitness value of a solution.IObjectivevoid setLevel(int level)
int getLevel()