Show
Ignore:
Timestamp:
05/30/08 10:28:47 (6 months ago)
Author:
dmitrey.kroshko
Message:

some changes

Files:

Legend:

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

    r843 r996  
    22from scikits.openopt import * 
    33 
    4 f = lambda x: (x[0]-20)**2+(1e-8 * x[1] - 80)**2 # objFun 
     4coeff = 1e-8 
     5 
     6f = lambda x: (x[0]-20)**2+(coeff * x[1] - 80)**2 # objFun 
    57c = lambda x: (x[0]-14)**2-1 # non-lin ineq constraint(s) c(x) <= 0 
    68# for the problem involved: f_opt =25, x_opt = [15.0, 8.0e9] 
     
    1618""" 
    1719 for to improve the solution we will use 
    18  changing either p.diffInt from default 1e-7 to [1e-7,  10]  
    19  or p.scale from default None to [1,  1e-8]  
    20   
     20 changing either p.diffInt from default 1e-7 to [1e-7,  1] 
     21 or p.scale from default None to [1,  1e-7] 
     22 
    2123 latter (using p.scale) is more recommended 
    22  because it affects xtol for those solvers  
     24 because it affects xtol for those solvers 
    2325 who use OO stop criteria 
    2426 (ralg, lincher, nsmm, nssolve and mb some others) 
    2527  xtol will be compared to scaled x shift: 
    2628 is || (x[k] - x[k-1]) * scale || < xtol 
    27   
    28  You can define scale and diffInt as  
     29 
     30 You can define scale and diffInt as 
    2931 numpy arrays, matrices, Python lists, tuples 
    3032 """ 
    31 p = NLP(f, x0, c=c, scale = [1,  1e-8], **someModifiedStopCriteria) 
     33p = NLP(f, x0, c=c, scale = [1,  coeff], **someModifiedStopCriteria) 
    3234r = p.solve('ralg') 
    3335print r.ff,  r.xf # "24.999996490694787 [  1.50000004e+01   8.00004473e+09]" - much better