Changeset 635
- Timestamp:
- 01/06/13 18:48:48 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
mystic/tests/solver_test_compare.py
r633 r635 21 21 s2_x = s2(rosen, x0, disp=0, full_output=True, **kwds) 22 22 # similar bestSolution and bestEnergy 23 24 23 # print 's1:', s1_x[0:2] 24 # print 's2:', s2_x[0:2] 25 25 # print (iters, fcalls) and [maxiter, maxfun] 26 26 # print s1_x[2:4], s2_x[2:4], [maxiter, maxfun] … … 46 46 sp_x = sp(rosen, x0, disp=0, full_output=True, **kwds) 47 47 # similar bestSolution and bestEnergy 48 49 48 # print 'my:', my_x[0:2] 49 # print 'sp:', sp_x[0:2] 50 50 assert almostEqual(my_x[0], sp_x[0]) 51 51 assert almostEqual(my_x[1], sp_x[1]) … … 65 65 if __name__ == '__main__': 66 66 x0 = [0,0,0] 67 68 # check solutions versus results based on the random_seed 69 print "comparing against known results" 70 sol = solvers.diffev(rosen, x0, npop=40, disp=0, full_output=True) 71 assert almostEqual(sol[1], 0.0020640145337293249, tol=1e-3) 72 sol = solvers.diffev2(rosen, x0, npop=40, disp=0, full_output=True) 73 assert almostEqual(sol[1], 0.0017516784703663288) 74 sol = solvers.fmin_powell(rosen, x0, disp=0, full_output=True) 75 assert almostEqual(sol[1], 8.3173488898295291e-23) 76 sol = solvers.fmin(rosen, x0, disp=0, full_output=True) 77 assert almostEqual(sol[1], 1.1605792769954724e-09) 67 78 68 79 solver2 = 'diffev2' … … 91 102 test_compare(solver, x0, maxiter=9) 92 103 104 93 105 # EOF
Note: See TracChangeset
for help on using the changeset viewer.