#11606: simplify constraints in linear programs
----------------------------------+-----------------------------------------
   Reporter:  john_perry          |          Owner:  ncohen    
       Type:  enhancement         |         Status:  needs_work
   Priority:  major               |      Milestone:  sage-4.7.2
  Component:  linear programming  |       Keywords:  sd32      
Work_issues:                      |       Upstream:  N/A       
   Reviewer:                      |         Author:  john_perry
     Merged:                      |   Dependencies:            
----------------------------------+-----------------------------------------
Changes (by ncohen):

  * status:  needs_review => needs_work


Comment:

 Hello John ! `:-)`

 I really didn't think at first this method would need to use either min or
 max later on :-)

 Hopefully, this trick should work :

 {{{
 from __builtin__ import min as min_function
 }}}

 Could you also add in the explanation of the check_redundant parameter
 what is a "redundant" constraint ? Something like "(two constraints are
 redundant when one can be obtained from the other scalar by
 multiplication)" or something of the kind ? `:-)`

 Oh, and it looks like there are some missing "::" before the beginning of
 Python code in the doctests, so those will not be properly formatted when
 building the documentation.

 {{{
 sage -docbuild reference html
 }}}

 Two other remarks :

 * Set is a Sage version of set, the latter being a purely Python thing.
 The interest of Set is that it is hashable and immutable, while the "set"
 can be modified. When you do not need the elements to be immutable, I'm
 told the best is to use set. And this I was probably told after writing
 this part `:-)`

 * I thought that
 {{{
 min( x for x in range(3) if x != 0 )
 }}}
   would be faster than
 {{{
 min([ x for x in range(3) if x != 0 ])
 }}}

   as you do not create the list first, but it looks like the iterators
 have a cost too :

 {{{
 sage: %timeit min( x for x in range(10000) if x != 0 )
 125 loops, best of 3: 5.51 ms per loop
 sage: %timeit min([ x for x in range(10000) if x != 0 ])
 125 loops, best of 3: 4.56 ms per loop
 sage: %timeit min(x for x in range(10) if x != 0)
 625 loops, best of 3: 7.41 µs per loop
 sage: %timeit min([ x for x in range(10) if x != 0 ])
 625 loops, best of 3: 6.81 µs per loop
 }}}
 Nathann

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