Changeset 424


Ignore:
Timestamp:
09/10/10 12:44:19 (6 years ago)
Author:
mmckerns
Message:

added test suite to test defaluts for mystic solvers
added test suite to test "best" results for mystic solvers
moved termination tests to tests directory

Location:
mystic/tests
Files:
2 added
1 moved

Legend:

Unmodified
Added
Removed
  • mystic/tests/test_termination.py

    r423 r424  
    11#!/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 
     4VTR(tolerance = 0.005) 
     5ChangeOverGeneration(tolerance = 1e-6, generations = 30) 
     6NormalizedChangeOverGeneration(tolerance = 1e-4, generations = 10) 
     7CandidateRelativeTolerance(xtol=1e-4, ftol=1e-4) 
     8SolutionImprovement(tolerance = 1e-5) 
     9NormalizedCostTarget(fval = None, tolerance = 1e-6, generations = 30) 
     10VTRChangeOverGeneration(ftol = 0.005, gtol = 1e-6, generations = 30) 
     11PopulationSpread(tolerance=1e-6) 
     12GradientNormTolerance(tolerance=1e-5, norm=Inf) 
    1213""" 
    13 #FIXME: need to use 'mystic' module imports 
    14 from termination import * 
     14from mystic.termination import * 
    1515from numpy import inf 
    1616 
     
    5050 
    5151def test01(terminate, func=lambda x:x[0], debug=False): 
    52   from differential_evolution import DifferentialEvolutionSolver2 as DE2 
     52  from mystic.differential_evolution import DifferentialEvolutionSolver2 as DE2 
    5353  solver = DE2(3,5) 
    5454  solver.SetRandomInitialPoints() 
     
    5959 
    6060def test02(terminate, func=lambda x:x[0], debug=False): 
    61   from differential_evolution import DifferentialEvolutionSolver2 as DE2 
     61  from mystic.differential_evolution import DifferentialEvolutionSolver2 as DE2 
    6262 #solver = DE2(3,1) #Solver throws ValueError "sample larger than population" 
    6363 #solver = DE2(1,1) #Solver throws ValueError "sample larger than population" 
     
    7070 
    7171def test03(terminate, func=lambda x:x[0], debug=False): 
    72   from differential_evolution import DifferentialEvolutionSolver as DE 
     72  from mystic.differential_evolution import DifferentialEvolutionSolver as DE 
    7373  solver = DE(3,5) 
    7474  solver.SetRandomInitialPoints() 
     
    7979 
    8080def test04(terminate, func=lambda x:x[0], debug=False): 
    81   from differential_evolution import DifferentialEvolutionSolver as DE 
     81  from mystic.differential_evolution import DifferentialEvolutionSolver as DE 
    8282  solver = DE(1,5) 
    8383  solver.SetRandomInitialPoints() 
     
    8888 
    8989def test05(terminate, func=lambda x:x[0], debug=False): 
    90   from scipy_optimize import NelderMeadSimplexSolver as NM 
     90  from mystic.scipy_optimize import NelderMeadSimplexSolver as NM 
    9191  solver = NM(3) 
    9292  solver.SetRandomInitialPoints() 
     
    9797 
    9898def test06(terminate, func=lambda x:x[0], debug=False): 
    99   from scipy_optimize import NelderMeadSimplexSolver as NM 
     99  from mystic.scipy_optimize import NelderMeadSimplexSolver as NM 
    100100  solver = NM(1) 
    101101  solver.SetRandomInitialPoints() 
     
    106106 
    107107def test07(terminate, func=lambda x:x[0], debug=False): 
    108   from scipy_optimize import PowellDirectionalSolver as PDS 
     108  from mystic.scipy_optimize import PowellDirectionalSolver as PDS 
    109109  solver = PDS(3) 
    110110  solver.SetRandomInitialPoints() 
     
    115115 
    116116def test08(terminate, func=lambda x:x[0], debug=False): 
    117   from scipy_optimize import PowellDirectionalSolver as PDS 
     117  from mystic.scipy_optimize import PowellDirectionalSolver as PDS 
    118118  solver = PDS(1) 
    119119  solver.SetRandomInitialPoints() 
Note: See TracChangeset for help on using the changeset viewer.