Changeset 831 for mystic/examples2/optqp.py
- Timestamp:
- 09/28/15 20:45:46 (8 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
mystic/examples2/optqp.py
r816 r831 30 30 from mystic.symbolic import generate_conditions, generate_penalty 31 31 pf = generate_penalty(generate_conditions(equations), k=1e4) 32 from mystic.symbolic import generate_constraint, generate_solvers, solve 33 cf = generate_constraint(generate_solvers(solve(equations))) 32 34 33 35 # inverted objective, used in solving for the maximum … … 40 42 from mystic.math import almostEqual 41 43 42 result = diffev2(_objective, x0=bounds, bounds=bounds, penalty=pf, npop=40, ftol=1e-8, gtol=100, disp=False, full_output=True)44 result = diffev2(_objective, x0=bounds, bounds=bounds, constraint=cf, penalty=pf, npop=40, ftol=1e-8, gtol=100, disp=False, full_output=True) 43 45 assert almostEqual(result[0], xs, rel=2e-2) 44 46 assert almostEqual(result[1], ys, rel=2e-2) 45 47 46 result = fmin_powell(_objective, x0=[-1.0,1.0], bounds=bounds, penalty=pf, disp=False, full_output=True)48 result = fmin_powell(_objective, x0=[-1.0,1.0], bounds=bounds, constraint=cf, penalty=pf, disp=False, full_output=True) 47 49 assert almostEqual(result[0], xs, rel=2e-2) 48 50 assert almostEqual(result[1], ys, rel=2e-2) 49 51 50 52 51 # EO D53 # EOF
Note: See TracChangeset
for help on using the changeset viewer.