An issue related to GENETIC ALGORITHM. I am trying to solve a Large Binary Integer Linear optimization Problem using GA. GA is violating all the linear constraints.
Ältere Kommentare anzeigen
I am having problem related to Genetic Algorithm. I am trying to solve a Large Binary Integer Linear optimization Problem using GA.
All the constraints in the model are linear. All the variables are integers and some variables are Binary.
The Problem arising is that GA is violating all the constraints despite that they are all linear constraints not nonlinear.
Also while plotting the Best of f value vs generations it plots Penalty value vs generation.
Suggest me how can I get the feasible solution.
The Problem should have the Following Solution For Z calculated using intlinprog
218250.0000 1 1.00000000000060 1 1 1 1.00000000000000 1 0 5000 0 0 499.999999999998 3500.00000000000 1500.00000000000 0 2000.00000000000 3000.00000000000 500.000000000000 0 3500.00000000000 0 1500.00000000000 0 0 600 0 900.000000000001 0
Here is the simplified code:
% mat_eqn.m
function W = mat_eqn(X)
H = [500 350 1000 1250 800 900 850 750 8 14 13 11 7 10 11 10 10 25 20 15 4 2 1 3 4 11 8 7];
% X is a Row matrix
W = X*H';
end
%Solve.m
clear all;
A= [ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 -1 0 0 0 0 0 0 0 0 0; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 -1 0 0 0 0 0 0 0 0; 0 0 0 0 -4000 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0; 0 0 0 0 0 -3500 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0; 0 0 -5000 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0; 0 0 0 -6000 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0; 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 -1 0 1 1 0 0 0 0 0 0 0 0 0 0; 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 -1 0 0 1 1 0 0 0 0 0 0 0 0; 0 0 0 0 -4000 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0; 0 0 0 0 0 -3500 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0; 0 0 -5000 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0; 0 0 0 -6000 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0; 0 0 0 0 0 0 0 0 -1 0 -1 0 1 1 0 0 0 0 0 0 -1 0 -1 0 0 0 0 0; 0 0 0 0 0 0 0 0 0 -1 0 -1 0 0 1 1 0 0 0 0 0 -1 0 -1 0 0 0 0; -6500 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0; 0 -6000 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1; 0 0 0 0 0 0 -1500 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0; 0 0 0 0 0 0 0 -1600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 -1 0 -1 0; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 -1 0 -1];
B = [-3000;-4000;0;0;0;0;0;0;0;0;0;0;0;0;0;0;600;1200;0;0;0;0];
lb = zeros(1,28);
ub = [ones(1,8),inf(1,20)];
IntCon = [1:28];
options = gaoptimset(@ga);
options = gaoptimset('TolCon', 0.001,'PopulationSize',300,'PlotFcns',@gaplotbestf);
[X gval]= ga(@mat_eqn,28,-A,-B,[],[],lb ,ub,[],IntCon,options);
Z=[gval X];
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Genetic Algorithm 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!