Reputation: 5
Optaplaner cannot solve different problems according to different constraint configurations in the same project. If it is the same solution, but the solution types are different, can the same constraint configuration be used? For example, different types of solutions are constrained by different pickingtypes in the code.Or have a better idea to realize
return constraintFactory.forEach(TrolleyStep.class)
.filter(ele -> ele.getPickingType() == 0) //only constraint pickingType == 0
.groupBy(trolleyStep -> trolleyStep.getOrderNumber(),
countDistinctLong(TrolleyStep::getTrolley))
.penalizeLong("Minimize order split by trolley",
HardSoftLongScore.ONE_SOFT, (order, trolleySpreadCount) -> trolleySpreadCount * 10000);
Upvotes: 0
Views: 126
Reputation: 5682
See penalizeConfigurable()
and constraint configuration in OptaPlanner documentation. That feature is there for what you seem to be trying to do.
Upvotes: 1