Changeset 424
- Timestamp:
- 09/10/10 12:44:19 (6 years ago)
- Location:
- mystic/tests
- Files:
-
- 2 added
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
mystic/tests/test_termination.py
r423 r424 1 1 #!/usr/bin/env python 2 """test termination conditions... 3 def VTR(tolerance = 0.005): 4 def ChangeOverGeneration(tolerance = 1e-6, generations = 30): 5 def NormalizedChangeOverGeneration(tolerance = 1e-4, generations = 10): 6 def CandidateRelativeTolerance(xtol=1e-4, ftol=1e-4): 7 def SolutionImprovement(tolerance = 1e-5): 8 def NormalizedCostTarget(fval = None, tolerance = 1e-6, generations = 30): 9 def VTRChangeOverGeneration(ftol = 0.005, gtol = 1e-6, generations = 30): 10 def PopulationSpread(tolerance=1e-6): 11 def GradientNormTolerance(tolerance=1e-5, norm=Inf): 2 """test termination conditions. (defaults listed below) 3 4 VTR(tolerance = 0.005) 5 ChangeOverGeneration(tolerance = 1e-6, generations = 30) 6 NormalizedChangeOverGeneration(tolerance = 1e-4, generations = 10) 7 CandidateRelativeTolerance(xtol=1e-4, ftol=1e-4) 8 SolutionImprovement(tolerance = 1e-5) 9 NormalizedCostTarget(fval = None, tolerance = 1e-6, generations = 30) 10 VTRChangeOverGeneration(ftol = 0.005, gtol = 1e-6, generations = 30) 11 PopulationSpread(tolerance=1e-6) 12 GradientNormTolerance(tolerance=1e-5, norm=Inf) 12 13 """ 13 #FIXME: need to use 'mystic' module imports 14 from termination import * 14 from mystic.termination import * 15 15 from numpy import inf 16 16 … … 50 50 51 51 def test01(terminate, func=lambda x:x[0], debug=False): 52 from differential_evolution import DifferentialEvolutionSolver2 as DE252 from mystic.differential_evolution import DifferentialEvolutionSolver2 as DE2 53 53 solver = DE2(3,5) 54 54 solver.SetRandomInitialPoints() … … 59 59 60 60 def test02(terminate, func=lambda x:x[0], debug=False): 61 from differential_evolution import DifferentialEvolutionSolver2 as DE261 from mystic.differential_evolution import DifferentialEvolutionSolver2 as DE2 62 62 #solver = DE2(3,1) #Solver throws ValueError "sample larger than population" 63 63 #solver = DE2(1,1) #Solver throws ValueError "sample larger than population" … … 70 70 71 71 def test03(terminate, func=lambda x:x[0], debug=False): 72 from differential_evolution import DifferentialEvolutionSolver as DE72 from mystic.differential_evolution import DifferentialEvolutionSolver as DE 73 73 solver = DE(3,5) 74 74 solver.SetRandomInitialPoints() … … 79 79 80 80 def test04(terminate, func=lambda x:x[0], debug=False): 81 from differential_evolution import DifferentialEvolutionSolver as DE81 from mystic.differential_evolution import DifferentialEvolutionSolver as DE 82 82 solver = DE(1,5) 83 83 solver.SetRandomInitialPoints() … … 88 88 89 89 def test05(terminate, func=lambda x:x[0], debug=False): 90 from scipy_optimize import NelderMeadSimplexSolver as NM90 from mystic.scipy_optimize import NelderMeadSimplexSolver as NM 91 91 solver = NM(3) 92 92 solver.SetRandomInitialPoints() … … 97 97 98 98 def test06(terminate, func=lambda x:x[0], debug=False): 99 from scipy_optimize import NelderMeadSimplexSolver as NM99 from mystic.scipy_optimize import NelderMeadSimplexSolver as NM 100 100 solver = NM(1) 101 101 solver.SetRandomInitialPoints() … … 106 106 107 107 def test07(terminate, func=lambda x:x[0], debug=False): 108 from scipy_optimize import PowellDirectionalSolver as PDS108 from mystic.scipy_optimize import PowellDirectionalSolver as PDS 109 109 solver = PDS(3) 110 110 solver.SetRandomInitialPoints() … … 115 115 116 116 def test08(terminate, func=lambda x:x[0], debug=False): 117 from scipy_optimize import PowellDirectionalSolver as PDS117 from mystic.scipy_optimize import PowellDirectionalSolver as PDS 118 118 solver = PDS(1) 119 119 solver.SetRandomInitialPoints()
Note: See TracChangeset
for help on using the changeset viewer.