public abstract class BaseObjective extends java.lang.Object implements IObjective
IObjective namely its name,
comparator, level and fitness hard constraint.| Modifier and Type | Field and Description |
|---|---|
protected java.util.Comparator<java.lang.Double> |
comparator |
protected double |
fitnessConstraint |
protected java.util.Comparator<java.lang.Double> |
fitnessConstraintComparator |
protected boolean |
isThereFitnessConstraint |
protected int |
level |
protected java.lang.String |
name |
| Constructor and Description |
|---|
BaseObjective(java.lang.String name) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj) |
java.util.Comparator<java.lang.Double> |
getComparator()
Returns a
Comparator which is used to compare fitness (doubles). |
int |
getLevel()
Gets the level of the objective.
|
java.lang.String |
getName()
Returns the name of the objective.
|
int |
hashCode() |
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 |
toString() |
BaseObjective |
withComparator(java.util.Comparator<java.lang.Double> comparator) |
BaseObjective |
withHardConstraintOnFitness(double fitnessConstraint)
Adds a hard constraint on the fitness value.
|
BaseObjective |
withHardConstraintOnFitness(double fitnessConstraint,
java.util.Comparator<java.lang.Double> fitnessConstraintComparator)
Adds a hard constraint on the fitness value.
|
BaseObjective |
withLevel(int level) |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitcreateNew, getFitnessprotected final java.lang.String name
protected java.util.Comparator<java.lang.Double> comparator
protected int level
protected double fitnessConstraint
protected boolean isThereFitnessConstraint
protected java.util.Comparator<java.lang.Double> fitnessConstraintComparator
public java.lang.String getName()
IObjectivegetName in interface IObjectivepublic void setComparator(java.util.Comparator<java.lang.Double> comparator)
IObjectiveComparator 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).setComparator in interface IObjectivecomparator - The comparator.public java.util.Comparator<java.lang.Double> getComparator()
IObjectiveComparator 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).getComparator in interface IObjectivepublic void setLevel(int level)
IObjectivesetLevel in interface IObjectivepublic int getLevel()
IObjectivegetLevel in interface IObjectivepublic BaseObjective withLevel(int level)
public BaseObjective withComparator(java.util.Comparator<java.lang.Double> comparator)
public BaseObjective withHardConstraintOnFitness(double fitnessConstraint, java.util.Comparator<java.lang.Double> fitnessConstraintComparator)
fitnessConstraint - Solutions should be better than this value.fitnessConstraintComparator - Comparator to determine if the current state is better than the given value.public BaseObjective withHardConstraintOnFitness(double fitnessConstraint)
fitnessConstraint - Solutions should be better than this value.public void init(ThreadContext context)
IObjectiveinit in interface IObjectivecontext - The ThreadContext.public boolean isHardObjective()
IObjectiveIObjective.satisifiesHardObjective(Double) is called.isHardObjective in interface IObjectiveIObjective.satisifiesHardObjective(Double),
IObjectivepublic boolean satisifiesHardObjective(java.lang.Double fitness)
IObjectivesatisifiesHardObjective in interface IObjectivefitness - The fitness value of a solution.IObjectivepublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object