Dmitrey

bench 1 - interalg

Mar 26th, 2011
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.19 KB | None | 0 0
  1. from FuncDesigner import *
  2. from openopt import *
  3.  
  4. a, b, c, d, e, f = oovars('a', 'b', 'c', 'd', 'e', 'f')
  5. F =  a/(b+1e-15) + c/(d+1e-15) + e/(f+1e-15) + f/(a+1e-15)
  6. startPoint = {a:0.51, b:0.52, c:0.53, d:0.54, e:0.55, f:0.56}
  7. constraints = (a>0, a<1, b>0, b<1, c>0, c<1, d>0, d<1, e>0, e<1, f>0, f<1)
  8. p = GLP(F, startPoint, fTol = 1e-9, iterObjFunTextFormat='%0.9e' , iprint = 10, constraints = constraints)
  9. r = p.solve('interalg')
  10.  
  11. Output:
  12. --------------------------------------------------
  13. solver: interalg_0.17   problem: unnamed    type: GLP
  14.  iter    objFunVal  
  15.     0  4.042432785e+00
  16.    10  1.666666667e+00
  17.    20  2.916666667e-01
  18.    30  3.059895833e-02
  19.    40  2.685546860e-03
  20.    50  6.515979179e-03
  21.    60  3.580725299e-03
  22.    70  1.009040436e-03
  23.    80  1.168485433e-04
  24.    90  1.206315536e-05
  25.   100  1.190005497e-06
  26.   110  1.487507163e-07
  27.   120  1.512797509e-08
  28.   130  1.113102992e-09
  29. OpenOpt info: Solution with required tolerance 1.0e-09
  30.  is guarantied (obtained precision: 4.470e-10)
  31.   133  4.470494630e-10
  32. istop: 1000 (optimal solution obtained)
  33. Solver:   Time Elapsed = 28.67  CPU Time Elapsed = 27.92
  34. objFunValue: 4.4704946e-10 (feasible, MaxResidual = 0)
Advertisement
Add Comment
Please, Sign In to add comment