Dmitrey

bench 2 - interalg

Mar 26th, 2011
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.21 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) + 1e-7 * (a+b+c+d+e+f)
  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.042433106e+00
  16.    10  1.666666904e+00
  17.    20  3.072918325e-01
  18.    30  3.255223470e-02
  19.    40  2.685696946e-03
  20.    50  6.520462736e-03
  21.    60  3.581177051e-03
  22.    70  1.275924447e-03
  23.    80  1.337200948e-04
  24.    90  1.545128259e-05
  25.   100  1.507915732e-06
  26.   110  1.487695799e-07
  27.   120  1.510802721e-08
  28.   130  8.912206558e-10
  29. OpenOpt info: Solution with required tolerance 1.0e-09
  30.  is guarantied (obtained precision: 8.912e-10)
  31.   131  8.912206558e-10
  32. istop: 1000 (optimal solution obtained)
  33. Solver:   Time Elapsed = 29.27  CPU Time Elapsed = 28.46
  34. objFunValue: 8.9122066e-10 (feasible, MaxResidual = 0)
Advertisement
Add Comment
Please, Sign In to add comment