pref_int_rvea.response = pd.DataFrame( [response], columns=pref_int_rvea.content["dimensions_data"].columns ) pref_int_nsga.response = pd.DataFrame( [response], columns=pref_int_nsga.content["dimensions_data"].columns ) pref_nimb_rvea.response = pd.DataFrame( [response], columns=pref_nimb_rvea.content["dimensions_data"].columns, ) pref_nimb_nsga.response = pd.DataFrame( [response], columns=pref_nimb_nsga.content["dimensions_data"].columns, ) a_post_rvea.iterate() a_post_nsga.iterate() _, pref_int_rvea = int_rvea.iterate(pref_int_rvea) _, pref_int_nsga = int_nsga.iterate(pref_int_nsga) _, pref_nimb_rvea = nimb_rvea.iterate(pref_nimb_rvea) _, pref_nimb_nsga = nimb_nsga.iterate(pref_nimb_nsga) scalar_rvea = scalar(a_post_rvea.population.objectives, response) scalar_nsga = scalar(a_post_nsga.population.objectives, response) scalar_irvea = scalar(int_rvea.population.objectives, response) scalar_insga = scalar(int_nsga.population.objectives, response) scalar_nrvea = scalar(nimb_rvea.population.objectives, response) scalar_nnsga = scalar(nimb_nsga.population.objectives, response) norm_rvea = np.linalg.norm(a_post_rvea.population.objectives, axis=1) norm_nsga = np.linalg.norm(a_post_nsga.population.objectives, axis=1)
data = pd.DataFrame(np.hstack((x, y.objectives)), columns=x_names + y_names) problem = DataProblem(data=data, variable_names=x_names, objective_names=y_names) problem.train(LipschitzianRegressor) evolver_L_opt = oRVEA(problem, use_surrogates=True) while evolver_L_opt.continue_evolution(): evolver_L_opt.iterate() evolver_L = RVEA(problem, use_surrogates=True) while evolver_L.continue_evolution(): evolver_L.iterate() evolver_L_robust = robust_RVEA(problem, use_surrogates=True) while evolver_L_robust.continue_evolution(): evolver_L_robust.iterate() problem.train(GaussianProcessRegressor) evolver_G_opt = oRVEA(problem, use_surrogates=True) while evolver_G_opt.continue_evolution(): evolver_G_opt.iterate() evolver_G = RVEA(problem, use_surrogates=True) while evolver_G.continue_evolution(): evolver_G.iterate() evolver_G_robust = robust_RVEA(problem, use_surrogates=True)
n_gen_per_iter=gen) # initial reference point is specified randomly response = np.random.rand(n_obj) # run algorithms once with the randomly generated reference point _, pref_int_rvea = int_rvea.requests() _, pref_int_nsga = int_nsga.requests() pref_int_rvea.response = pd.DataFrame( [response], columns=pref_int_rvea.content["dimensions_data"].columns) pref_int_nsga.response = pd.DataFrame( [response], columns=pref_int_nsga.content["dimensions_data"].columns) _, pref_int_rvea = int_rvea.iterate(pref_int_rvea) _, pref_int_nsga = int_nsga.iterate(pref_int_nsga) # build initial composite front cf = generate_composite_front(int_rvea.population.objectives, int_nsga.population.objectives) # the following two lines for getting pareto front by using pymoo framework problemR = get_problem(problem_name.lower(), n_var, n_obj) ref_dirs = get_reference_directions("das-dennis", n_obj, n_partitions=12) pareto_front = problemR.pareto_front(ref_dirs) # creates uniformly distributed reference vectors reference_vectors = ReferenceVectors(lattice_resolution, n_obj)
f3 = _ScalarObjective(name="f3", evaluator=f_3, maximize=[True]) f4 = _ScalarObjective(name="f4", evaluator=f_4) f5 = _ScalarObjective(name="f5", evaluator=f_5) varsl = variable_builder( ["x_1", "x_2"], initial_values=[0.5, 0.5], lower_bounds=[0.3, 0.3], upper_bounds=[1.0, 1.0], ) problem = MOProblem(variables=varsl, objectives=[f1, f2, f3, f4, f5]) evolver = RVEA(problem, interact=True, n_iterations=10, n_gen_per_iter=100) _, pref = evolver.iterate() n_iteration = 1 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.bind(("10.0.2.15", 5005)) # sock.bind(("127.0.0.1", 5005)) sock.listen(1) print("Waiting for ComVis to connect...") connection, client_addr = sock.accept() print("Connection estabilished!") while True: try: data = connection.recv(2048)
from desdeo_problem.testproblems.TestProblems import test_problem_builder from desdeo_emo.EAs.RVEA import RVEA from desdeo_emo.EAs.NSGAIII import NSGAIII from desdeo_emo.othertools.plotlyanimate import animate_init_, animate_next_ dtlz3 = test_problem_builder("DTLZ3", n_of_variables=12, n_of_objectives=11) evolver = RVEA(dtlz3, n_iterations=10) figure = animate_init_(evolver.population.objectives, filename="dtlz3.html") while evolver.continue_evolution(): evolver.iterate() figure = animate_next_( evolver.population.objectives, figure, filename="dtlz3.html", generation=evolver._iteration_counter, )