|
Now I write a multi-objective PSO code, but I don't know how to define the input variable for different objective functions, the main code of MOPSO as follows,
for nNfs=1:Nfs % Nfs--number of objective functions.
f2eval=f2evalstr{nNfs}; % f2eval--objective function to evalue, string array.
fs=feval(f2eval,inputdata); % run the objective function 'f2eval' to get fitness.
fits(:,nNfs)=fs;
end
Cause different objective functions with different input variables, and in order to keep the format unchanged, now I define the inputdata as a struct array. But this method makes the inputdata have too many fields, which would cause the code not easy to modify. The inputdata may be changed after run code 'fs=feval(f2eval,inputdata)', and I want to change some fields of inputdata. So my question is how to define the inputdata will make the code more enforceable? Or the main code structure should be changed, or should decompose it into multi-blocks?
Any suggestion is appreciated.Thanks in advance.
|