#6302: [with patch, needs review] make openopt an optional spkg
-------------------------------+--------------------------------------------
 Reporter:  was                |        Owner:  tbd         
     Type:  enhancement        |       Status:  reopened    
 Priority:  major              |    Milestone:  sage-4.1.1  
Component:  optional packages  |   Resolution:              
 Keywords:                     |     Reviewer:  David Joyner
   Author:  William Stein      |       Merged:              
-------------------------------+--------------------------------------------

Comment(by schilly):

 installs fine on kbuntu 9.04/32bit /w sage 4.1. I'm able to run an
 arbitrary example from the openopt website as a test problem. It uses the
 "ralg" solver provided by openopt.

 {{{
 preparser(False)
 from numpy import *
 from openopt import NLP
 n = 10
 an = arange(n) # array [0, 1, 2, ..., n-1]
 x0 = n+15*(1+cos(an))
 f = lambda x: (x**2).sum() + sqrt(x**3-arange(n)**3).sum()
 df = lambda x: 2*x + 0.5*3*x**2/sqrt(x**3-arange(n)**3)
 c = lambda x: an**3 - x**3
 dc = lambda x: diag(-3 * x**2)
 lb = arange(n)
 p = NLP(f, x0, df=df, lb=lb, c=c, dc=dc, iprint = 100, maxIter = 10000,
 maxFunEvals = 1e8)
 r = p.solve('ralg')
 # expected r.xf = [0, 1, 2, ..., n-1]
 }}}

 {{{
 sage: r = p.solve('ralg')
 -----------------------------------------------------
 solver: ralg   problem: unnamed   goal: minimum
  iter    objFunVal    log10(maxResidual)
     0  9.129e+03            -100.00
   100  4.104e+03            -100.00
   169  2.878e+02            -100.00
 istop:  3 (|| X[k] - X[k-1] || < xtol)
 Solver:   Time Elapsed = 2.41   CPU Time Elapsed = 1.88
 objFunValue: 287.75368 (feasible, max constraint =  0)

 sage: # expected r.xf = [0, 1, 2, ..., n-1]
 sage: r.xf

 array([ 0.5964556 ,  1.00355187,  2.00415294,  3.00156818,  4.0012493 ,
         5.00080644,  6.00036981,  7.00052146,  8.00016061,  9.00015341])

 }}}

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