Changeset 1066
- Timestamp:
- 06/27/08 15:50:21 (2 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/openopt/scikits/openopt/examples/nlsp_constrained.py
r920 r1066 13 13 2. You can try using equality constraints (h(x)=0, Aeq x = beq) as well. 14 14 3. Required function tolerance is p.ftol, constraints tolerance is p.contol, 15 and hence using h(x)=0 constraints is not 100% same 15 and hence using h(x)=0 constraints is not 100% same 16 16 to some additional f coords 17 17 """ … … 23 23 #f = lambda x: (x[0]**3+x[1]**3-9, x[0]-0.5*x[1], cos(x[2])+x[0]-1.5) 24 24 f = (lambda x: x[0]**3+x[1]**3-9, lambda x: x[0]-0.5*x[1], lambda x: cos(x[2])+x[0]-1.5) 25 # Python list, numpy.array are allowed as well: 25 # Python list, numpy.array are allowed as well: 26 26 #f = lambda x: [x[0]**3+x[1]**3-9, x[0]-0.5*x[1], cos(x[2])+x[0]-1.5] 27 27 #or f = lambda x: asfarray((x[0]**3+x[1]**3-9, x[0]-0.5*x[1], cos(x[2])+x[0]-1.5)) … … 37 37 df[2,2] = -sin(x[2]) 38 38 return df 39 39 40 40 x0 = [8,15, 80] 41 41 42 #w/o gradient: 42 #w/o gradient: 43 43 #p = NLSP(f, x0) 44 44 45 p = NLSP(f, x0, df = df, maxFunEvals = 1e5, iprint = 10 )45 p = NLSP(f, x0, df = df, maxFunEvals = 1e5, iprint = 10, plot=1, ftol = 1e-12, contol=1e-13) 46 46 47 47 #optional: user-supplied gradient check:
