#12533: arbitrary precision LP solver backend
-------------------------------------------+--------------------------------
       Reporter:  dimpase                  |         Owner:  ncohen             
         
           Type:  enhancement              |        Status:  needs_work         
         
       Priority:  major                    |     Milestone:  sage-5.1           
         
      Component:  linear programming       |    Resolution:                     
         
       Keywords:  arbitrary precision, LP  |   Work issues:  see the latest 
comments     
Report Upstream:  N/A                      |     Reviewers:  David Coudert, 
Nathann Cohen
        Authors:                           |     Merged in:                     
         
   Dependencies:  12553                    |      Stopgaps:                     
         
-------------------------------------------+--------------------------------
Changes (by vbraun):

  * status:  needs_review => needs_work
  * dependencies:  => 12553


Comment:

 Generally speaking, looks good! There are a few nitpicks:

 In #12553, I modified the PPL classes to derive from `SageObject`. This'll
 make it play nicer with the rest of Sage. Correspondingly you should
 override `_repr_`, not `__repr__`. Also needs to dump the actual
 information of the `MIP_problem` or its useless in other doctests.
 Speaking of which, the method needs a doctest. Also, in English you'd say
 "A MIP" not "An MIP", but really the output should be more specific.

 All expensive operations (that need to solve a LP, say) must be wrapped in
 `sig_on/sig_off` blocks. Be careful with exceptions thrown, use
 try/finally if necessary. Otherwise you'll get into expensive but
 untinterruptable computations...

 Can we have a few less empty lines? No need for an empty line before and
 after the """ closing the docstring.

 The INPUT: section should be formatted like
 {{{
   - ``number`` (integer) -- description.
 }}}
 You often have only a single "-" between type and description.

 Coverage should be 100%:
 {{{
 [vbraun@volker-desktop hg]$ sage -coverage
 sage/numerical/backends/ppl_backend.pyx
 ----------------------------------------------------------------------
 sage/numerical/backends/ppl_backend.pyx
 ERROR: Please add a `TestSuite(s).run()` doctest.
 SCORE sage/numerical/backends/ppl_backend.pyx: 72% (24 of 33)

 Missing documentation:
          * int add_variable(self, lower_bound=0.0, upper_bound=None,
 binary=False, continuous=True, integer=False, obj=0.0, name=None) except
 -1: """ Add a variable. This amounts to adding a new column to the matrix.
 By default, the variable is both positive and real. It has not been
 implemented for selecting the variable type yet. INPUT: - ``lower_bound``
 - the lower bound of the variable (default: 0) - ``upper_bound`` - the
 upper bound of the variable (default: ``None``) - ``binary`` - ``True`` if
 the variable is binary (default: ``False``). - ``continuous`` - ``True``
 if the variable is binary (default: ``True``). - ``integer`` - ``True`` if
 the variable is binary (default: ``False``). - ``obj`` - (optional)
 coefficient of this variable in the objective function (default: 0.0) -
 ``name`` - an optional name for the newly added variable (default:
 ``None``). OUTPUT: The index of the newly created variable EXAMPLE:: sage:
 from sage.numerical.backends.generic_backend import get_solver sage: p =
 get_solver(solver = "PPL") sage: p.ncols() 0 sage: p.add_variable() 0
 sage: p.ncols() 1 sage: p.add_variable(lower_bound=-2.0) 1 sage:
 p.add_variable(name='x',obj=1.0) 2 sage: p.col_name(2) 'x' sage:
 p.objective_coefficient(2) 1.00000000000000 """ for i in
 range(len(self.Matrix)):
          * int add_variables(self, int n, lower_bound=0.0,
 upper_bound=None, binary=False, continuous=True, integer=False, obj=0.0,
 names=None) except -1: """ Add ``n`` variables. This amounts to adding new
 columns to the matrix. By default, the variables are both positive and
 real. It has not been implemented for selecting the variable type yet.
 INPUT: - ``n`` - the number of new variables (must be > 0) -
 ``lower_bound`` - the lower bound of the variable (default: 0) -
 ``upper_bound`` - the upper bound of the variable (default: ``None``) -
 ``binary`` - ``True`` if the variable is binary (default: ``False``). -
 ``continuous`` - ``True`` if the variable is binary (default: ``True``). -
 ``integer`` - ``True`` if the variable is binary (default: ``False``). -
 ``obj`` - (optional) coefficient of all variables in the objective
 function (default: 0.0) - ``names`` - optional list of names (default:
 ``None``) OUTPUT: The index of the variable created last. EXAMPLE:: sage:
 from sage.numerical.backends.generic_backend import get_solver sage: p =
 get_solver(solver = "PPL") sage: p.ncols() 0 sage: p.add_variables(5) 4
 sage: p.ncols() 5 sage: p.add_variables(2, lower_bound=-2.0,
 names=['a','b']) 6 """ for k in range(n):
          * int solve(self) except -1: """ Solve the problem. .. NOTE::
 This method raises ``MIPSolverException`` exceptions when the solution can
 not be computed for any reason (none exists, or the LP solver was not able
 to find it, etc...) EXAMPLE:: sage: from
 sage.numerical.backends.generic_backend import get_solver sage: p =
 get_solver(solver = "PPL") sage: p.add_linear_constraints(5, 0, None)
 sage: p.add_col(range(5), range(5)) sage: p.solve() 0 sage:
 p.objective_coefficient(0,1) sage: p.solve() Traceback (most recent call
 last):


 Missing doctests:
          * set_variable_type(self, int variable, int vtype):
          * set_verbosity(self, int level):
          * double get_objective_value(self):
          * double get_variable_value(self, int variable):
          * write_lp(self, char * name):
          * write_mps(self, char * name, int modern):
 }}}

 Finally, the ticket description should say which patch to apply for the
 sanity of the release manager.

 Also, `ptrrsn_1` should put his name on the trac author list
 (http://trac.sagemath.org) and populate the Author: field on the ticket.

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