#12533: arbitrary precision LP solver backend
----------------------------------+-----------------------------------------
   Reporter:  dimpase             |          Owner:  ncohen                 
       Type:  enhancement         |         Status:  needs_review           
   Priority:  major               |      Milestone:  sage-5.0               
  Component:  linear programming  |       Keywords:  arbitrary precision, LP
Work_issues:                      |       Upstream:  N/A                    
   Reviewer:  David Coudert       |         Author:                         
     Merged:                      |   Dependencies:                         
----------------------------------+-----------------------------------------
Changes (by ptrrsn_1):

  * status:  needs_work => needs_review


Comment:

 Replying to [comment:15 dcoudert]:
 > Hello,
 >
 > I can install the patch on sage-5.0.beta8 and all long tests are OK (all
 involved files).
 > The documentation is build correctly and displayed properly.
 >
 > However, I did some test based on the example of the `optimizing_point`
 function and got a segfault...
 > {{{
 > sage: from sage.libs.ppl import Variable, Constraint_System, MIP_Problem
 > sage: x = Variable(0)
 > sage: y = Variable(1)
 > sage: m = MIP_Problem()
 > sage: m.add_space_dimensions_and_embed(2)
 > sage: m.add_constraint(x >= 0)
 > sage: m.add_constraint(y >= 0)
 > sage: m.add_constraint(3 * x + 5 * y <= 10)
 > sage: m.set_objective_function(x + y)
 > sage: m.optimizing_point()
 > [10/3, 0]
 > sage: z = Variable(2)
 > sage: m.add_constraint(z >= -3)
 > terminate called after throwing an instance of 'std::invalid_argument'
 >   what():  PPL::MIP_Problem::add_constraint(c):
 > c.space_dimension() == 3 exceeds this->space_dimension == 2.
 > ...
 > /path-to-sage/sage-5.0.beta8/spkg/bin/sage: line 308: 29045 Aborted
 (core dumped) sage-ipython "$@" -i
 > }}}
 >
 > Some tests should be added somewhere.

 Hi, thanks for your feedback!

 It is actually not a bug. The statement
 "m.add_space_dimensions_and_embed(2)" increases the space dimension of the
 MIP_Problem from 0 (default) to 2. However, z is a variable in the third
 dimension (the number 2 in "z = Variable(2)" means the dimension of this
 variable is 2, which means it is in the third dimension since the
 numbering starts from zero). Since the dimension of the variable exceeds
 the space dimension of the MIP_Problem, it gives error.

 An extra line should be added to make it works:
 sage: z = Variable(2)
 sage: m.add_space_dimensions_and_embed(1)
 sage: m.add_constraint(z >= -3)

 > This will be a great patch!

 Thank you!

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12533#comment:16>
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