-
Feature Request
-
Resolution: Unresolved
-
Major
-
None
-
None
-
None
-
NEW
-
NEW
At the moment, constraint streams require us to duplicate constraints in some cases:
constraint.filter(task -> task.getPriority() == Priority.MAJOR) .penalize("Major priority task end time", BendableScore.ofSoft(0, 2, 0, 1), Task::getEndTime); } constraint.filter(task -> task.getPriority() == Priority.MINOR) .penalize("Minor priority task end time", BendableScore.ofSoft(0, 2, 1, 1), Task::getEndTime); }
Notice that the constraints are identical, except for the constraint weight (BendableScore), which depends on a property of the entity. This could be simplified and also made more performant, if we indeed replaced this by one constraint like this:
constraint.penalize("Task end time", task -> { if (task.getPriority() == Priority.MAJOR) { return BendableScore.ofSoft(0, 2, 0, 1); } else { return BendableScore.ofSoft(0, 2, 1, 1); } }, Task::getEndTime); }
This example is adapted from OptaPlanner's TaskAssigning example, which would need updating when this feature is implemented.
- is related to
-
PLANNER-2257 ConstraintStreams: penalize/reward matches pick the Score level themselves
- Closed
- relates to
-
PLANNER-2307 DynamicConstraintConfiguration (less boilerplate, application.properties support)
- Open