Question Regarding MultiObjective Optimization - gamultiobj
Ältere Kommentare anzeigen
Hi. I want to create a model for multi objective optimization.
I have 300 items and three variables for each. Objective is the a function of using 300 items * 3 variables. So I don't want to write 900 seperate variables in the function, if possible. Thanks a lot in advance.
My code is as follows. Also I receive the following error.
error message
++
Not enough input arguments.
Error in globalfun (line 6)
y(1) = sum((1-x(1,1)*0.99)+(1-x(1,2)*0.95)+(1-x(1,3)*0.90));
Error in MCICv2 (line 26)
[x,fval] = gamultiobj(globalfun,numberOfVariables);
++
Script part
++
clc;clear all;close all;
global leadtime
data = readmatrix('Data.xlsx');
data(:,1) = [1:301];
ProductCodes = data(:,1);
LeadTime = data(:,4); %This is the value I use for Multi-Objective Optimization
[widthdata, heightdata]= size(data);
numberOfVariables = i*3;
[x,fval] = gamultiobj(globalfun,numberOfVariables);
++
Function Part
+++
function y = globalfun(x)
global LeadTime
y(1) = sum((1-x(:,1)*0.99)+(1-x(:,2)*0.95)+(1-x(:,3)*0.90)); %minimize the sum of all 301 items
y(2) = (x(:,1)*norminv(0.99))+(x(:,2)*norminv(0.95))+(x(:,3)*norminv(0.90))*sqrt(LeadTime(:)); %minimize the sum of this function for 301 items
end
+++
3 Kommentare
Alan Weiss
am 25 Jan. 2022
Sorry, I don't quite understand what you are trying to do. How many variables do you have in your optimization, I mean variables that you can control, not data? Do you have 3 variables? 300? 900? I understand that you have two objective functions, but I cannot easily tell which variables you can control and which are data that you do not control.
Alan Weiss
MATLAB mathematical toolbox documentation
Fatih Yigit
am 25 Jan. 2022
Bearbeitet: Fatih Yigit
am 25 Jan. 2022
Fatih Yigit
am 25 Jan. 2022
Akzeptierte Antwort
Weitere Antworten (1)
Fatih Yigit
am 26 Jan. 2022
0 Stimmen
Kategorien
Mehr zu Multiobjective Optimization finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!