Closed braingineer closed 8 years ago
Can you please send us a full example? I do not observe the same behavior.
And (Barry, please correct me if I'm wrong) the first method should be something like: for _ in solver.solutions():
On Thu, Dec 17, 2015 at 8:51 PM, Brian McMahan notifications@github.com wrote:
Hello!
I am trying to use Numberjack to solve a CSP problem.
I have the model built and I am trying two different ways of solving (as illustrated in your examples). All of my variables are binary.
Method1: solver = model.load("Mistral") solver.solve() while solver.solutions():
reference variables to get solutions
solutions = [val for sym,val in sym_dict.items() if sym.get_value()!=0]
Method2 solver = model.load("Mistral") solver.startNewSearch() while solver.getNextSolution() == Numberjack.SAT:
reference variables to get solutions
solutions = [val for sym,val in sym_dict.items() if sym.get_value()!=0]
The second method will terminate immediately for me. The first method works. Why is this?
All the best, Brian
— Reply to this email directly or view it on GitHub https://github.com/eomahony/Numberjack/issues/29.
-Emmanuel
Hi!
Thanks for the response.
You are correct on the for loop. Not fully sure what I was thinking there.
I'm trying to recreate with what I thought was the reason the issue was happening, but other small bugs are now presenting themselves. I'll ping back either when I have a minimum working example or determine that I've made a mistake in this question =)
Best, Brian
Hi, I think that this was my mistake in how I formulated the code. Things are working now as expected (modulo a loophole in the constraints I've set up). Thanks again.
Hello!
I am trying to use Numberjack to solve a CSP problem.
I have the model built and I am trying two different ways of solving (as illustrated in your examples). All of my variables are binary.
Method1: solver = model.load("Mistral") solver.solve() while solver.solutions():
reference variables to get solutions
Method2 solver = model.load("Mistral") solver.startNewSearch() while solver.getNextSolution() == Numberjack.SAT:
reference variables to get solutions
The second method will terminate immediately for me. The first method works. Why is this?
All the best, Brian