Class OverridesBasedConstraintWeightSupplier<Score_ extends Score<Score_>,Solution_>
java.lang.Object
ai.timefold.solver.core.impl.domain.solution.OverridesBasedConstraintWeightSupplier<Score_,Solution_>
- All Implemented Interfaces:
ConstraintWeightSupplier<Solution_,Score_>
public final class OverridesBasedConstraintWeightSupplier<Score_ extends Score<Score_>,Solution_>
extends Object
implements ConstraintWeightSupplier<Solution_,Score_>
-
Method Summary
Modifier and TypeMethodDescriptionstatic <Solution_,Score_ extends Score<Score_>>
ConstraintWeightSupplier<Solution_,Score_> create(SolutionDescriptor<Solution_> solutionDescriptor, DescriptorPolicy descriptorPolicy, Field field) getConstraintWeight(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) toString()voidvalidate(Solution_ workingSolution, Set<ConstraintRef> userDefinedConstraints)
-
Method Details
-
create
public static <Solution_,Score_ extends Score<Score_>> ConstraintWeightSupplier<Solution_,Score_> create(SolutionDescriptor<Solution_> solutionDescriptor, DescriptorPolicy descriptorPolicy, Field field) -
initialize
public void initialize(SolutionDescriptor<Solution_> solutionDescriptor, MemberAccessorFactory memberAccessorFactory, DomainAccessType domainAccessType) - Specified by:
initializein interfaceConstraintWeightSupplier<Score_ extends Score<Score_>,Solution_>
-
validate
Description copied from interface:ConstraintWeightSupplierWill be called afterConstraintWeightSupplier.initialize(SolutionDescriptor, MemberAccessorFactory, DomainAccessType). Has the option of failing fast in case of discrepancies between the constraints defined inConstraintProviderand the constraints defined in the configuration. -
getProblemFactClass
Description copied from interface:ConstraintWeightSupplierThe class that carries the constraint weights. It will either be annotated byConstraintConfiguration, or beConstraintWeightOverrides.- Specified by:
getProblemFactClassin interfaceConstraintWeightSupplier<Score_ extends Score<Score_>,Solution_> - Returns:
- never null
-
getDefaultConstraintPackage
- Specified by:
getDefaultConstraintPackagein interfaceConstraintWeightSupplier<Score_ extends Score<Score_>,Solution_>
-
getConstraintWeight
Description copied from interface:ConstraintWeightSupplierGet 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.- Specified by:
getConstraintWeightin interfaceConstraintWeightSupplier<Score_ extends Score<Score_>,Solution_> - Parameters:
constraintRef- never nullworkingSolution- never null- Returns:
- may be null, if the provider does not know the constraint
-
toString
-