root/trunk/openopt/scikits/openopt/examples/glp_1.py
| Revision 954, 387 bytes (checked in by dmitrey.kroshko, 7 months ago) |
|---|
| Line | |
|---|---|
| 1 | from scikits.openopt import GLP |
| 2 | from numpy import * |
| 3 | |
| 4 | f = lambda x: (x[0]-1.5)**2 + sin(0.8 * x[1] ** 2 + 15)**4 + cos(0.8 * x[2] ** 2 + 15)**4 + (x[3]-7.5)**4 |
| 5 | p = GLP(f, lb = -ones(4), ub = ones(4), maxIter = 1e3, maxFunEvals = 1e5, maxTime = 3, maxCPUTime = 3) |
| 6 | |
| 7 | #optional: graphic output |
| 8 | #p.plot = 1 |
| 9 | |
| 10 | r = p.solve('galileo', mutationRate = 0.15, plot=1) |
| 11 | x_opt, f_opt = r.xf, r.ff |
Note: See TracBrowser for help on using the browser.
