Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from FuncDesigner import *
- from openopt import *
- a, b, c, d, e, f = oovars('a', 'b', 'c', 'd', 'e', 'f')
- F = a/(b+1e-15) + c/(d+1e-15) + e/(f+1e-15) + f/(a+1e-15)
- startPoint = {a:0.51, b:0.52, c:0.53, d:0.54, e:0.55, f:0.56}
- 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)
- p = GLP(F, startPoint, fTol = 1e-9, iterObjFunTextFormat='%0.9e' , iprint = 10, constraints = constraints)
- r = p.solve('interalg')
- Output:
- --------------------------------------------------
- solver: interalg_0.17 problem: unnamed type: GLP
- iter objFunVal
- 0 4.042432785e+00
- 10 1.666666667e+00
- 20 2.916666667e-01
- 30 3.059895833e-02
- 40 2.685546860e-03
- 50 6.515979179e-03
- 60 3.580725299e-03
- 70 1.009040436e-03
- 80 1.168485433e-04
- 90 1.206315536e-05
- 100 1.190005497e-06
- 110 1.487507163e-07
- 120 1.512797509e-08
- 130 1.113102992e-09
- OpenOpt info: Solution with required tolerance 1.0e-09
- is guarantied (obtained precision: 4.470e-10)
- 133 4.470494630e-10
- istop: 1000 (optimal solution obtained)
- Solver: Time Elapsed = 28.67 CPU Time Elapsed = 27.92
- objFunValue: 4.4704946e-10 (feasible, MaxResidual = 0)
Advertisement
Add Comment
Please, Sign In to add comment