2

I have a problem that have multi variable and multi objective, but I'm not sure how to deal with it. The objective is like

def objfunc(individual):
    f1 = 101 * reduce(lambda x,y:x*y, individual[0])
    f2 = ((np.repeat(q.reshape(55,1), 3, axis=1) * mu) *  (np.repeat(dis.reshape(55,1), 3, axis=1)/[v1, v2, v3])).sum()
    return f1, f2

and I define the individual and population as

def uniform(low, up):
    return [[random.randint(low, up)], [random.uniform(0, 1)]]

toolbox.register("attr_float", uniform, BOUND_LOW, BOUND_UP)
toolbox.register("individual", tools.initIterate, creator.Individual, toolbox.attr_float)
toolbox.register("population", tools.initRepeat, list, toolbox.individual)

But this seems not work, any ideas?

mrbean
  • 171
  • 2
  • 15
  • Could you explain how it dysfunctions? Do you get an error message? Is the output not what you would expect? How does the output differ from your expectations? – usernumber Nov 06 '19 at 08:24

0 Answers0