def generateRandomCandidate(self): candidate = [] for ind in range(self.model.nParams): candidate.append( random.uniform( self.model.parameter_values[self.model.params[ind]]["min"], self.model.parameter_values[ self.model.params[ind]]["max"])) return creator.Candidate(candidate)
def generateCandidate(self): candidate = [] for ind in range(self.model.nParams): #candidate.append(random.uniform(self.model.parameter_values[self.model.params[ind]]["min"], self.model.parameter_values[self.model.params[ind]]["max"])) while True: r = random.normal(param_references[ind],np.min([ np.abs(self.model.parameter_values[self.model.params[ind]]["min"] - param_references[ind]), np.abs(self.model.parameter_values[self.model.params[ind]]["max"] - param_references[ind]) ])/3.0) if r > 0: break candidate.append(r) return creator.Candidate(candidate)