Changeset 172


Ignore:
Timestamp:
08/07/09 11:28:29 (7 years ago)
Author:
mmckerns
Message:

bugfix in termination condition choice for UQ & parameter sensitivity
added explicit parameter sensitivity case (TEST2b.py)

Location:
branches/UQ
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • branches/UQ/MPITEST.py

    r157 r172  
    2323  from pyina.differential_evolution import DifferentialEvolutionSolver2 
    2424  from pyina.parallel_map2 import parallel_map 
    25   from mystic.termination import VTR 
     25  from mystic.termination import CandidateRelativeTolerance as CRT 
    2626  from mystic.strategy import Best1Exp 
    2727  from mystic import getch, random_seed, VerboseSow, Sow 
     
    2929  random_seed(123) 
    3030 
    31   stepmon = VerboseSow() 
     31 #stepmon = VerboseSow(100) 
     32  stepmon = Sow() 
    3233  evalmon = Sow() 
    3334 
     
    4041  solver.SetEvaluationLimits(maxiter,maxfun) 
    4142 
    42   solver.Solve(cost,termination=VTR(convergence_tol),strategy=Best1Exp, \ 
     43  tol = convergence_tol 
     44  solver.Solve(cost,termination=CRT(tol,tol),strategy=Best1Exp, \ 
    4345               CrossProbability=crossover,ScalingFactor=percent_change, \ 
    4446               StepMonitor=stepmon, EvaluationMonitor=evalmon) 
    4547 
     48 #print solver.Solution() 
    4649  diameter = -solver.bestEnergy / scale 
    4750  func_evals = len(evalmon.y) 
     
    105108    print " model: f(t) = x1*x2 + x3 + 2.0" 
    106109    print " parameters: ['x1', 'x2', 'x3']" 
     110   #print " lower bounds: %s" % lower_bounds 
     111   #print " upper bounds: %s" % upper_bounds 
    107112    print " ..." 
    108113 
  • branches/UQ/TEST.py

    r157 r172  
    99#XXX: <mpi config goes here> 
    1010 
    11 npop = 100 
    12 maxiter = 2 #XXX: maxiter too small? 
    13 maxfun = 10 #XXX: maxfun too small? 
    14 convergence_tol = 0.05 
    15 crossover = 0.5 
    16 percent_change = 1.0 #XXX: is 0.9 better? 
    17  
     11npop = 20 
     12maxiter = 500 
     13maxfun = 1e+6 
     14convergence_tol = 1e-4 
     15crossover = 0.9 
     16percent_change = 0.9 
    1817 
    1918####################################################################### 
     
    2827  def model(t): 
    2928    """a simple time-dependent model function 
    30   f(t) = x1*x2 + x3 + 2.0  [yes, it's actually time-independent...] 
     29  f(t) = x1*x2 + x3 + 2.0 
    3130 
    3231  Input: 
     
    8483def dakota(cost,lb,ub): 
    8584  from mystic.differential_evolution import DifferentialEvolutionSolver2 
    86   from mystic.termination import VTR 
     85  from mystic.termination import CandidateRelativeTolerance as CRT 
    8786  from mystic.strategy import Best1Exp 
    8887  from mystic import getch, random_seed, VerboseSow, Sow 
     
    9089  random_seed(123) 
    9190 
    92   stepmon = VerboseSow() 
     91 #stepmon = VerboseSow(100) 
     92  stepmon = Sow() 
    9393  evalmon = Sow() 
    9494 
     
    100100  solver.SetEvaluationLimits(maxiter,maxfun) 
    101101 
    102   solver.Solve(cost,termination=VTR(convergence_tol),strategy=Best1Exp, \ 
     102  tol = convergence_tol 
     103  solver.Solve(cost,termination=CRT(tol,tol),strategy=Best1Exp, \ 
    103104               CrossProbability=crossover,ScalingFactor=percent_change, \ 
    104105               StepMonitor=stepmon, EvaluationMonitor=evalmon) 
    105106 
     107  print solver.Solution() 
    106108  diameter = -solver.bestEnergy / scale 
    107109  func_evals = len(evalmon.y) 
     
    152154  print " model: f(t) = x1*x2 + x3 + 2.0" 
    153155  print " parameters: ['x1', 'x2', 'x3']" 
     156  print " lower bounds: %s" % lower_bounds 
     157  print " upper bounds: %s" % upper_bounds 
    154158  print " ..." 
    155159 
  • branches/UQ/TEST2.py

    r157 r172  
    99#XXX: <mpi config goes here> 
    1010 
    11 npop = 500 
    12 maxiter = 5 
    13 maxfun = 5000  
    14 convergence_tol = 0.001 
    15 crossover = 0.1 
    16 percent_change = 0.5 
     11npop = 20 
     12maxiter = 1000 
     13maxfun = 1e+6 
     14convergence_tol = 1e-4 
     15crossover = 0.9 
     16percent_change = 0.9 
    1717 
    1818 
     
    8484def dakota(cost,lb,ub): 
    8585  from mystic.differential_evolution import DifferentialEvolutionSolver2 
    86   from mystic.termination import VTR 
     86  from mystic.termination import CandidateRelativeTolerance as CRT 
    8787  from mystic.strategy import Best1Exp 
    8888  from mystic import getch, random_seed, VerboseSow, Sow 
     
    9090  random_seed(123) 
    9191 
    92   stepmon = VerboseSow() 
     92 #stepmon = VerboseSow(100) 
     93  stepmon = Sow() 
    9394  evalmon = Sow() 
    9495 
     
    100101  solver.SetEvaluationLimits(maxiter,maxfun) 
    101102 
    102   solver.Solve(cost,termination=VTR(convergence_tol),strategy=Best1Exp, \ 
     103  tol = convergence_tol 
     104  solver.Solve(cost,termination=CRT(tol,tol),strategy=Best1Exp, \ 
    103105               CrossProbability=crossover,ScalingFactor=percent_change, \ 
    104106               StepMonitor=stepmon, EvaluationMonitor=evalmon) 
Note: See TracChangeset for help on using the changeset viewer.