#11607: read constraints from linear program
----------------------------------+-----------------------------------------
   Reporter:  john_perry          |          Owner:  ncohen      
       Type:  enhancement         |         Status:  needs_review
   Priority:  major               |      Milestone:  sage-4.7.2  
  Component:  linear programming  |       Keywords:              
Work_issues:                      |       Upstream:  N/A         
   Reviewer:                      |         Author:  john_perry  
     Merged:                      |   Dependencies:              
----------------------------------+-----------------------------------------
Changes (by newvalueoldvalue):

  * status:  new => needs_review
  * author:  => john_perry


Old description:

> Sometimes a user might want to read & inspect the constraints in a linear
> program. For example, some code of mine generates a '''lot''' of linear
> programs (I described the project to Nathann once), and it would be nice
> if I could read the constraints off one program so as to combine it with
> another. Example usage would be:
> {{{
> sage: lp = MixedIntegerLinearProgram()
> sage: lp.add_constraint(lp[0]-lp[1],min=1)
> sage: lp.add_constraint(2*lp[1]-lp[0]-lp[2],max=1)
> sage: lp.get_constraints()
> [(1,x_0-x_1),(2*x_1-x_0-x_2,1)]
> }}}

New description:

 Sometimes a user might want to read & inspect the constraints in a linear
 program. For example, some code of mine generates a '''lot''' of linear
 programs (I described the project to Nathann once), and it would be nice
 if I could read the constraints off one program so as to combine it with
 another. Example usage would be:
 {{{
 sage: lp = MixedIntegerLinearProgram()
 sage: lp.add_constraint(lp[0]-lp[1],min=1)
 sage: lp.add_constraint(2*lp[1]-lp[0]-lp[2],max=1)
 sage: lp.get_constraints()
 [(1.0, ([1, 0],[-1.0, 1.0]), None),(None, ([2, 1, 0], [-1.0, 2.0, -1.0]),
 1.0)]
 }}}

--

Comment:

 I've attached a patch that gives something resembling the desired
 functionality, as well as a couple of related, useful methods. I also
 changed the description, to mirror the desired result. (I do not really
 want to create a new symbolic expression describing a constraint at the
 Cython level.)

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11607#comment:1>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to