Package org.opt4j.core.domination
Class ConstraintCheckerImpl
- java.lang.Object
-
- org.opt4j.core.domination.ConstraintCheckerImpl
-
- All Implemented Interfaces:
ConstraintChecker
,IndividualSetListener
,IndividualStateListener
public class ConstraintCheckerImpl extends Object implements ConstraintChecker, IndividualSetListener, IndividualStateListener
ConstraintCheckerImpl
calculates constraint violations of infeasibility constraints.- See Also:
ConstraintChecker
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<Constraint,Range>
constraintRanges
stores the current range of criterion values in the population for each constraint i.e.
-
Constructor Summary
Constructors Constructor Description ConstraintCheckerImpl(Population population)
as this class listens on Population, it must be registered there
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
getConstraintViolation(Objectives o)
Calculates the constraint violation ofObjectives
.void
individualAdded(IndividualSet collection, Individual individual)
Invoked if theIndividual
is added to theIndividualSet
.void
individualRemoved(IndividualSet collection, Individual individual)
Invoked if theIndividual
is removed from theIndividualSet
.void
inidividualStateChanged(Individual individual)
Invoked if theIndividual
changes its state.protected boolean
isEligibleConstraint(Constraint constraint)
boolean
isFeasible(Objectives o)
Checks, ifObjectives
is feasible.protected boolean
isIneligibleConstraint(Constraint constraint)
-
-
-
Field Detail
-
constraintRanges
protected Map<Constraint,Range> constraintRanges
stores the current range of criterion values in the population for each constraint i.e. stores the minimum value in the population for each Constraint and the maimum value. make it thread safe to avoid accidental problems.
-
-
Constructor Detail
-
ConstraintCheckerImpl
@Inject public ConstraintCheckerImpl(Population population)
as this class listens on Population, it must be registered there
-
-
Method Detail
-
isEligibleConstraint
protected boolean isEligibleConstraint(Constraint constraint)
-
isIneligibleConstraint
protected boolean isIneligibleConstraint(Constraint constraint)
-
getConstraintViolation
public double getConstraintViolation(Objectives o)
Calculates the constraint violation ofObjectives
.- Specified by:
getConstraintViolation
in interfaceConstraintChecker
- Parameters:
o
- the objectives to check- Returns:
- the amount of constraint violation
-
isFeasible
public boolean isFeasible(Objectives o)
Checks, ifObjectives
is feasible.- Specified by:
isFeasible
in interfaceConstraintChecker
- Parameters:
o
- the objectives to check- Returns:
- the feasibility
-
individualAdded
public void individualAdded(IndividualSet collection, Individual individual)
Description copied from interface:IndividualSetListener
Invoked if theIndividual
is added to theIndividualSet
.- Specified by:
individualAdded
in interfaceIndividualSetListener
- Parameters:
collection
- the observed collectionindividual
- the added individual
-
individualRemoved
public void individualRemoved(IndividualSet collection, Individual individual)
Description copied from interface:IndividualSetListener
Invoked if theIndividual
is removed from theIndividualSet
.- Specified by:
individualRemoved
in interfaceIndividualSetListener
- Parameters:
collection
- the observed collectionindividual
- the removed individual
-
inidividualStateChanged
public void inidividualStateChanged(Individual individual)
Description copied from interface:IndividualStateListener
Invoked if theIndividual
changes its state.- Specified by:
inidividualStateChanged
in interfaceIndividualStateListener
- Parameters:
individual
- the individual that changes the state
-
-