Changeset 636


Ignore:
Timestamp:
01/06/13 20:11:37 (3 years ago)
Author:
mmckerns
Message:

fix: all methods for initial populations produce a nested list of lists;
this is a partial fix of ticket #203

Location:
mystic/mystic
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • mystic/mystic/abstract_solver.py

    r633 r636  
    323323        self.SetRandomInitialPoints(min,max) 
    324324        #stick initial values in population[i], i=0 
    325         self.population[0] = x0 #FIXME: 0 is array, 1: is list 
     325        self.population[0] = x0.tolist() 
    326326     
    327327    def SetRandomInitialPoints(self, min=None, max=None): 
     
    344344        #generate random initial values 
    345345        for i in range(len(self.population)): 
    346             for j in range(self.nDim): #FIXME: 0: are lists 
     346            for j in range(self.nDim): 
    347347                self.population[i][j] = random.uniform(min[j],max[j]) 
    348348 
     
    368368            else: 
    369369                var = var * numpy.eye(self.nDim) 
    370         for i in range(len(self.population)): #FIXME: 0: are lists 
     370        for i in range(len(self.population)): 
    371371            self.population[i] = multivariate_normal(mean, var).tolist() 
    372372        return 
  • mystic/mystic/differential_evolution.py

    r634 r636  
    145145from abstract_map_solver import AbstractMapSolver 
    146146 
     147from numpy import asfarray 
     148 
    147149class DifferentialEvolutionSolver(AbstractSolver): 
    148150    """ 
     
    222224        """ 
    223225        #allow for inputs that don't conform to AbstractSolver interface 
     226        self.population[0] = asfarray(self.population[0]) 
    224227        from mystic.strategy import Best1Bin 
    225228        strategy=Best1Bin    #mutation strategy (see mystic.strategy) 
     
    402405        """ 
    403406        #allow for inputs that don't conform to AbstractSolver interface 
     407        self.population[0] = asfarray(self.population[0]) 
    404408        from mystic.strategy import Best1Bin 
    405409        strategy=Best1Bin    #mutation strategy (see mystic.strategy) 
Note: See TracChangeset for help on using the changeset viewer.