Changeset 83


Ignore:
Timestamp:
01/26/09 16:54:02 (7 years ago)
Author:
mmckerns
Message:

modified detools termination conditions to take instance;
removed explicitly setting xtol,ftol in IRE calls in test code

Files:
9 edited

Legend:

Unmodified
Added
Removed
  • python/detools.py

    r77 r83  
    2424 
    2525def ChangeOverGeneration(tolerance = 1e-6, generations = 30): 
    26     def _(hist): 
     26    def _(inst): 
     27         hist = inst.energy_history 
    2728         lg = len(hist) 
    2829         return lg > generations and (hist[-generations]-hist[-1]) < tolerance 
     
    3031 
    3132def VTR(tolerance = 0.005): 
    32     def _(hist): 
     33    def _(inst): 
     34         hist = inst.energy_history 
    3335         return hist[-1] < tolerance 
    3436    return _ 
  • python/differential_evolution.py

    r77 r83  
    228228            self.energy_history.append(self.bestEnergy) 
    229229             
    230             if detools.EARLYEXIT or termination(self.energy_history): 
     230            if detools.EARLYEXIT or termination(self): 
    231231                break 
    232232 
     
    323323            self.energy_history.append(self.bestEnergy) 
    324324             
    325             if detools.EARLYEXIT or termination(self.energy_history): 
     325            if detools.EARLYEXIT or termination(self): 
    326326                break 
    327327 
  • tests/sam_corana2.py

    r82 r83  
    4545    solver = fmin(2) 
    4646    solver.SetRandomInitialPoints([0,0],[2,2]) 
    47     killme = IRE(1e-4,1e-4) 
    48     solver.Solve(Corana2, termination=killme, StepMonitor = simplex) 
     47    solver.Solve(Corana2, termination=IRE(), StepMonitor = simplex) 
    4948    sol = solver.Solution() 
    5049     
  • tests/sam_mogi.py

    r82 r83  
    6666    solver = fmin(len(xinit)) 
    6767    solver.SetInitialPoints(xinit) 
    68     killme = IRE(1e-4,1e-4) 
    69     solver.Solve(cost_function, termination=killme, StepMonitor = simplex) 
     68    solver.Solve(cost_function, termination=IRE() StepMonitor = simplex) 
    7069    sol = solver.Solution() 
    7170    print sol 
     
    8584    solver = fmin(len(xinit)) 
    8685    solver.SetInitialPoints(xinit) 
    87     killme = IRE(1e-4,1e-4) 
    88     solver.Solve(cost_function, termination=killme, StepMonitor = simplex) 
     86    solver.Solve(cost_function, termination=IRE(), StepMonitor = simplex) 
    8987    sol = solver.Solution() 
    9088    print sol 
  • tests/sam_rosenbrock.py

    r82 r83  
    4545    solver = fmin(len(xinit)) 
    4646    solver.SetInitialPoints(xinit) 
    47     killme = IRE(1e-4,1e-4) 
    48     solver.Solve(rosen, termination=killme, StepMonitor = simplex) 
     47    solver.Solve(rosen, termination=IRE(), StepMonitor = simplex) 
    4948    sol = solver.Solution() 
    5049     
  • tests/sam_zimmermann.py

    r82 r83  
    4242    solver = fmin(2) 
    4343    solver.SetRandomInitialPoints([0,0],[7,7]) 
    44     killme = IRE(1e-4,1e-4) 
    45     solver.Solve(CostFunction, termination=killme, StepMonitor = simplex) 
     44    solver.Solve(CostFunction, termination=IRE(), StepMonitor = simplex) 
    4645    sol = solver.Solution() 
    4746 
  • tests/test_mogi.py

    r82 r83  
    128128    solver = fmin(len(point)) 
    129129    solver.SetInitialPoints(point) 
    130     killme = IRE(1e-4,1e-4) 
    131     solver.Solve(cost_function, killme, EvaluationMonitor = esow, StepMonitor = simplex) 
     130    solver.Solve(cost_function, IRE(), EvaluationMonitor = esow, StepMonitor = simplex) 
    132131    sol = solver.Solution() 
    133132 
  • tests/test_rosenbrock.py

    r82 r83  
    5151    solver = fmin(len(xinit)) 
    5252    solver.SetInitialPoints(xinit) 
    53     killme = IRE(1e-4,1e-4) 
    54     solver.Solve(rosen, killme, EvaluationMonitor = esow, StepMonitor = ssow) 
     53    solver.Solve(rosen, IRE(), EvaluationMonitor = esow, StepMonitor = ssow) 
    5554    sol = solver.Solution() 
    5655    print sol 
  • tests/test_zimmermann.py

    r82 r83  
    7272    solver = fmin(len(xinit)) 
    7373    solver.SetInitialPoints(xinit) 
    74     killme = IRE(1e-4,1e-4) 
    75     solver.Solve(CostFunction, killme, EvaluationMonitor = esow, StepMonitor = simplex) 
     74    solver.Solve(CostFunction, IRE(), EvaluationMonitor = esow, StepMonitor = simplex) 
    7675    sol = solver.Solution() 
    7776    print "solution: ", sol 
Note: See TracChangeset for help on using the changeset viewer.