def moo(paras: List, hyperparameter: Dict, constants: Dict, paths: Dict): init() # define problem. problem = Problem(num_of_variables=len(paras), objectives=[f1, f2, f3], variables_range=paras, preamble=JizhunPreamble(constants=constants, paths=paths)) evo = Evolution( problem, mutation_param=hyperparameter["MUTATION_PARAM"], num_of_generations=hyperparameter["NUM_OF_GENERATIONS"], num_of_individuals=hyperparameter["NUM_OF_INDIVIDUALS"], num_of_tour_particips=hyperparameter["NUM_OF_TOUR_PARTICIPS"], concurrency=hyperparameter["CONCURRENCY"], max_proc=hyperparameter["MAX_PROC"]) # draw the last one with 3d box. func = [i.objectives for i in evo.evolve()] obj1 = [i[0] for i in func] obj2 = [i[1] for i in func] obj3 = [i[2] for i in func] fig = plt.figure() ax = fig.add_subplot(111, projection='3d') ax.scatter(obj1, obj2, obj3, c='r', marker='o') plt.draw() plt.savefig('results/epMOO_fig.png') plt.show() print("<Finished>{}".format(time.ctime()))
def moo_run(paras, hyperparameter, constants, paths): """The main entrance of the optimizer.""" init() problem = Problem(num_of_variables=len(paras), objectives=[f1, f2, f3], variables_range=paras, preamble=Wkx2132Preamble(constants=constants, paths=paths)) evo = Evolution( problem, mutation_param=hyperparameter["MUTATION_PARAM"], num_of_generations=hyperparameter["NUM_OF_GENERATIONS"], num_of_individuals=hyperparameter["NUM_OF_INDIVIDUALS"], num_of_tour_particips=hyperparameter["NUM_OF_TOUR_PARTICIPS"], concurrency=hyperparameter["CONCURRENCY"], max_proc=hyperparameter["MAX_PROC"]) # draw the last one with 3d box. func = [i.objectives for i in evo.evolve()] obj1 = [i[0] for i in func] obj2 = [i[1] for i in func] obj3 = [i[2] for i in func] fig = plt.figure() ax = fig.add_subplot(111, projection='3d') ax.scatter(obj1, obj2, obj3, c='r', marker='o') plt.draw() plt.savefig('results/epMOO_fig.png') plt.show() print("<Finished in {}, your patient is impressive, Congrads! Author: Jimmy Yao; From github.com/jummy233/epMOO>".format(time.ctime()))