Could you help me about an issue that I experience with Moed?
I try to use the code: https://pymoo.org/algorithms/moo/moead.html#nb-moead But, I encountered two errors related to the shape of the dataset.
First of all, the data has 12 lines. The code I use :
`df= pd.read_excel('aa.xlsx',header=0)
class ZDT1(Problem):
def __init__(self, n_var=12, **kwargs):
super().__init__(n_var=n_var, n_obj=2, n_ieq_constr=0, xl=0, xu=1, vtype=float, **kwargs)
def _evaluate(self, x, out, *args, **kwargs):
obj5_a =df['a']
obj5_b =df['b']
out["F"] = np.column_stack([obj5_a ,obj5_b])
problem = ZDT1()
# create the reference directions to be used for the optimization
ref_dirs = get_reference_directions("energy", 2, n_points=12)
# create the algorithm object
algorithm = MOEAD(ref_dirs=ref_dirs)
# execute the optimization
res = minimize(problem,
algorithm,
seed=1,
termination=('n_gen', 600))
res.F\*\*`
But, when I implement the code with the 'n_points=12 , the problem occurred:
--Exception: ('Problem Error: F can not be set, expected shape (12, 2) but provided (13, 2)', ValueError('cannot reshape array of size 26 into shape (12,2)'))
But, when I implement the code with the 'n_points=13 , the problem occurred:
--Exception: ('Problem Error: F can not be set, expected shape (1, 2) but provided (13, 2)', ValueError('cannot reshape array of size 26 into shape (1,2)'))
I don't find a way to solve this. My work with other algorithms like NSGA3,CTEA work well with this class definition. But not with MOEAD.
Please help me with this. Thank you.