Package org.opt4j.core
Class Objectives
The
Objectives
contains the Objective
-Value
s 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
Modifier and TypeFieldDescriptionprotected Constraints
protected DominationStrategy
protected boolean
Fields inherited from class org.opt4j.core.CriterionSet
array
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the objective with the specified double value.void
Adds the objective with the specified integer value.void
Adds the objective with the specified value.void
add
(Objectives objectives) Deprecated.void
addAll
(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.double
distance
(Objectives other) Calculates the euclidean distance of twoObjectives
.boolean
dominates
(Objectives opponent) Returnstrue
if 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.boolean
isEqual
(Objectives opponent) Returnstrue
if this objectives are equal to the specified objectives.boolean
Returns the feasibility.iterator()
void
setConstraints
(Constraints constraints) Sets the constraints.void
setFeasible
(boolean feasible) Sets the feasibility.int
size()
Returns the number of setObjective
s.protected void
submit()
Calculates the array.toString()
boolean
weaklyDominates
(Objectives opponent) Returnstrue
if this objectives weakly dominates the specified objectives.Methods inherited from class org.opt4j.core.CriterionSet
add, distance, isEqual
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods 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 createObjectives
objects 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:
array
in 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 setObjective
s.- Overrides:
size
in classCriterionSet<Objective>
- Returns:
- the number of set objectives
-
getKeys
Returns all objectives.- Overrides:
getKeys
in classCriterionSet<Objective>
- Returns:
- all objectives
-
getValues
Returns all values.- Overrides:
getValues
in classCriterionSet<Objective>
- Returns:
- all values
-
get
Returns the value that is assigned to the given objective. Returnsnull
if the objective does not exist.- Overrides:
get
in classCriterionSet<Objective>
- Parameters:
objective
- the given objective- Returns:
- the value
-
get
Returns the objective that is assigned to the given value. Returnsnull
if the value does not exist.- Overrides:
get
in classCriterionSet<Objective>
- Parameters:
value
- the given value- Returns:
- the objective
-
add
Adds the objective with the specified value.- Overrides:
add
in classCriterionSet<Objective>
- Parameters:
objective
- the objectivevalue
- the value
-
add
Adds the objective with the specified double value.- Overrides:
add
in classCriterionSet<Objective>
- Parameters:
objective
- the objectivevalue
- the value
-
add
Adds the objective with the specified integer value.- Overrides:
add
in 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
Returnstrue
if this objectives weakly dominates the specified objectives. This comparison depends on the chosenDominationStrategy
.- Parameters:
opponent
- other objectives- Returns:
true
if this objectives weakly dominate theopponent
-
dominates
Returnstrue
if this objectives dominate the specified objectives. This comparison depends on the chosenDominationStrategy
.- Parameters:
opponent
- other objectives- Returns:
true
if these objectives dominate theopponent
-
isEqual
Returnstrue
if this objectives are equal to the specified objectives. This comparison is based on thearray()
values.- Parameters:
opponent
- other objectives- Returns:
true
if 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)