-
Notifications
You must be signed in to change notification settings - Fork 153
Description
The following test fails:
@Test(groups = "1s", timeOut = 60000)
public void testScalarAndTaskBug1() {
int[] coeffs = new int[]{3, -2,-1,-2};
IntVar[] vars = new IntVar[4];
vars[0] = model.intVar(8, 9);
vars[1] = model.intVar(2, 4);
vars[2] = model.intVar(new int[]{1,2,4,5,6});
vars[3] = model.intVar(3, 5);
model.scalar(vars, coeffs, "<=", 1).post();
IntVar ee = model.intVar(4, 9);
new Task(vars[3], vars[2], ee);
model.getSolver().solve();
Assert.assertEquals(model.getSolver().getSolutionCount(), 0);
}When the scalar constraint filters, it first reduces vars[0] to 8, then vars[1]=4 and vars[2]={5,6}.
At this point the task automatically reduces the domain of vars[3] to {3,4}.
Then the scalar constraint keeps on filtering and fix vars[3]to4and passivates itself. But, withvars[3]=4there is no solution anymore to this model andscalar` is not able to detect it because it does not react on modification during its filtering step.
The combination of task filtering and passivate leds to inconsistency.
So IMO, the way tasks (or more generally monitors) reduce domains is buggy, because we cannot consider that constraints should be aware of reductions made by monitors during their filtering step.
I'm afraid other constraints will produce the same bug...