# How can I solve MINLP optimization using ga?

1 view (last 30 days)
Matlab Noob on 4 Jan 2016
Commented: Matlab Noob on 5 Jan 2016
if true
function F = sim_fit(q,k,m)
q = zeros(3,2);
k = zeros(3,2);
m = zeros(3);
A =0;
%retailerm
J = 2;
I = 3;
a = [3 2; 3 1; 1.1 9];
d = [1850 2000; 3000 2100; 1300 900 ];
hr = [2.4 1.3; 3.8 4.5; 3.6 4.2];
so = [3.5 1.5; 2.5 0.3; 0.6 6.3];
t = [1 1; 3 1; 1 3];
E = [2 2; 3 2; 2 3];
Y = [3 3; 3 3; 3 3];
%vendor
S=100;
hv = [3.5; 4; 5];
C = [10; 50; 20];
Cv = [2.4; 3; 2;];
Cf = [3; 1.2; 2;];
s = [0.3; 0.1; 0.2;];
the = [0.01; 0.03; 0.02];
P = [10000; 8000; 9000];
dv = [sum(d(1,:)); sum(d(2,:)); sum(d(3,:))];
Q = [sum(q(1,:)); sum(q(2,:)); sum(q(3,:))];
%function
%i = item
%j = retailer
for j=1:J
for i=1:I
A = A + (S*dv(i)/(Q(i).*m(i))+(hv(i)*Q(i)*((m(i)-1)*(1-dv(i)/P(i))+dv(i)/P(i)))/2+...
dv(i)*(m(i)*C(i)+m(i)*Q(i)*Cv(i)+Cf(i))+m(i)*s(i)*dv(i)*Q(i)*the(i)/2+...
a(i,j)*d(i,j)/q(i,j)+(hr(i,j)*((1-k(i,j))^2).*q(i,j))/2+...
k(i,j)^2*so(i,j)*q(i,j)/2+(m(i).*t(i,j)*d(i,j))/q(i,j)+(m(i).*E(i,j).*d(i,j))/q(i,j)+...
Y(i,j)*d(i,j));
end
end
end
I try to solve this problem using GA optimization toolbox.
The problem is that there are three decision variables(q,m,k) q, k are 3x2 matrix variables and m is integer varialbe( 3x1 matrix ).
In the ga optimization toolbox, I only can set the number of variables for one decision variable.
How can I solve this MINLP using GA
##### 1 CommentShow NoneHide None
Torsten on 4 Jan 2016
What do you mean by
In the ga optimization toolbox, I only can set the number of variables for one decision variable.
?
Best wishes
Torsten.

Alan Weiss on 4 Jan 2016
Indeed, ga wants a single row vector of decision variables. This is easily arranged, as follows (or something similar):
function F = sim_fit(x)
q = reshape(x(1:6),3,2);
k = reshape(x(7:12,3,2);
m = reshape(x(13:end),3,3);
% The rest of your code goes here...
Alan Weiss
MATLAB mathematical toolbox documentation
Matlab Noob on 5 Jan 2016
Wow,, I'd like to tell you really Thank you. Finally, I solve the problem!! :)