def non_dominated(self): """Fix this. check if nd2 and nds mean the same thing""" obj = self.objectives num_obj = obj.shape[1] if num_obj == 2: non_dom_front = nd2(obj) else: non_dom_front = nds(obj) if isinstance(non_dom_front, tuple): self.non_dom = self.objectives[non_dom_front[0][0]] elif isinstance(non_dom_front, np.ndarray): self.non_dom = self.objectives[non_dom_front] else: print("Non Dom error Line 285 in population.py") return non_dom_front
from pyDOE import lhs from desdeo_emo.EAs.RVEA import RVEA, oRVEA, robust_RVEA from pygmo import non_dominated_front_2d as nd2 problem_names = ["ZDT1", "ZDT2", "ZDT3", "ZDT4", "ZDT6"] num_var = {"ZDT1": 30, "ZDT2": 30, "ZDT3": 30, "ZDT4": 10, "ZDT6": 10} for problem_name in problem_names: prob = test_problem_builder(problem_name) x = lhs(num_var[problem_name], 250) y = prob.evaluate(x) data_pareto = nd2(y.objectives) data_pareto = y.objectives[data_pareto] x_names = [f"x{i}" for i in range(1, num_var[problem_name] + 1)] y_names = ["f1", "f2"] 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():