I am still missing equality constraints. Sure, you can just add 2 inequalities, but since CoinPackedVector seems to support lower and upper bounds for each row, why not set them directly? Otherwise I'm quite satisfied, after playing around a bit.
On Jul 9, 6:36 pm, Nathann Cohen <nathann.co...@gmail.com> wrote: > Hello everybody !!! > > After a discussion from a few days ago where I asked for people > interested in a LP Solver in SAGE, I began to write what I could of > it. I have now what seems to be a "minimal" interface between SAGE and > Clp/Cbc( the Coin-or LP Solver and Branch and Bound solver, > respectively ). It uses CBC to solve Linear programs with or without > integer values, and it is now for me the easiest way to use a LP > solver, as I had to generate Cplex or MPS files before to use GLPK or > Cbc... > > There are probably a lot of errors, of mistakes, of necessary > modifications which would improve the code. I have never been writing > code for anyone else except myself, so there is bound to be a lot of > things to criticize. I would also like those of you who are interested > in a good implementation of a LP solver in SAGE to try this code, > because I will continue to implement the interface by addings features > to it and it would be better if I avoid now a big mistake I did not > see which would have to be corrected later ;-) > > You will find two TRAC tickets for this, the first being a SPKG for > CBC :http://trac.sagemath.org/sage_trac/ticket/6501 > > and the second the patch needed to use it > :http://trac.sagemath.org/sage_trac/ticket/6502 > > Once you will have the two installed, you can try to solve a simple > "maximal independant set problem" with those lines : > > g=graphs.RandomGNP(10,.5) > > p=MIP(max=True) > > obj={} > for i in g.vertices(): > obj["V"+str(i)]=1 > p.setinteger("V"+str(i)) > p.setobj(Constraint(obj,obj=True)) > for (a,b,c) in g.edges(): > obj={} > obj["V"+str(a)]=1 > obj["V"+str(b)]=1 > p.addconstraint(Constraint(obj,lt=1)) > p.solve() > > I hope those who already used LP solvers will find the notations > natural. > > Thank you !!! ;-) > > Nathann --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---