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) + 1e-7 * (a+b+c+d+e+f)
- 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.042433106e+00
- 10 1.666666904e+00
- 20 3.072918325e-01
- 30 3.255223470e-02
- 40 2.685696946e-03
- 50 6.520462736e-03
- 60 3.581177051e-03
- 70 1.275924447e-03
- 80 1.337200948e-04
- 90 1.545128259e-05
- 100 1.507915732e-06
- 110 1.487695799e-07
- 120 1.510802721e-08
- 130 8.912206558e-10
- OpenOpt info: Solution with required tolerance 1.0e-09
- is guarantied (obtained precision: 8.912e-10)
- 131 8.912206558e-10
- istop: 1000 (optimal solution obtained)
- Solver: Time Elapsed = 29.27 CPU Time Elapsed = 28.46
- objFunValue: 8.9122066e-10 (feasible, MaxResidual = 0)
Advertisement
Add Comment
Please, Sign In to add comment