I working on a new Planning problem and are using Cheap Time for testing. I want to add a filter to handle a Hard Score constraint. In some cases, a machine cannot be assigned - at all.
I added this filter SwapMove filter:
public class TaskAssignmentFilter implements SelectionFilter<SwapMove> {
public boolean accept(ScoreDirector scoreDirector, SwapMove move) {
TaskAssignment task1 = (TaskAssignment)move.getLeftEntity();
TaskAssignment task2 = (TaskAssignment)move.getRightEntity();
if (task1.getMachine().getIndex() == 0 || task2.getMachine().getIndex() == 0)
return false;
return true;
}
}
And added to the config
<swapMoveSelector>
<filterClass>….TaskAssignmentFilter</filterClass>
</swapMoveSelector>
However, machine index 0 is still assigned.
Any hint to what I am doing wrong?
And is it possible to handle that constraint this in the Score Calculator also?