def objectives(self): model = dtlz(10, 2, 1) print "Calling GA with decs", self.decs calculated_objs = ga( model, self.base_min, self.base_max, self.basepop, self.decs[2], self.decs[3], self.decs[0], self.decs[1] ) #args = (candidates, generation, mutation, crossover) #print "new objs", calculated_objs return calculated_objs
def objectives(self): model = dtlz(10, 2, 1) print "Calling GA with decs", self.decs calculated_objs = ga(model, self.base_min, self.base_max, self.basepop, self.decs[2], self.decs[3], self.decs[0], self.decs[1]) #args = (candidates, generation, mutation, crossover) #print "new objs", calculated_objs return calculated_objs
return fromHell(b_min, b_max, b_pop, population) #return population iter_val = 0 for i in xrange(1): fromHellval = search(iter_val) iter_val += 1 return fromHellval if __name__ == '__main__': num_can = 500 num_gen = 100 p_mut = 5 p_cros = 1 for i in [10, 20, 40]: for j in [2, 4, 6, 8]: for k in [1, 3, 5, 7]: print "GA for model DTLZ ", k, "with decisions = ", i, " objectives = ", j model = dtlz(i, j, k) base_min, base_max = baseline(model) base_pop = basePopulation(model, base_min, base_max) print "GA parameters:", " \n num_can: ", num_can, "\n num_gen: ", num_gen, "\n p_mut: ", p_mut,\ "\n p_cros: ", p_cros print "Divergence Value from Baseline:", ga( model, base_min, base_max, base_pop, num_can, num_gen, p_mut, p_cros) print "-" * 120
def return_basepop(): model = dtlz(10, 2, 1) base_min, base_max = return_baseline() return basePopulation(model, base_min, base_max)
def return_baseline(): model = dtlz(10, 2, 1) return baseline(model)
iter_val = 0 for i in xrange(1): fromHellval = search(iter_val) iter_val += 1 return fromHellval if __name__ == '__main__': num_can = 500 num_gen = 100 p_mut = 5 p_cros = 1 for i in [10, 20, 40]: for j in [2, 4, 6, 8]: for k in [1, 3, 5, 7]: print "GA for model DTLZ ", k, "with decisions = ", i, " objectives = ", j model = dtlz(i, j, k) base_min, base_max = baseline(model) base_pop = basePopulation(model, base_min, base_max ) print "GA parameters:", " \n num_can: ", num_can, "\n num_gen: ", num_gen, "\n p_mut: ", p_mut,\ "\n p_cros: ", p_cros print "Divergence Value from Baseline:", ga(model, base_min, base_max, base_pop, num_can, num_gen, p_mut, p_cros) print "-"*120