def __init__(self, **kwargs): r"""Initialize algorithm and create name for an algorithm. **Arguments**: name {string} -- Full name of algorithm shortName {string} -- Short name of algorithm NP {integer} -- population size D {integer} -- dimension of problem nGEN {integer} -- nuber of generation/iterations nFES {integer} -- number of function evaluations benchmark {object} -- benchmark implementation object task {Task} -- task to perform optimization on **See**: Algorithm.setParameters(self, **kwargs) """ task = kwargs.get('task', None) self.name, self.sName, self.rand = kwargs.get( 'name', 'Algorith'), kwargs.get('sName', 'algo'), RandomState(kwargs.get('seed', 1)) self.task = task if task != None else Task( kwargs.get('D', 10), kwargs.get('nFES', 100000), None, kwargs.get('benchmark', 'ackley')) self.setParameters(**kwargs)
def setUp(self): self.D = 20 self.x, self.task = rnd.uniform(-2, 2, self.D), Task(self.D, 230, None, MyBenchmark()) self.sol1, self.sol2, self.sol3 = MkeSolution(x=self.x), MkeSolution( task=self.task), MkeSolution(x=self.x)
def setUp(self): self.D, self.F, self.CR = 10, 0.9, 0.3 self.x, self.task = rnd.uniform(10, 50, self.D), Task(self.D, 230, None, MyBenchmark()) self.s1, self.s2 = SolutionjDE(task=self.task), SolutionjDE(x=self.x, CR=self.CR, F=self.F)
def __init__(self, **kwargs): r"""Initialize algorithm and create name for an algorithm. **Arguments:** name {string} -- Full name of algorithm shortName {string} -- Short name of algorithm NP {integer} -- population size D {integer} -- dimension of problem nGEN {integer} -- nuber of generation/iterations nFES {integer} -- number of function evaluations benchmark {object} -- benchmark implementation object task {Task} -- task to perform optimization on **Raises:** TypeError -- Raised when given benchmark function which does not exists. **See**: Algorithm.setParameters(self, **kwargs) """ task, self.name, self.sName, self.Rand = kwargs.pop( 'task', None), kwargs.pop('name', 'Algorith'), kwargs.pop( 'sName', 'algo'), rand.RandomState(kwargs.pop('seed', 1)) self.task = task if task != None else Task( kwargs.pop('D', 10), kwargs.pop('nFES', 100000), kwargs.pop('nGEN', None), kwargs.pop('benchmark', 'ackley'), optType=kwargs.pop('optType', OptimizationType.MINIMIZATION)) self.setParameters(**kwargs)
def setUp(self): self.D, self.nFES, self.nGEN = 10, 10, 10 self.t = Task(self.D, self.nFES, self.nGEN, MyBenchmark())
def setUp(self): self.D = 20 self.x, self.task = rnd.uniform(-100, 100, self.D), Task(self.D, 230, None, MyBenchmark()) self.s1, self.s2, self.s3 = Individual(x=self.x), Individual(task=self.task, rand=rnd), Individual(task=self.task)