Changeset 172 for branches/UQ/TEST.py


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)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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 
Note: See TracChangeset for help on using the changeset viewer.