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:
-
Field Summary
Modifier and TypeFieldDescriptionprotected Map<Constraint,
Range> stores the current range of criterion values in the population for each constraint i.e. -
Constructor Summary
ConstructorDescriptionConstraintCheckerImpl
(Population population) as this class listens on Population, it must be registered there -
Method Summary
Modifier and TypeMethodDescriptiondouble
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
Checks, ifObjectives
is feasible.protected boolean
isIneligibleConstraint
(Constraint constraint)
-
Field Details
-
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 Details
-
ConstraintCheckerImpl
as this class listens on Population, it must be registered there
-
-
Method Details
-
isEligibleConstraint
-
isIneligibleConstraint
-
getConstraintViolation
Calculates the constraint violation ofObjectives
.- Specified by:
getConstraintViolation
in interfaceConstraintChecker
- Parameters:
o
- the objectives to check- Returns:
- the amount of constraint violation
-
isFeasible
Checks, ifObjectives
is feasible.- Specified by:
isFeasible
in interfaceConstraintChecker
- Parameters:
o
- the objectives to check- Returns:
- the feasibility
-
individualAdded
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
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
Description copied from interface:IndividualStateListener
Invoked if theIndividual
changes its state.- Specified by:
inidividualStateChanged
in interfaceIndividualStateListener
- Parameters:
individual
- the individual that changes the state
-