In the last release the following code returned FEASIBLE which makes sense as it does not try to find an optimum. Now it returns OPTIMAL, is this the way it should be or a bug?
Current versions:
ortools==7.1.6720
protobuf==3.7.1
def test_two_bools_same():
model = cp_model.CpModel()
solver = cp_model.CpSolver()
a = model.NewBoolVar("a")
x = model.NewBoolVar("x")
# Specify: a == x
model.Add(a == x)
collector = SolutionCollector([a, x])
result = solver.SearchForAllSolutions(model, collector)
assert result == cp_model.FEASIBLE
assert collector.SolutionCount() == 2
assert sorted(collector.Solutions()) == [
(False, False),
(True, True),
]
It was changed before that commit 3f0a13ca47bfc6d41e0ddf5c234d4fb0de9a2a49 (don't know the exact commit)
Thank you for support :+1:
It is the new way to indicate we have finished search, instead of look at a
flag in the solution.
I have missed it in the release notes.
Thanks for the report.
Laurent Perron | Operations Research | [email protected] | (33) 1 42 68 53
00
*De : *Phibedy notifications@github.com
*Date : *ven. 10 mai 2019 à 11:37
*À : *google/or-tools
*Cc : *Subscribed
In the last release the following code returned FEASIBLE which makes sense
as it does not try to find an optimum. Now it returns OPTIMAL, is this the
way it should be or a bug?
Current versions:ortools==7.1.6720
protobuf==3.7.1
def test_two_bools_same():
model = cp_model.CpModel() solver = cp_model.CpSolver() a = model.NewBoolVar("a") x = model.NewBoolVar("x") # Specify: a == x model.Add(a == x) collector = SolutionCollector([a, x]) result = solver.SearchForAllSolutions(model, collector) assert result == cp_model.FEASIBLE assert collector.SolutionCount() == 2 assert sorted(collector.Solutions()) == [ (False, False), (True, True), ]It was changed before that commit 3f0a13c
https://github.com/google/or-tools/commit/3f0a13ca47bfc6d41e0ddf5c234d4fb0de9a2a49Thank you for support 👍
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/google/or-tools/issues/1263, or mute the thread
https://github.com/notifications/unsubscribe-auth/ACUPL3KT66PFJA3QHVXTZNTPUU635ANCNFSM4HMBO4UA
.
Ah ok it says optimal because it found all solutions. If I just call solver.Solve() it still returns feasible.
That makes somehow sense because then you know if the result is optimal everything is fine.
Maybe adding that note here would help others if they wonder: https://github.com/google/or-tools/blob/master/ortools/sat/python/cp_model.py#L1425
Thank you again :+1:
yes, done internally. It will soon be pushed to master.
Laurent Perron | Operations Research | [email protected] | (33) 1 42 68 53
00
*De : *Phibedy notifications@github.com
*Date : *ven. 10 mai 2019 à 13:42
*À : *google/or-tools
*Cc : *Laurent Perron, Assign
Ah ok it says optimal because it found all solutions. If I just call
solver.Solve() it still returns feasible.
That makes somehow sense because then you know if the result is optimal
everything is fine.
Maybe adding that note here would help others if they wonder:
https://github.com/google/or-tools/blob/master/ortools/sat/python/cp_model.py#L1425Thank you again 👍
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
https://github.com/google/or-tools/issues/1263#issuecomment-491259570,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACUPL3MDRCTSPVYLPD3FBGDPUVNTBANCNFSM4HMBO4UA
.
Most helpful comment
yes, done internally. It will soon be pushed to master.
Laurent Perron | Operations Research | [email protected] | (33) 1 42 68 53
00
*De : *Phibedy notifications@github.com
*Date : *ven. 10 mai 2019 à 13:42
*À : *google/or-tools
*Cc : *Laurent Perron, Assign
Ah ok it says optimal because it found all solutions. If I just call