#12220: Updated CBC spkg
----------------------------------+-----------------------------------------
   Reporter:  ncohen              |          Owner:  ncohen       
       Type:  enhancement         |         Status:  needs_work   
   Priority:  major               |      Milestone:  sage-4.8     
  Component:  linear programming  |       Keywords:               
Work_issues:                      |       Upstream:  N/A          
   Reviewer:                      |         Author:  Nathann Cohen
     Merged:                      |   Dependencies:               
----------------------------------+-----------------------------------------

Comment(by john_perry):

 I think I've found threads.

 In class `OsiClpSolverInterface`, there's a method,
 {{{
   ClpSimplex * getModelPtr();
 }}}
 It turns out that `ClpSimplex` inherits from `ClpModel`, wherein we find
 {{{
   void setNumberThreads(int value)
 }}}
 I am not sure it actually does anything with the threads, since the method
 is commented with
 {{{
   /// Number of threads (not very operational)
 }}}
 but perhaps its descendant `ClpSimplex` does something with it.

 To activate this, I am adding the following lines to
 `OsiSolverInterface.pxd`:
 {{{
 cdef extern from "../../local/include/coin/ClpModel.hpp":
      cdef cppclass ClpModel:
         void setNumberThreads(int value)
         int numberThreads()

 cdef extern from "../../local/include/coin/ClpSimplex.hpp":
     cdef cppclass ClpSimplex(ClpModel):
         pass

 cdef extern from "../../local/include/coin/OsiClpSolverInterface.hpp":
      cdef cppclass OsiClpSolverInterface(OsiSolverInterface):
      ...
          ClpSimplex * getModelPtr()
      ...
 }}}
 and in `__cinit__()` for `OsiClpSolverInterface.pyx` now sets it up as:
 {{{
         #self.si = new CoinModel(NULL)
         cdef OsiClpSolverInterface * si_model = self.si
         cdef ClpSimplex * model = si_model.getModelPtr()

         import multiprocessing
         model.setNumberThreads(multiprocessing.cpu_count())
 }}}
 As far as I can tell, this seems to work: it compiles & links, and Coin
 seems to be working properly; that is, I'm not encountering any errors. I
 don't know how to test it, though; any advice?

 Also, does this look sensible? If so, I'll upload a new patch containing
 all the changes I've made so far.

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