Changeset 231


Ignore:
Timestamp:
05/15/10 00:56:08 (6 years ago)
Author:
mmckerns
Message:

merged pp version of DESolver from ppmystic, and examples

Location:
mystic
Files:
2 edited
4 copied

Legend:

Unmodified
Added
Removed
  • mystic/examples/TEST_ffitPP.py

    r157 r231  
    1515 
    1616def 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 
    1819 
    19     solver = DifferentialEvolutionSolver(ND, NP) 
     20    solver = DifferentialEvolutionSolver2(ND, NP) 
     21    solver.SetMapper(pp_map) 
    2022    solver.SetRandomInitialPoints(min = [-100.0]*ND, max = [100.0]*ND) 
    2123    solver.SetEvaluationLimits(maxiter=MAX_GENERATIONS) 
  • mystic/examples/TEST_ffitPP_b.py

    r181 r231  
    4242 
    4343def 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 
    4546 
    46     solver = DifferentialEvolutionSolver(ND, NP) 
     47    solver = DifferentialEvolutionSolver2(ND, NP) 
     48    solver.SetMapper(pp_map) 
    4749    solver.SetRandomInitialPoints(min = [-100.0]*ND, max = [100.0]*ND) 
    4850    solver.SetEvaluationLimits(maxiter=MAX_GENERATIONS) 
     
    5254    #strategy = Best1Bin 
    5355 
    54     solver.SelectComputeServers(servers,ncpus) 
     56    solver.SelectServers(servers,ncpus) 
    5557    solver.Solve(ChebyshevCost, termination=VTR(0.01), strategy=strategy, \ 
    5658                 CrossProbability=1.0, ScalingFactor=0.9 , \ 
     
    6567 
    6668    # 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,... 
    6870 
    6971    import sys 
  • mystic/mystic/abstract_map_solver.py

    r227 r231  
    120120        self._queue           = defaults['queue'] # scheduler_queue 
    121121        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 
    124126        return 
    125127 
     
    133135 
    134136    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'. 
    136138 
    137139Inputs: 
  • mystic/mystic/differential_evolution.py

    r226 r231  
    434434        #------------------------------------------------------------- 
    435435 
    436         # 'map' is read from self._map  #FIXME: delete this line 
    437  
    438436        import signal 
    439437        self._EARLYEXIT = False 
    440438 
     439       #FIXME: EvaluationMonitor fails for MPI, throws error for 'pp'? 
    441440       #fcalls = [0] #FIXME: temporary patch for removing the following line 
    442441        fcalls, costfunction = wrap_function(costfunction, ExtraArgs, EvaluationMonitor) 
     
    467466        mapconfig = dict(nnodes=self._nnodes, launcher=self._launcher, \ 
    468467                         mapper=self._mapper, queue=self._queue, \ 
    469                          timelimit=self._timelimit) 
     468                         timelimit=self._timelimit, \ 
     469                         ncpus=self._ncpus, servers=self._servers) 
    470470        trialEnergy = self._map(costfunction, trialPop, **mapconfig) 
    471471 
     
    483483                         
    484484        self.energy_history.append(self.bestEnergy) 
     485       #FIXME: StepMonitor throws error for 'pp'? 
    485486        StepMonitor(self.bestSolution[:], self.bestEnergy) 
    486487        self.generations = 0  #XXX: above currently *not* counted as an iteration 
     
    524525                             
    525526            self.energy_history.append(self.bestEnergy) 
     527           #FIXME: StepMonitor throws error for 'pp'? 
    526528            StepMonitor(self.bestSolution[:], self.bestEnergy) 
    527529            self.generations += 1 
Note: See TracChangeset for help on using the changeset viewer.