Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Unexpected behaviour when using neg() intvar in arithm #1115

Open
ArthurGodet opened this issue Nov 17, 2024 · 0 comments
Open

[BUG] Unexpected behaviour when using neg() intvar in arithm #1115

ArthurGodet opened this issue Nov 17, 2024 · 0 comments
Labels

Comments

@ArthurGodet
Copy link
Collaborator

The following test fails :

@Test(groups = "1s", timeOut = 60000)
public void testWithViews() {
    Model model = new Model();
    IntVar start = model.intVar("start", 0, 57);
    IntVar duration = model.intVar("duration", 6, 6);
    IntVar end = start.getModel().offset(start, duration.getValue());
    model.arithm(start, "+", duration, "=", end).post();
    model.arithm(end.neg().intVar(), "+", duration, "=", start.neg().intVar()).post();
    model.getSolver().findAllSolutions();
    Assert.assertTrue(model.getSolver().getSolutionCount() > 0);
}

It fails because of the model.arithm(end.neg().intVar(), "+", duration, "=", start.neg().intVar()).post(); constraint, but it is exactly the same as model.arithm(start, "+", duration, "=", end).post();. Therefore, it should not fail.

My guess is that the faulty behaviour is coming from lines 123-124 in IntLinCombFactory : RESULT should be updated before NCOEFFS[i]

ArthurGodet added a commit that referenced this issue Nov 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant