Interface ConstraintWeightSupplier<Solution_,Score_ extends Score<Score_>>
- All Known Implementing Classes:
ConstraintConfigurationBasedConstraintWeightSupplier,OverridesBasedConstraintWeightSupplier
public sealed interface ConstraintWeightSupplier<Solution_,Score_ extends Score<Score_>>
permits OverridesBasedConstraintWeightSupplier<Score_,Solution_>, ConstraintConfigurationBasedConstraintWeightSupplier<Score_,Solution_>
-
Method Summary
Modifier and TypeMethodDescriptiongetConstraintWeight(ConstraintRef constraintRef, Solution_ workingSolution) Get the weight for the constraint if known to the supplier.Class<?>The class that carries the constraint weights.voidinitialize(SolutionDescriptor<Solution_> solutionDescriptor, MemberAccessorFactory memberAccessorFactory, DomainAccessType domainAccessType) voidvalidate(Solution_ workingSolution, Set<ConstraintRef> userDefinedConstraints) Will be called afterinitialize(SolutionDescriptor, MemberAccessorFactory, DomainAccessType).
-
Method Details
-
initialize
void initialize(SolutionDescriptor<Solution_> solutionDescriptor, MemberAccessorFactory memberAccessorFactory, DomainAccessType domainAccessType) -
validate
Will be called afterinitialize(SolutionDescriptor, MemberAccessorFactory, DomainAccessType). Has the option of failing fast in case of discrepancies between the constraints defined inConstraintProviderand the constraints defined in the configuration.- Parameters:
userDefinedConstraints- never null
-
getProblemFactClass
Class<?> getProblemFactClass()The class that carries the constraint weights. It will either be annotated byConstraintConfiguration, or beConstraintWeightOverrides.- Returns:
- never null
-
getDefaultConstraintPackage
String getDefaultConstraintPackage() -
getConstraintWeight
Get the weight for the constraint if known to the supplier. Supplies may choose not to provide a value for unknown constraints, which is the case forOverridesBasedConstraintWeightSupplier.ConstraintConfigurationBasedConstraintWeightSupplierwill always provide a value.- Parameters:
constraintRef- never nullworkingSolution- never null- Returns:
- may be null, if the provider does not know the constraint
-