#12379: Graph chromatic_number - change default algorithm.
----------------------------+-----------------------------------------------
   Reporter:  JoalHeagney   |          Owner:  jason, ncohen, rlm           
       Type:  enhancement   |         Status:  new                          
   Priority:  minor         |      Milestone:  sage-5.0                     
  Component:  graph theory  |       Keywords:  graph, MILP, chromatic_number
Work_issues:                |       Upstream:  N/A                          
   Reviewer:                |         Author:  JoalHeagney                  
     Merged:                |   Dependencies:                               
----------------------------+-----------------------------------------------

Comment(by was):

 I just wrote this:

 {{{
 def use_all(f, algorithms):
     @parallel(len(algorithms), verbose=False)
     def h(alg):
         return f(algorithm=alg)
     for input, output in h(algorithms):
         return output, input[0][0]
 }}}

 which one can use like this:

 {{{
 set_random_seed(0)
 g = graphs.RandomGNP(20, .5)
 time use_all(g.chromatic_number, ['DLX', 'MILP', 'CP'])
 }}}

 This way all algorithms get run, and the first to finish is used.  This
 could be useful.  Perhaps my function above could go in devel/sage-
 main/sage/parallel/algorithm.py and provide a way to easily implement an
 algorithm="parallel" option.

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