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
ConstraintCheckerImplcalculates constraint violations of infeasibility constraints.- See Also:
ConstraintChecker
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<Constraint,Range>constraintRangesstores 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 doublegetConstraintViolation(Objectives o)Calculates the constraint violation ofObjectives.voidindividualAdded(IndividualSet collection, Individual individual)Invoked if theIndividualis added to theIndividualSet.voidindividualRemoved(IndividualSet collection, Individual individual)Invoked if theIndividualis removed from theIndividualSet.voidinidividualStateChanged(Individual individual)Invoked if theIndividualchanges its state.protected booleanisEligibleConstraint(Constraint constraint)booleanisFeasible(Objectives o)Checks, ifObjectivesis feasible.protected booleanisIneligibleConstraint(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:
getConstraintViolationin interfaceConstraintChecker- Parameters:
o- the objectives to check- Returns:
- the amount of constraint violation
-
isFeasible
public boolean isFeasible(Objectives o)
Checks, ifObjectivesis feasible.- Specified by:
isFeasiblein interfaceConstraintChecker- Parameters:
o- the objectives to check- Returns:
- the feasibility
-
individualAdded
public void individualAdded(IndividualSet collection, Individual individual)
Description copied from interface:IndividualSetListenerInvoked if theIndividualis added to theIndividualSet.- Specified by:
individualAddedin interfaceIndividualSetListener- Parameters:
collection- the observed collectionindividual- the added individual
-
individualRemoved
public void individualRemoved(IndividualSet collection, Individual individual)
Description copied from interface:IndividualSetListenerInvoked if theIndividualis removed from theIndividualSet.- Specified by:
individualRemovedin interfaceIndividualSetListener- Parameters:
collection- the observed collectionindividual- the removed individual
-
inidividualStateChanged
public void inidividualStateChanged(Individual individual)
Description copied from interface:IndividualStateListenerInvoked if theIndividualchanges its state.- Specified by:
inidividualStateChangedin interfaceIndividualStateListener- Parameters:
individual- the individual that changes the state
-
-