Interface UniConstraintBuilder<A,Score_ extends Score<Score_>>
- All Superinterfaces:
ConstraintBuilder
- All Known Implementing Classes:
UniConstraintBuilderImpl
Used to build a
Constraint out of a UniConstraintStream, applying optional configuration.
To build the constraint, use one of the terminal operations, such as ConstraintBuilder.asConstraint(String).
Unless justifyWith(BiFunction) is called, the default justification mapping will be used.
The function takes the input arguments and converts them into a List.
Unless indictWith(Function) is called, the default indicted objects' mapping will be used.
The function takes the input arguments and converts them into a List.
-
Method Summary
Modifier and TypeMethodDescription@NonNull UniConstraintBuilder<A,Score_> indictWith(@NonNull Function<A, Collection<Object>> indictedObjectsMapping) Sets a custom function to mark any object returned by it as responsible for causing the constraint to match.<ConstraintJustification_ extends ConstraintJustification>
@NonNull UniConstraintBuilder<A,Score_> justifyWith(@NonNull BiFunction<A, Score_, ConstraintJustification_> justificationMapping) Sets a custom function to apply on a constraint match to justify it.Methods inherited from interface ai.timefold.solver.core.api.score.stream.ConstraintBuilder
asConstraint, asConstraint, asConstraintDescribed, asConstraintDescribed
-
Method Details
-
justifyWith
<ConstraintJustification_ extends ConstraintJustification> @NonNull UniConstraintBuilder<A,Score_> justifyWith(@NonNull BiFunction<A, Score_, ConstraintJustification_> justificationMapping) Sets a custom function to apply on a constraint match to justify it. That function must not return aCollection, elseIllegalStateExceptionwill be thrown during score calculation.- Returns:
- this
- See Also:
-
indictWith
@NonNull UniConstraintBuilder<A,Score_> indictWith(@NonNull Function<A, Collection<Object>> indictedObjectsMapping) Sets a custom function to mark any object returned by it as responsible for causing the constraint to match. Each object in the collection returned by this function will become anIndictmentand be available as a key inScoreExplanation.getIndictmentMap().- Returns:
- this
-