[Cbc] adding to a system after solving

Ted Ralphs ted at lehigh.edu
Wed Jan 25 13:33:46 EST 2012


Hi John,

The answer to your question is not very straightforward because of some
inconsistency with how integer programs are handled by different Osi
interfaces. From your description, I guess you are primarily focusing on
OsiCbc, whose implementation has a few "quirks." Someday, I hope to fix
these, although a new version of Osi that would obviate the need for this
is "under development." In the meantime, I guess the short answer to your
question is that yes, with Cbc, I believe you are correct, but this is not
true for most other solvers. As far as I can recall, all other solvers
support modification of the problem using the standard Osi problem
modification methods. If you are after open source solvers, then this
includes Glpk and SYMPHONY.

The question of what happens when you modify the problem and then call the
branchAndBound() method again on the modified problem is another question.
As far as I know, all solvers except SYMPHONY will simply resolve the new
problem from scratch in this case, as warm starting methods for IP solvers
are not very well developed. SYMPHONY does have a warm starting methodology
that will attempt to solve the modified problem from a warm start in some
cases, though your mileage will vary on whether this buys you anything.

I hope this clarifies some things. I'll be happy to work with you off-line,
as it would be nice to have COIN working through Sage. By the way, I
understand that Sage is built on Python, right? Have you take a look at
PuLP and Pyomo, which are both extensions to Python that provide the
ability to construct models and call COIN solvers. I guess it should be
possible to embed this in Sage, though you wouldn't be able to pass Sage
data structures directly into PuLP or Pyomo I suppose. I don't know much
about Sage, but it's something to consider.

Cheers,

Ted

On Wed, Jan 11, 2012 at 5:28 PM, John Perry <John.Perry at usm.edu> wrote:

> Hi
>
> Thanks to everyone who replied to my earlier messages. I have a followup
> question that should hopefully finish things for me.
>
> In the context* I'm working on, I have to do the following:
>
> (1) set up a system of linear inequalities;
> (2) if not "done" (whatever "done" might mean),
>    (2a) solve the system; and
>    (2b) add linear inequalities to the system, perhaps after copying it;
>    (2c) retrieve solutions to evaluate "done".
>
> At first I tried the following approach:
> (1) create si, an OsiSolverInterface;
> (2) create a model m with si;
> (3) if not "done",
>    (3a) add linear inequalities to si, perhaps after copying it;
>    (3b) solve by calling m's branchAndBound();
>    (3c) retrieve solutions from si to evaluate "done".
>
> This was problematic, for all kinds of reasons. By reading the examples
> carefully, I discovered that I had to retrieve the solutions from m, not
> from si. In addition, I can't add new inequalities to m's solver after it
> solves.
>
> So it seems that what I have to do is this:
> (1) create si, an OsiSolverInterfaace;
> (2) if not "done",
>    (2a) add linear inequalities to si, perhaps after copying it;
>    (2b) create a model m with si;
>    (2c) solve by calling m's branchAndBound();
>    (2d) retrieve solutions from si to evaluate "done".
>
> In short, a new model must be created whenever we want to add inequalities
> to a system.
>
> Is this correct, or am I missing something?
>
> Thanks in advance!
> john perry
>
> * The context is an interface between Coin and the Sage computer algebra
> system. This is  why the scenario depicted might look a little strange: it
> replicates how a Sage user might try to play around with a linear system.
> (Me, for example, but other people, too.)
> _______________________________________________
> Cbc mailing list
> Cbc at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/cbc
>



-- 
Dr. Ted Ralphs
Associate Professor, Lehigh University
(610) 628-1280
ted 'at' lehigh 'dot' edu
coral.ie.lehigh.edu/~ted
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/cbc/attachments/20120125/af6fca21/attachment.html>


More information about the Cbc mailing list