Changeset 231
- Timestamp:
- 05/15/10 00:56:08 (6 years ago)
- Location:
- mystic
- Files:
-
- 2 edited
- 4 copied
Legend:
- Unmodified
- Added
- Removed
-
mystic/examples/TEST_ffitPP.py
r157 r231 15 15 16 16 def main(): 17 from mystic.differential_evolution import PPDESolver as DifferentialEvolutionSolver 17 from mystic.differential_evolution import DifferentialEvolutionSolver2 18 from pyina.pp_map import pp_map 18 19 19 solver = DifferentialEvolutionSolver(ND, NP) 20 solver = DifferentialEvolutionSolver2(ND, NP) 21 solver.SetMapper(pp_map) 20 22 solver.SetRandomInitialPoints(min = [-100.0]*ND, max = [100.0]*ND) 21 23 solver.SetEvaluationLimits(maxiter=MAX_GENERATIONS) -
mystic/examples/TEST_ffitPP_b.py
r181 r231 42 42 43 43 def main(servers,ncpus): 44 from mystic.differential_evolution import PPDESolver as DifferentialEvolutionSolver 44 from mystic.differential_evolution import DifferentialEvolutionSolver2 45 from pyina.pp_map import pp_map 45 46 46 solver = DifferentialEvolutionSolver(ND, NP) 47 solver = DifferentialEvolutionSolver2(ND, NP) 48 solver.SetMapper(pp_map) 47 49 solver.SetRandomInitialPoints(min = [-100.0]*ND, max = [100.0]*ND) 48 50 solver.SetEvaluationLimits(maxiter=MAX_GENERATIONS) … … 52 54 #strategy = Best1Bin 53 55 54 solver.Select ComputeServers(servers,ncpus)56 solver.SelectServers(servers,ncpus) 55 57 solver.Solve(ChebyshevCost, termination=VTR(0.01), strategy=strategy, \ 56 58 CrossProbability=1.0, ScalingFactor=0.9 , \ … … 65 67 66 68 # number of local processors 67 ncpus = None #XXX: None ->autodetect; otherwise select n=0,1,2,...69 ncpus = 'autodetect' #XXX: None == autodetect; otherwise select n=0,1,2,... 68 70 69 71 import sys -
mystic/mystic/abstract_map_solver.py
r227 r231 120 120 self._queue = defaults['queue'] # scheduler_queue 121 121 self._timelimit = defaults['timelimit'] 122 self._servers = ('*',) # hostname:port 123 self._ncpus = None 122 self._servers = ('*',) #<detect> # hostname:port 123 self._ncpus = None #<detect> # local processors 124 #self._servers = () #<None> # hostname:port 125 #self._ncpus = 0 #<None> # local processors 124 126 return 125 127 … … 133 135 134 136 If ncpus=None, then 'autodetect'; or if ncpus=0, then 'no local'. 135 If servers=('*',), then 'autodetect' .137 If servers=('*',), then 'autodetect'; or if servers=(), then 'no remote'. 136 138 137 139 Inputs: -
mystic/mystic/differential_evolution.py
r226 r231 434 434 #------------------------------------------------------------- 435 435 436 # 'map' is read from self._map #FIXME: delete this line437 438 436 import signal 439 437 self._EARLYEXIT = False 440 438 439 #FIXME: EvaluationMonitor fails for MPI, throws error for 'pp'? 441 440 #fcalls = [0] #FIXME: temporary patch for removing the following line 442 441 fcalls, costfunction = wrap_function(costfunction, ExtraArgs, EvaluationMonitor) … … 467 466 mapconfig = dict(nnodes=self._nnodes, launcher=self._launcher, \ 468 467 mapper=self._mapper, queue=self._queue, \ 469 timelimit=self._timelimit) 468 timelimit=self._timelimit, \ 469 ncpus=self._ncpus, servers=self._servers) 470 470 trialEnergy = self._map(costfunction, trialPop, **mapconfig) 471 471 … … 483 483 484 484 self.energy_history.append(self.bestEnergy) 485 #FIXME: StepMonitor throws error for 'pp'? 485 486 StepMonitor(self.bestSolution[:], self.bestEnergy) 486 487 self.generations = 0 #XXX: above currently *not* counted as an iteration … … 524 525 525 526 self.energy_history.append(self.bestEnergy) 527 #FIXME: StepMonitor throws error for 'pp'? 526 528 StepMonitor(self.bestSolution[:], self.bestEnergy) 527 529 self.generations += 1
Note: See TracChangeset
for help on using the changeset viewer.