[Osi] Several integers solutions

Goossens Jan-Willem Jan-Willem.Goossens at nc3a.nato.int
Fri Jul 31 08:25:45 EDT 2009


Hi,

I'm not 100% sure, but I think the "MaximumSolutions" is meant to do something else. It's a limit on the search tree, like MaximumNodes.

What you can do to get multiple solutions is add constraints that cut off all previous solutions.
The particular kind of constraint that you need to add to cut off a solution depends on your problem.

Let's use what you describe. Say in the first solve you find the solution x0, with S = {i | x0_i = 1}. Then you could add a constraint  (again, depending on your problem)

Sum_{i  in S}  x_i  <= |S| - 1

And solve this new problem from scratch. You can continue this, adding another constraint each time, as long as you want.
For example, you can continue this until the objective value is too far from the original obj val, or something.

Regards,

Jan-Willem




From: osi-bounces at list.coin-or.org [mailto:osi-bounces at list.coin-or.org] On Behalf Of Nathann Cohen
Sent: 31 July 2009 11:02
To: osi at list.coin-or.org
Subject: [Osi] Several integers solutions

Hello everybody !

I have been solving continuous and integer programs with Cbc for some time now and it works absolutely fine !
Now, I would like to add some spices to what I am doing with it, by trying to compute several integers solutions to linear programs.

For example, I would like the following program ( with x and y binary variables ) :

Max:
   x + y
Constraints :
  x + y <= 1

to return the two solutions : x = 0, y=1 and x=1,y=0.

I saw there were functions in OsiClpInterface like setMaximumSolution and getMaximumSolutions. I also found the function getSolutionCount in CbcModel but it does not seem to do what I want it to do ;-)
I set the Maximum Number of Solutions to 200 and checked with  getMaximumSolutions there was no problem assigning the value, but when I solve the previous problem getSolutionCount always return 1. Would you know how to make it work properly  ? Would you have an example where several solutions are found, which I could read to see both how it is done, and how to iterate through all the solutions found after ? It it possible to set the infinity as the MaximumNumber of solution if I want all of them ( I know this can grow quite huge ! )

Thank you very much for your help !

Nathann Cohen

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/osi/attachments/20090731/770f9ce4/attachment.html>


More information about the Osi mailing list