Changeset 82 for tests/test_mogi.py
- Timestamp:
- 01/26/09 16:12:08 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/test_mogi.py
r81 r82 110 110 if __name__ == '__main__': 111 111 112 from mystic.nelder_mead import fmin 112 from mystic.scipy_optimize_fmin import NelderMeadSimplexSolver as fmin 113 from mystic.nmtools import IterationRelativeError as IRE 113 114 from scipy.optimize import leastsq, fmin_cg 114 115 # … … 125 126 # 126 127 simplex, esow = Sow(), Sow() 127 sol = fmin(cost_function, point, EvaluationMonitor = esow, retall = True, StepMonitor = simplex) 128 print "simplex solution: ", sol[1][-1] 128 solver = fmin(len(point)) 129 solver.SetInitialPoints(point) 130 killme = IRE(1e-4,1e-4) 131 solver.Solve(cost_function, killme, EvaluationMonitor = esow, StepMonitor = simplex) 132 sol = solver.Solution() 133 134 print "simplex solution: ", sol 129 135 # 130 136 solcg = fmin_cg(cost_function, point) … … 137 143 plot_noisy_data() 138 144 plot_sol(desol,'r-') 139 plot_sol(sol [1][-1],'k--')145 plot_sol(sol,'k--') 140 146 plot_sol(solcg,'b-.') 141 147 pylab.legend(('Noisy data', 'Differential Evolution', 'Nelder Mead', 'Polak Ribiere'))
Note: See TracChangeset
for help on using the changeset viewer.