I have been working on 3 objective optimization problem and my goal is to minimize all three functions based on 3 design variables.I have written a python code which works great for 2 objective problem but it doesnt give me non-dominated set of solutions for 3 objective problem and especially when the lower and upper bound looks as such. I need help regarding what needs to be done. I will really appreciate some help. Im attaching the code below
"""CODE""""
from pymoo.core.problem import Problem
import numpy as np
from deap import benchmarks
from pymoo.optimize import minimize
from pymoo.algorithms.moo.nsga2 import NSGA2
from pymoo.factory import get_sampling, get_crossover, get_mutation
class ProblemWrapper(Problem):
def __init__(self):
super().__init__(n_var=3, n_obj=3, xl=np.array([2400,22800,298]), xu=np.array([2500,24700,490]))
def _evaluate(self, designs, out, *args, **kwargs):
res=[]
for design in designs:
res.append(benchmarks.kursawe(design))
out['F'] = np.array(res)
algorithm = NSGA2(pop_size=100,
sampling=get_sampling("real_random"),
crossover=get_crossover("real_sbx", prob=0.9, eta=15),
mutation=get_mutation("real_pm", eta=20),
eliminate_duplicates=True)
stop_criteria = ('n_gen',100)
problem=ProblemWrapper()
res = minimize(problem=problem,
algorithm=algorithm,
termination=stop_criteria,
seed=1,
pf=problem.pareto_front(use_cache=False),
save_history=True
)
from pymoo.visualization.scatter import Scatter
plot = Scatter()
plot.add(problem.pareto_front(), plot_type="line", color="black", alpha=0.7)
plot.add(res.F, facecolor="none", edgecolor="red")
plot.show()