Package org.opt4j.core
Class Objectives
The
Objectives contains the Objective-Values pairs of
an Individual. Additionally, the feasibility of the
Objectives can be set. The feasibility isFeasible() is
true by default. Set this value to false to indicate that the
corresponding Individual is infeasible (e.g., it violates
constraints).-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Constraintsprotected DominationStrategyprotected booleanFields inherited from class org.opt4j.core.CriterionSet
array -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds the objective with the specified double value.voidAdds the objective with the specified integer value.voidAdds the objective with the specified value.voidadd(Objectives objectives) Deprecated.voidaddAll(Objectives objectives) Adds all objective with the specified value specified inObjectives.double[]array()Returns an array of all values which all have to be minimized.doubledistance(Objectives other) Calculates the euclidean distance of twoObjectives.booleandominates(Objectives opponent) Returnstrueif this objectives dominate the specified objectives.Value<?>Returns the value that is assigned to the given objective.Returns the objective that is assigned to the given value.Returns the constraints.Returns the domination strategy of the Objective.getKeys()Returns all objectives.Collection<Value<?>>Returns all values.booleanisEqual(Objectives opponent) Returnstrueif this objectives are equal to the specified objectives.booleanReturns the feasibility.iterator()voidsetConstraints(Constraints constraints) Sets the constraints.voidsetFeasible(boolean feasible) Sets the feasibility.intsize()Returns the number of setObjectives.protected voidsubmit()Calculates the array.toString()booleanweaklyDominates(Objectives opponent) Returnstrueif this objectives weakly dominates the specified objectives.Methods inherited from class org.opt4j.core.CriterionSet
add, distance, isEqualMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
map
-
feasible
protected boolean feasible -
constraints
-
dominationStrategy
-
-
Constructor Details
-
Objectives
Deprecated.Inject aProvider<Objectives>object instead and createObjectivesobjects withprovider.get(). -
Objectives
-
-
Method Details
-
getConstraints
Returns the constraints.- Returns:
- the constraints
-
setConstraints
Sets the constraints.- Parameters:
constraints- the constraints to set
-
getDominationStrategy
Returns the domination strategy of the Objective.- Returns:
- the domination strategy of the Objective
-
isFeasible
public boolean isFeasible()Returns the feasibility.- Returns:
- the feasibility
-
setFeasible
public void setFeasible(boolean feasible) Sets the feasibility.- Parameters:
feasible- the feasibility to set
-
iterator
-
array
public double[] array()Returns an array of all values which all have to be minimized. Do not call this method before all objectives were added!- Specified by:
arrayin classCriterionSet<Objective>- Returns:
- an array containing values which have to be minimized
- See Also:
-
submit
protected void submit()Calculates the array. -
size
public int size()Returns the number of setObjectives.- Overrides:
sizein classCriterionSet<Objective>- Returns:
- the number of set objectives
-
getKeys
Returns all objectives.- Overrides:
getKeysin classCriterionSet<Objective>- Returns:
- all objectives
-
getValues
Returns all values.- Overrides:
getValuesin classCriterionSet<Objective>- Returns:
- all values
-
get
Returns the value that is assigned to the given objective. Returnsnullif the objective does not exist.- Overrides:
getin classCriterionSet<Objective>- Parameters:
objective- the given objective- Returns:
- the value
-
get
Returns the objective that is assigned to the given value. Returnsnullif the value does not exist.- Overrides:
getin classCriterionSet<Objective>- Parameters:
value- the given value- Returns:
- the objective
-
add
Adds the objective with the specified value.- Overrides:
addin classCriterionSet<Objective>- Parameters:
objective- the objectivevalue- the value
-
add
Adds the objective with the specified double value.- Overrides:
addin classCriterionSet<Objective>- Parameters:
objective- the objectivevalue- the value
-
add
Adds the objective with the specified integer value.- Overrides:
addin classCriterionSet<Objective>- Parameters:
objective- the objectivevalue- the value
-
add
Deprecated.renamed toaddAll(Objectives)Adds all objective with the specified value specified inObjectives.- Parameters:
objectives- the objectives
-
addAll
Adds all objective with the specified value specified inObjectives.- Parameters:
objectives- the objectives
-
weaklyDominates
Returnstrueif this objectives weakly dominates the specified objectives. This comparison depends on the chosenDominationStrategy.- Parameters:
opponent- other objectives- Returns:
trueif this objectives weakly dominate theopponent
-
dominates
Returnstrueif this objectives dominate the specified objectives. This comparison depends on the chosenDominationStrategy.- Parameters:
opponent- other objectives- Returns:
trueif these objectives dominate theopponent
-
isEqual
Returnstrueif this objectives are equal to the specified objectives. This comparison is based on thearray()values.- Parameters:
opponent- other objectives- Returns:
trueif these objectives dominate theopponent
-
distance
Calculates the euclidean distance of twoObjectives. This calculation is based on thearray()values.- Parameters:
other- the second objectives- Returns:
- the euclidean distance
-
toString
-
addAll(Objectives)