ambiguous decision variables using GA
2 ビュー (過去 30 日間)
古いコメントを表示
hello
when i run my script i get weird values for x(1:2160) (i.e. all non-zero values are 10001) while the remaining integer x values x(2161:end) are either 0 or 1 (which is what i want). NOTE: i have ran this problem in intlinprog and i know the solution. I understand that ga does not function well with MIP however, my research adviser has requested this!
%Objective Function parameters
obj= xlsread('solver.xlsx','Parameters for OBJ','DN1:DN2180');
%Inequality Constraints
b1= xlsread('solver.xlsx','Parameters for CONST','J23:J38');
b2= xlsread('solver.xlsx','Parameters for CONST','L77:L96');
b3= xlsread('solver.xlsx','Parameters for CONST','L114:L133');
b4= xlsread('solver.xlsx','Parameters for CONST','J157');
b5= xlsread('solver.xlsx','Parameters for CONST','J161:J252');
b6= xlsread('solver.xlsx','Parameters for CONST','J263:J354');
b7= xlsread('solver.xlsx','Parameters for CONST','J364:J379');
b8=b3;
b9=-1*b5;
A1= xlsread('solver.xlsx','A matrix for matlab','c4:cex19');
A2= xlsread('solver.xlsx','A matrix for matlab','c32:cex51');
A3= xlsread('solver.xlsx','A matrix for matlab','c70:cex89');
A4= xlsread('solver.xlsx','A matrix for matlab','c106:cex106');
A5= xlsread('solver.xlsx','A matrix for matlab','c118:cex209');
A6= xlsread('solver.xlsx','A matrix for matlab','c223:cex314');
A7= xlsread('solver.xlsx','A matrix for matlab','c2813:cex2828');
A8=A3*-1;
A9=A5*-1;
b= [b1;b2;b3;b4;b5;b6;b7;b8;b9];
A= [A1;A2;A3;A4;A5;A6;A7;A8;A9];
%Boundaries
intcon =2161:2180;
lb = zeros(2180,1);
lb(round(1:2160));
ub = Inf(2180,1);
ub(2161:end)=1;
%GA Options
opts = optimoptions('ga','MaxStallGenerations',50,'FunctionTolerance',1e-10,...
'MaxGenerations',600,'PlotFcn',@gaplotbestfun);
%GA
[O,GAT,exitflag2]=ga(@(x)dot(x,obj),2180,A,b,[],[],lb,ub,[],intcon,opts);
i would appreciate your insight and help.
thank you very much
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Genetic Algorithm についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!