Return all optimal Sulutions

288 views
Skip to first unread message

Thomas B

unread,
Sep 14, 2022, 8:25:15 AM9/14/22
to or-tools-discuss
Hello,

I am using the pywraplp.Solver.CreateSolver('SCIP') to solve a NFM.

I would like to return all optimal sulutions.

Somehow, I only get one optimal solution. All the other solutions have a higher objective value.

status = self.m.Solve()

if status == pywraplp.Solver.OPTIMAL:
    print('Solution: 1')
    print('Objective value =', self.m.Objective().Value())
    
    for i in range(2,11):
        print("Solution: ", i)
        status_next = self.m.NextSolution()
        print(status_next)
        if status_next == pywraplp.Solver.OPTIMAL:
               print('Objective value =', self.m.Objective().Value())



Laurent Perron

unread,
Sep 14, 2022, 8:34:53 AM9/14/22
to or-tools-discuss
impossible in python. 
Limited in C++.

Does your model contain continuous variables ? If not, you can use the CP-SAT API (not the linear solver).
Laurent Perron | Operations Research | lpe...@google.com | (33) 1 42 68 53 00



--
You received this message because you are subscribed to the Google Groups "or-tools-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to or-tools-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/or-tools-discuss/5b5ce8eb-5fc6-4e89-8d3d-1d13978405f0n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages