[Osi] OSI and GLPK

Ted Ralphs ted at lehigh.edu
Tue Sep 8 13:06:15 EDT 2009


I think FlopC++ is probably what you want. Take a look at

http://projects.coin-or.org/FlopC++/

FlopC++ works through Osi, so you can use any of the OSI solvers with
it. Honestly, you'll have a much easier time initially using one of
the solvers hosted in COIN. Is your model a linear program or an
integer program?

Cheers,

Ted

On Tue, Sep 8, 2009 at 12:07 PM, Renato Bruni<bruni at diei.unipg.it> wrote:
> Hello everybody,
>
> I need to migrate from Cplex (used by means of Concert Technology)
> to an open source solver. I'm therefore looking at the OSI project,
> and I would like to use it initially with GLPK solver.
>
> I downloaded the source code for version 0.100.0 and tried to compile it,
> I examined the documentation but many things are still not clear to me.
> I would need something like a small user manual (not the list of all
> classes) or an example of creating a small ILP model from a C++ code
> (not read from file).
>
> If possible, the model should be created dynamically, in some way similar to
> Cplex Concert Technology. This means that I create something like the
> container of the ILP model, then I create variables, objective function and
> constraints, not all in one time but one after another, step by step from
> different points of my C++ code, without the need of knowing from the
> beginning how many constraints the model will have and how many variables
> each constraint will have.
>
> Something like:
> create ILPmodel(M);        \\ create an ILP model called M
> M.addvariables(x[10]);     \\ put in M a vector x of 10 integer variables
> expr1 = ( x1 + 3 x4 );       \\ create an expression containing x1+3x4
> expr1 += (x2 + x5 + x6);  \\ add x2+x5+x6 to the expression, that is now
>                                        \\ x1+x2+3x4+x5+x6
> M.addobj_min(expr1);     \\ create in M the minimization obj function
>                                        \\ min (x1+x2+3x4+x5+x6)
> expr2 = (2 x2 - 3 x4);       \\ create another expression containing 2x2-3x4
> expr2 += (x1-x8 >= 10);  \\ the expression is now x1+2x2-3x4-x8>=10
> M.addconstraint(expr2);   \\ create in M constraint x1+2x2-3x4-x8>=10
> ...........                             \\ add other constraints
> M.solve(GLPK);              \\ solve the model using GLPK
> M.getsolution();                \\ reads the solution
>
> Thanks a lot for your help.
> Best regards,
> Renato Bruni
> ----------------------------------------
> Renato Bruni, Ph.D.
> Dep. of Computer and System Sciences
> University of Roma "Sapienza"
>
> _______________________________________________
> Osi mailing list
> Osi at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/osi
>

-- 
Dr. Ted Ralphs
Associate Professor, Lehigh University
(610) 628-1280
ted 'at' lehigh 'dot' edu
coral.ie.lehigh.edu/~ted





More information about the Osi mailing list