Changeset 111
- Timestamp:
- 03/11/09 11:33:05 (7 years ago)
- Files:
-
- 1 deleted
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
mystic/MYSTIC-EXAMPLE.txt
r88 r111 131 131 solver.SetRandomInitialPoints(min = minrange, max = maxrange) 132 132 solver.SetStrictRanges(min = minrange, max = maxrange) 133 solver.SetEvaluationLimits(maxiter=MAX_GENERATIONS) 133 134 134 135 solver.Solve(CF,Best1Exp,termination=ChangeOverGeneration(generations=300),\ 135 maxiter=MAX_GENERATIONS,CrossProbability=0.5,ScalingFactor=0.5,\136 StepMonitor=stepmon,sigint_callback=plot_sol)136 CrossProbability=0.5,ScalingFactor=0.5,\ 137 StepMonitor=stepmon,sigint_callback=plot_sol) 137 138 138 139 solution = solver.Solution() -
mystic/examples/derun.py
r95 r111 52 52 strategy = self.strategy 53 53 solver.SetRandomInitialPoints(min = self.mod.min, max = self.mod.max) 54 solver.Solve(costfunction, strategy, termination, CrossProbability=self.probability, \ 55 maxiter = MAX_GENERATIONS,ScalingFactor=self.scale) 54 solver.SetEvaluationLimits(maxiter=MAX_GENERATIONS) 55 solver.Solve(costfunction, strategy, termination,\ 56 CrossProbability=self.probability, \ 57 ScalingFactor=self.scale) 56 58 self.solution = solver.Solution() 57 59 return -
mystic/examples/example_getCost.py
r95 r111 34 34 solver.SetRandomInitialPoints(min = minrange, max = maxrange) 35 35 solver.SetStrictRanges(min = minrange, max = maxrange) 36 solver.SetEvaluationLimits(maxiter=MAX_GENERATIONS) 36 37 37 38 solver.Solve(CF,Best1Exp,termination=ChangeOverGeneration(generations=300),\ 38 maxiter=MAX_GENERATIONS,CrossProbability=0.5,ScalingFactor=0.5,\39 CrossProbability=0.5,ScalingFactor=0.5,\ 39 40 StepMonitor=stepmon,sigint_callback=plot_sol) 40 41 -
mystic/examples/test_br8.py
r95 r111 67 67 solver.SetRandomInitialPoints(min=minrange,max=maxrange) 68 68 solver.SetStrictRanges(min=minrange, max=maxrange) 69 solver.SetEvaluationLimits(maxiter=MAX_GENERATIONS) 69 70 solver.Solve(CF,Best1Exp,termination=ChangeOverGeneration(generations=50),\ 70 maxiter=MAX_GENERATIONS,StepMonitor=stepmon)71 StepMonitor=stepmon) 71 72 solution = solver.Solution() 72 73 return solution, stepmon -
mystic/examples/test_circle.py
r108 r111 49 49 solver.enable_signal_handler() 50 50 solver.SetRandomInitialPoints(min=minrange,max=maxrange) 51 solver.Solve(cost, Best1Exp, \ 52 termination=ChangeOverGeneration(generations=100), \ 53 maxiter=MAX_GENERATIONS) 51 solver.SetEvaluationLimits(maxiter=MAX_GENERATIONS) 52 solver.Solve(cost, Best1Exp, termination=ChangeOverGeneration(generations=100)) 54 53 55 54 -
mystic/examples/test_corana.py
r106 r111 31 31 32 32 solver.SetRandomInitialPoints(min = [-1000]*ND, max = [1000]*ND) 33 solver.SetEvaluationLimits(maxiter=MAX_GENERATIONS) 33 34 34 35 solver.Solve(Corana, Rand1Exp, termination = VTR(0.00000001) , \ 35 maxiter= MAX_GENERATIONS,CrossProbability=0.5, ScalingFactor=0.9)36 CrossProbability=0.5, ScalingFactor=0.9) 36 37 37 38 solution = solver.Solution() -
mystic/examples/test_dejong3.py
r97 r111 32 32 33 33 solver.SetRandomInitialPoints(min = [-5.12]*ND, max = [5.12]*ND) 34 solver.SetEvaluationLimits(maxiter=MAX_GENERATIONS) 34 35 35 36 solver.Solve(DeJong3, Best1Exp, termination = VTR(0.00001) , \ 36 maxiter= MAX_GENERATIONS,CrossProbability=0.3, ScalingFactor=1.0)37 CrossProbability=0.3, ScalingFactor=1.0) 37 38 38 39 solution = solver.Solution() -
mystic/examples/test_dejong4.py
r97 r111 31 31 32 32 solver.SetRandomInitialPoints(min = [-1.28]*ND, max = [1.28]*ND) 33 solver.SetEvaluationLimits(maxiter=MAX_GENERATIONS) 33 34 34 35 solver.Solve(DeJong4, Rand1Exp, termination = VTR(15) , \ 35 maxiter= MAX_GENERATIONS,CrossProbability=0.3, ScalingFactor=1.0)36 CrossProbability=0.3, ScalingFactor=1.0) 36 37 37 38 solution = solver.Solution() -
mystic/examples/test_dejong5.py
r95 r111 29 29 30 30 solver.SetRandomInitialPoints(min = [-65.536]*ND, max = [65.536]*ND) 31 solver.SetEvaluationLimits(maxiter=MAX_GENERATIONS) 31 32 32 33 solver.Solve(DeJong5, Rand1Exp, termination = VTR(0.0000001) , \ 33 maxiter= MAX_GENERATIONS,CrossProbability=0.5, ScalingFactor=0.9)34 CrossProbability=0.5, ScalingFactor=0.9) 34 35 35 36 solution = solver.Solution() -
mystic/examples/test_ffit.py
r109 r111 63 63 def main(): 64 64 solver = DifferentialEvolutionSolver(ND, NP) 65 66 65 solver.SetRandomInitialPoints(min = [-100.0]*ND, max = [100.0]*ND) 67 66 solver.SetEvaluationLimits(maxiter=MAX_GENERATIONS) 68 67 solver.enable_signal_handler() 69 68 … … 72 71 73 72 solver.Solve(ChebyshevCost, strategy, termination = VTR(0.01) , \ 74 maxiter= MAX_GENERATIONS, CrossProbability=1.0, ScalingFactor=0.9 , \ 75 StepMonitor=VerboseSow(30), sigint_callback = plot_solution \ 76 ) 73 CrossProbability=1.0, ScalingFactor=0.9 , \ 74 StepMonitor=VerboseSow(30), sigint_callback=plot_solution) 77 75 78 76 solution = solver.Solution() 79 80 77 return solution 81 78 -
mystic/examples/test_ffit2.py
r98 r111 40 40 def main(): 41 41 solver = DifferentialEvolutionSolver(ND, NP) 42 43 42 solver.SetRandomInitialPoints(min = [-1000.0]*ND, max = [1000.0]*ND) 43 solver.SetEvaluationLimits(maxiter=MAX_GENERATIONS) 44 44 45 45 #strategy = Best1Exp … … 49 49 50 50 solver.Solve(ChebyshevCost, strategy, termination = VTR(0.0001) , \ 51 StepMonitor=VerboseSow(1), maxiter= MAX_GENERATIONS,CrossProbability=1.0, ScalingFactor=0.6)51 StepMonitor=VerboseSow(1), CrossProbability=1.0, ScalingFactor=0.6) 52 52 53 53 solution = solver.Solution() -
mystic/examples/test_ffitB.py
r110 r111 18 18 19 19 solver = DifferentialEvolutionSolver(ND, NP) 20 21 20 solver.SetRandomInitialPoints(min = [-100.0]*ND, max = [100.0]*ND) 22 21 solver.SetEvaluationLimits(maxiter=MAX_GENERATIONS) 23 22 solver.enable_signal_handler() 24 23 … … 27 26 28 27 solver.Solve(ChebyshevCost, strategy, termination = VTR(0.01) , \ 29 maxiter= MAX_GENERATIONS, CrossProbability=1.0, ScalingFactor=0.9 , \ 30 StepMonitor=VerboseSow(30), sigint_callback = plot_solution \ 31 ) 28 CrossProbability=1.0, ScalingFactor=0.9 , \ 29 StepMonitor=VerboseSow(30), sigint_callback=plot_solution) 32 30 33 31 solution = solver.Solution() -
mystic/examples/test_fosc3d.py
r106 r111 33 33 def main(): 34 34 solver = DifferentialEvolutionSolver(ND, NP) 35 36 35 solver.SetRandomInitialPoints(min = [-2.0]*ND, max = [2.0]*ND) 36 solver.SetEvaluationLimits(maxiter=MAX_GENERATIONS) 37 37 38 38 strategy = Best1Exp … … 40 40 41 41 solver.Solve(fOsc3D,strategy,termination=ChangeOverGeneration(1e-5, 30), \ 42 maxiter=MAX_GENERATIONS,CrossProbability=1.0,ScalingFactor=0.9)42 CrossProbability=1.0,ScalingFactor=0.9) 43 43 44 44 return solver.Solution() -
mystic/examples/test_griewangk.py
r97 r111 30 30 def main(): 31 31 solver = DifferentialEvolutionSolver(ND, NP) 32 33 32 solver.SetRandomInitialPoints(min = [-400.0]*ND, max = [400.0]*ND) 33 solver.SetEvaluationLimits(maxiter=MAX_GENERATIONS) 34 34 35 35 solver.Solve(Griewangk_cost, Rand1Exp, termination = VTR(0.00001) , \ 36 maxiter= MAX_GENERATIONS,CrossProbability=0.3, ScalingFactor=1.0)36 CrossProbability=0.3, ScalingFactor=1.0) 37 37 38 38 solution = solver.Solution() -
mystic/examples/test_lorentzian.py
r94 r111 55 55 solver.SetRandomInitialPoints(min=minrange,max=maxrange) 56 56 solver.SetStrictRanges(min=minrange,max=maxrange) 57 solver.SetEvaluationLimits(maxiter=MAX_GENERATIONS) 57 58 termination=ChangeOverGeneration(generations=generations) 58 59 solver.Solve(CF, Rand1Exp, termination=termination, \ 59 maxiter=MAX_GENERATIONS,StepMonitor=stepmon, sigint_callback = plot_sol(solver))60 StepMonitor=stepmon, sigint_callback = plot_sol(solver)) 60 61 solution = solver.Solution() 61 62 return solution, stepmon -
mystic/examples/test_lorentzian2.py
r95 r111 56 56 solver.SetRandomInitialPoints(min=minrange,max=maxrange) 57 57 solver.SetStrictRanges(min=minrange,max=maxrange) 58 solver.SetEvaluationLimits(maxiter=MAX_GENERATIONS) 58 59 termination=ChangeOverGeneration(generations=generations) 59 60 solver.Solve(CF, Rand1Exp, termination=termination, \ 60 maxiter=MAX_GENERATIONS,StepMonitor=stepmon, sigint_callback = plot_sol(solver))61 StepMonitor=stepmon, sigint_callback = plot_sol(solver)) 61 62 solution = solver.Solution() 62 63 return solution, stepmon -
mystic/examples/test_mogi.py
r102 r111 87 87 maxrange = [1000., 1000., 100., 10.]; 88 88 solver.SetRandomInitialPoints(min = minrange, max = maxrange) 89 solver.SetEvaluationLimits(maxiter=MAX_GENERATIONS) 89 90 90 91 #termination = VTR(0.0000029) … … 92 93 93 94 solver.Solve(cost_function, Best1Exp, termination=termination, \ 94 maxiter=MAX_GENERATIONS, CrossProbability=0.5, \ 95 ScalingFactor=0.5, StepMonitor = stepmon) 95 CrossProbability=0.5, ScalingFactor=0.5, StepMonitor=stepmon) 96 96 97 97 solution = solver.Solution() -
mystic/examples/test_mogi2.py
r88 r111 75 75 maxrange = [1000., 1000., 100., 1.]*2; 76 76 solver.SetRandomInitialPoints(min = minrange, max = maxrange) 77 solver.SetEvaluationLimits(maxiter=MAX_GENERATIONS) 77 78 78 solver.Solve(cost_function, Best1Exp, termination = ChangeOverGeneration(generations=300) , \ 79 maxiter= MAX_GENERATIONS, CrossProbability=0.5, ScalingFactor=0.5, \ 79 solver.Solve(cost_function, Best1Exp,\ 80 termination = ChangeOverGeneration(generations=300) , \ 81 CrossProbability=0.5, ScalingFactor=0.5, \ 80 82 StepMonitor = stepmon, sigint_callback = plot_sol) 81 83 -
mystic/examples/test_mogi3.py
r94 r111 19 19 maxrange = [1000., 1000., 100., 10.]; 20 20 solver.SetRandomInitialPoints(min = minrange, max = maxrange) 21 solver.SetEvaluationLimits(maxiter=MAX_GENERATIONS) 21 22 22 solver.Solve(CF, Best1Exp, termination = ChangeOverGeneration(generations=100) , \ 23 maxiter= MAX_GENERATIONS, CrossProbability=0.5, ScalingFactor=0.5, \ 23 solver.Solve(CF, Best1Exp,\ 24 termination = ChangeOverGeneration(generations=100) , \ 25 CrossProbability=0.5, ScalingFactor=0.5, \ 24 26 StepMonitor = stepmon) 25 27 -
mystic/examples/test_mogi4.py
r95 r111 23 23 maxrange = [1000., 1000., 100., 1.]*2; 24 24 solver.SetRandomInitialPoints(min = minrange, max = maxrange) 25 solver.SetEvaluationLimits(maxiter=MAX_GENERATIONS) 25 26 26 solver.Solve(CF, Best1Exp, termination = ChangeOverGeneration(generations=300) , \ 27 maxiter= MAX_GENERATIONS, CrossProbability=0.5, ScalingFactor=0.5, \ 27 solver.Solve(CF, Best1Exp,\ 28 termination = ChangeOverGeneration(generations=300) , \ 29 CrossProbability=0.5, ScalingFactor=0.5, \ 28 30 StepMonitor = stepmon, sigint_callback = plot_sol) 29 31 -
mystic/examples/test_rosenbrock.py
r102 r111 30 30 31 31 solver.SetRandomInitialPoints(min = [0]*ND, max = [2]*ND) 32 solver.SetEvaluationLimits(maxiter=MAX_GENERATIONS) 32 33 33 34 solver.Solve(rosen, Best1Exp, termination = VTR(0.0001) , \ 34 maxiter= MAX_GENERATIONS,CrossProbability=0.5, ScalingFactor=0.6)35 CrossProbability=0.5, ScalingFactor=0.6) 35 36 36 37 solution = solver.Solution() -
mystic/examples/test_wavy.py
r106 r111 46 46 def main(): 47 47 solver = DifferentialEvolutionSolver(ND, NP) 48 49 48 solver.SetRandomInitialPoints(min = [-100.0]*ND, max = [100.0]*ND) 49 solver.SetEvaluationLimits(maxiter=MAX_GENERATIONS) 50 50 51 51 solver.enable_signal_handler() 52 52 53 53 strategy = Best1Bin 54 55 54 stepmon = VerboseSow(1) 56 solver.Solve(wavy, strategy, termination = ChangeOverGeneration(generations=50) ,\57 maxiter= MAX_GENERATIONS, CrossProbability=1.0, ScalingFactor=0.9, \58 StepMonitor = stepmon, sigint_callback = plot_solution\59 )55 solver.Solve(wavy, strategy,\ 56 termination = ChangeOverGeneration(generations=50) , \ 57 CrossProbability=1.0, ScalingFactor=0.9 , \ 58 StepMonitor = stepmon, sigint_callback = plot_solution) 60 59 61 60 solution = solver.Solution() -
mystic/examples/test_zimmermann.py
r102 r111 34 34 35 35 solver.SetRandomInitialPoints(min = [0.]*ND, max = [5.]*ND) 36 solver.SetEvaluationLimits(maxiter=MAX_GENERATIONS) 36 37 37 38 solver.Solve(CostFunction, Rand1Exp, termination = VTR(0.0000001) , \ 38 maxiter= MAX_GENERATIONS,CrossProbability=0.3, ScalingFactor=1.0)39 CrossProbability=0.3, ScalingFactor=1.0) 39 40 40 41 solution = solver.Solution() -
mystic/mystic/abstract_solver.py
r105 r111 49 49 self._strictMin = [] 50 50 self._strictMax = [] 51 self._maxiter = None 52 self._maxfun = None 51 53 52 54 … … 152 154 self._handle_sigint = False 153 155 154 def Solve(self, func, termination, 155 maxiter=None, maxfun=None, sigint_callback=None, 156 def SetEvaluationLimits(self,*args,**kwds): 157 """set limits for maxiter and/or maxfun 158 - maxiter = maximum number of solver iterations (i.e. steps) 159 - maxfun = maximum number of function evaluations""" 160 #self._maxiter,self._maxfun = None,None 161 if len(args) == 2: 162 self._maxiter,self._maxfun = args[0],args[1] 163 elif len(args) == 1: 164 self._maxiter = args[0] 165 if kwds.has_key('maxiter'): self._maxiter = kwds['maxiter'] 166 if kwds.has_key('maxfun'): self._maxfun = kwds['maxfun'] 167 168 def Solve(self, func, termination, sigint_callback=None, 156 169 EvaluationMonitor=Null, StepMonitor=Null, ExtraArgs=(), **kwds): 157 170 """solve function 'func' with given termination conditions -
mystic/mystic/differential_evolution.py
r110 r111 89 89 return 90 90 91 def Solve(self, costfunction, strategy, termination, 92 maxiter=None, maxfun=None, sigint_callback=None, 91 def Solve(self, costfunction, strategy, termination, sigint_callback=None, 93 92 CrossProbability = 0.5, ScalingFactor = 0.7, 94 93 EvaluationMonitor=Null, StepMonitor=Null, ExtraArgs=(), **kwds): … … 163 162 self.bestEnergy = 1.0E20 164 163 165 if maxiter is None: 166 maxiter = self.nDim * self.nPop * 10 #XXX: set better defaults? 167 if maxfun is None: 168 maxfun = self.nDim * self.nPop * 1000 #XXX: set better defaults? 169 self._maxiter = maxiter 170 self._maxfun = maxfun 164 if self._maxiter is None: 165 self._maxiter = self.nDim * self.nPop * 10 #XXX: set better defaults? 166 if self._maxfun is None: 167 self._maxfun = self.nDim * self.nPop * 1000 #XXX: set better defaults? 171 168 172 169 generation = 0 173 for generation in range( maxiter):170 for generation in range(self._maxiter): 174 171 StepMonitor(self.bestSolution[:], self.bestEnergy) 175 if fcalls[0] >= maxfun: break172 if fcalls[0] >= self._maxfun: break 176 173 for candidate in range(self.nPop): 177 174 # generate trialSolution (within valid range) … … 221 218 generation is invariant during the main DE logic. 222 219 """ 223 def Solve(self, costfunction, strategy, termination, 224 maxiter=None, maxfun=None, sigint_callback=None, 220 def Solve(self, costfunction, strategy, termination, sigint_callback=None, 225 221 CrossProbability = 0.5, ScalingFactor = 0.7, 226 222 EvaluationMonitor=Null, StepMonitor=Null, ExtraArgs=(), **kwds): … … 293 289 self.bestEnergy = 1.0E20 294 290 295 if maxiter is None: 296 maxiter = self.nDim * self.nPop * 10 #XXX: set better defaults? 297 if maxfun is None: 298 maxfun = self.nDim * self.nPop * 1000 #XXX: set better defaults? 299 self._maxiter = maxiter 300 self._maxfun = maxfun 301 291 if self._maxiter is None: 292 self._maxiter = self.nDim * self.nPop * 10 #XXX: set better defaults? 293 if self._maxfun is None: 294 self._maxfun = self.nDim * self.nPop * 1000 #XXX: set better defaults? 302 295 trialPop = [[0.0 for i in range(self.nDim)] for j in range(self.nPop)] 303 296 304 297 generation = 0 305 for generation in range( maxiter):298 for generation in range(self._maxiter): 306 299 StepMonitor(self.bestSolution[:], self.bestEnergy) 307 if fcalls[0] >= maxfun: break300 if fcalls[0] >= self._maxfun: break 308 301 for candidate in range(self.nPop): 309 302 # generate trialSolution (within valid range) … … 361 354 ND = len(x0) 362 355 solver = DifferentialEvolutionSolver2(ND,npop) 356 solver.SetEvaluationLimits(maxiter,maxfun) 363 357 if bounds: 364 358 minb,maxb = unpair(bounds) … … 372 366 373 367 #solver.enable_signal_handler() 374 #XXX: move maxiter & maxfun kwds from Solve() to solver.SetLimits() ?375 368 #TODO: enable signal handlers & sigint_callbacks? for all minimal interfaces 376 369 #FIXME: DESolve can't handle bounds of numpy.inf 377 370 solver.Solve(func,strategy=strategy,termination=termination,\ 378 maxiter=maxiter,maxfun=maxfun,\371 #sigint_callback=other_callback,\ 379 372 CrossProbability=cross,ScalingFactor=scale,\ 380 373 EvaluationMonitor=evalmon,StepMonitor=stepmon,\ 381 #sigint_callback=other_callback,\382 374 ExtraArgs=args,callback=callback) 383 375 solution = solver.Solution() -
mystic/mystic/scipy_optimize.py
r109 r111 95 95 return x0, val 96 96 97 def Solve(self, func, termination, 98 maxiter=None, maxfun=None, sigint_callback=None, 97 def Solve(self, func, termination, sigint_callback=None, 99 98 EvaluationMonitor=Null, StepMonitor=Null, ExtraArgs=(), **kwds): 100 99 """Minimize a function using the downhill simplex algorithm. … … 112 111 Additional Inputs: 113 112 114 maxiter -- the maximum number of iterations to perform.115 maxfun -- the maximum number of function evaluations.116 113 sigint_callback -- callback function for signal handler. 117 114 EvaluationMonitor -- a callable object that will be passed x, fval … … 193 190 if not -1 < rank < 2: 194 191 raise ValueError, "Initial guess must be a scalar or rank-1 sequence." 195 if maxiter is None: 196 maxiter = N * 200 197 if maxfun is None: 198 maxfun = N * 200 199 self._maxiter = maxiter #XXX: better to just copy the code? 200 self._maxfun = maxfun #XXX: better to just copy the code? 192 if self._maxiter is None: 193 self._maxiter = N * 200 194 if self._maxfun is None: 195 self._maxfun = N * 200 201 196 202 197 rho = 1; chi = 2; psi = 0.5; sigma = 0.5; … … 235 230 iterations = 1 236 231 237 while (fcalls[0] < maxfun and iterations <maxiter):232 while (fcalls[0] < self._maxfun and iterations < self._maxiter): 238 233 StepMonitor(sim, fsim) # get all values; "best" is sim[0] 239 234 if detools.EARLYEXIT or termination(self): … … 309 304 warnflag = 0 310 305 311 if fcalls[0] >= maxfun:306 if fcalls[0] >= self._maxfun: 312 307 warnflag = 1 313 308 if disp: 314 309 print "Warning: Maximum number of function evaluations has "\ 315 310 "been exceeded." 316 elif iterations >= maxiter:311 elif iterations >= self._maxiter: 317 312 warnflag = 2 318 313 if disp: … … 350 345 solver.SetInitialPoints(x0) 351 346 #solver.enable_signal_handler() 347 solver.SetEvaluationLimits(maxiter,maxfun) 352 348 solver.Solve(func,termination=CRT(xtol,ftol),\ 353 maxiter=maxiter,maxfun=maxfun,\354 349 EvaluationMonitor=evalmon,StepMonitor=stepmon,\ 355 350 disp=disp, ExtraArgs=args, callback=callback) … … 411 406 412 407 413 def Solve(self, func, termination, 414 maxiter=None, maxfun=None, sigint_callback=None, 408 def Solve(self, func, termination, sigint_callback=None, 415 409 EvaluationMonitor=Null, StepMonitor=Null, ExtraArgs=(), **kwds): 416 410 """Minimize a function using modified Powell's method. … … 428 422 Additional Inputs: 429 423 430 maxiter -- the maximum number of iterations to perform.431 maxfun -- the maximum number of function evaluations.432 424 sigint_callback -- callback function for signal handler. 433 425 EvaluationMonitor -- a callable object that will be passed x, fval … … 515 507 if not -1 < rank < 2: 516 508 raise ValueError, "Initial guess must be a scalar or rank-1 sequence." 517 if maxiter is None: 518 maxiter = N * 1000 519 if maxfun is None: 520 maxfun = N * 1000 521 self._maxiter = maxiter #XXX: better to just copy the code? 522 self._maxfun = maxfun #XXX: better to just copy the code? 509 if self._maxiter is None: 510 self._maxiter = N * 1000 511 if self._maxfun is None: 512 self._maxfun = N * 1000 523 513 524 514 if direc is None: … … 561 551 self.energy_history.append(fval) #XXX: the 'best' for now... 562 552 if detools.EARLYEXIT or termination(self): CONTINUE = False #break 563 elif fcalls[0] >= maxfun: CONTINUE = False #break564 elif iter >= maxiter: CONTINUE = False #break553 elif fcalls[0] >= self._maxfun: CONTINUE = False #break 554 elif iter >= self._maxiter: CONTINUE = False #break 565 555 566 556 else: # Construct the extrapolated point … … 596 586 warnflag = 0 597 587 598 if fcalls[0] >= maxfun:588 if fcalls[0] >= self._maxfun: 599 589 warnflag = 1 600 590 if disp: 601 591 print "Warning: Maximum number of function evaluations has "\ 602 592 "been exceeded." 603 elif iter >= maxiter:593 elif iter >= self._maxiter: 604 594 warnflag = 2 605 595 if disp: … … 642 632 solver.SetInitialPoints(x0) 643 633 #solver.enable_signal_handler() 634 solver.SetEvaluationLimits(maxiter,maxfun) 644 635 solver.Solve(func,termination=NCOG(ftol),\ 645 maxiter=maxiter,maxfun=maxfun,\646 636 EvaluationMonitor=evalmon,StepMonitor=stepmon,\ 647 637 xtol=xtol, ExtraArgs=args, callback=callback, \
Note: See TracChangeset
for help on using the changeset viewer.