Changeset 1154

Show
Ignore:
Timestamp:
07/22/08 05:43:36 (4 months ago)
Author:
dmitrey.kroshko
Message:

update in /examples/oofun_input

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openopt/scikits/openopt/examples/oofun_input.py

    r1152 r1154  
    77c1(x) = c0(x)^2-1 <=0 
    88c2(x) = c1(x)^2-1.5 <=0 
     9c3(x) = c0(x) + 2*c2(x) + 1.5 <= 0 
    910 
    1011using openopt's oofun 
     
    2021df = lambda x: 2 * (x-arange(n)) 
    2122 
    22 # parameter "name" is optional 
    2323c0 = oofun(lambda x: x[-1] ** 2 + x[-2] ** 2 - 1, name = 'constraint 0') 
    2424c1 = oofun(lambda c: c**2 - 1, input = c0, name = 'constraint 1') 
    25 c2 = oofun(lambda c: c**2 - 1.5, input = c1, name = 'constraint 2') 
     25c2 = oofun(lambda c: c**2 - 1.5, input = c1) # parameter "name" is optional 
     26c3 = oofun(lambda y, z: y + 2*z + 1.5, input = [c0, c2], name = 'constraint 3') 
    2627 
    27 p = NLP(f,  x0,  df=df, c=[c0, c1, c2], maxIter = 1e4, maxFunEvals = 1e10, iprint = 10) 
     28c = [c2, c0, c1, c3] # ORDER: any 
     29 
     30p = NLP(f,  x0,  df=df, c=c) 
    2831r = p.solve('ralg') 
     32#Solver:   Time Elapsed = 0.64  CPU Time Elapsed = 0.61 
     33#objFunValue: 332.71635 (feasible, max constraint =  0)