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

Java Examples addDifferent fails #1448

Closed
RobinKamps opened this issue Jul 24, 2019 · 4 comments
Closed

Java Examples addDifferent fails #1448

RobinKamps opened this issue Jul 24, 2019 · 4 comments
Assignees
Labels
Bug Lang: .NET .Net wrapper issue Solver: CP-SAT Solver Relates to the CP-SAT solver
Projects
Milestone

Comments

@RobinKamps
Copy link

RobinKamps commented Jul 24, 2019

Cannot get the
Constraint com.google.ortools.sat.CpModel.addDifferent(IntVar left, IntVar right)
to work.

https://github.com/google/or-tools/blob/554cbccaa95b4c11eced13f145de1bf468e1f919/ortools/sat/samples/SearchForAllSolutionsSampleSat.java

Under Win10Pro 64-bit
make run SOURCE=examples\java\SearchForAllSolutionsSampleSat.java
returns
0 solutions found.

If line 67 model.addDifferent(x, y); is commented out, the program prints out all 27 solutions in detail and 27 solution found.

If the constraint model.addDifferent(x, y); is replaced by a different constraint e.g. model.addGreaterOrEqual(x, 2); the program prints out all 9 feasable solutions in detail and 9 solutions found.

@lperron
Copy link
Collaborator

lperron commented Jul 24, 2019 via email

@RobinKamps
Copy link
Author

Latest from https://developers.google.com/optimization/install/java/windows

Google.OrTools.runtime.win-x64.7.2.6977

@lperron
Copy link
Collaborator

lperron commented Jul 25, 2019

Ok, another int/int64 miscast.
I fixed it in C#, I will track it down in java.

Thanks

@lperron lperron self-assigned this Jul 25, 2019
@lperron lperron added Bug Lang: .NET .Net wrapper issue Solver: CP-SAT Solver Relates to the CP-SAT solver labels Jul 25, 2019
@lperron lperron added this to To do in Kanban 7.3 via automation Jul 25, 2019
Kanban 7.3 automation moved this from To do to Done Jul 25, 2019
@lperron
Copy link
Collaborator

lperron commented Jul 25, 2019

Fixed on the master branch.

Thanks for the bug report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Lang: .NET .Net wrapper issue Solver: CP-SAT Solver Relates to the CP-SAT solver
Projects
No open projects
Kanban 7.3
  
Done
Development

No branches or pull requests

3 participants