ambiguous decision variables using GA

조회 수: 2 (최근 30일)
Khaled Waleed
Khaled Waleed 2018년 10월 16일
댓글: Khaled Waleed 2018년 10월 16일
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
  댓글 수: 2
Khaled Waleed
Khaled Waleed 2018년 10월 16일
please discard
lb(round(1:2160));
Khaled Waleed
Khaled Waleed 2018년 10월 16일
also is my method for inequality constraints proper?
i guess this is one of the issues!

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Genetic Algorithm에 대해 자세히 알아보기

제품


릴리스

R2016a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by