Production Optimization using MILP

3 次查看(过去 30 天)
I try to solve a manufacturing problem. I got K products over T periods of time with given demand d(t,k) for every time period and every product. I got only one machine with a given capacity in each timeperiod t c(t) Setuptimes for each product ts(k), productiontimes tp(k), Setupcosts s(k) and holdingcosts h(k). I want to minimize the costfunction:
-> Sum[1:T](Sum[1:K](s * y + h(k)*I(t,k)))
where y is a binary variable and I(t,k) is the stored amount of units which we did not used to fullfill demand. Q(t,k) will be the amount of produced products. y,I,Q are to optimize as integers using intlinprog()
I got the functions and all conditions. The only thing where i got problems is, to formulate the condition of
-> I(t-1,k) + Q(t,k) - I(t,k) = d(t,k)
which has to consider the left stock from the previous period. and i don't know how to refer to the previous persiod.
for ii = 1:T
for jj = 1:K
xtemp = clearer2;
xtemp(ii,jj) = -1;
xtemp2 = clearer3;
xtemp2(ii,jj) = 1;
xtemp = sparse([clearer12;xtemp(:);xtemp2(:)]'); % Change to sparse row
Aeq(counter,:) = xtemp; % Fill in row
if ii > 1
beq(counter) = d(ii,jj); % Problem -> can not subtract I(t-1,k)
else
beq(counter) = d(ii,jj); % first Period no Stock
end
counter = counter + 1;
end
end

采纳的回答

Christoph Decker
Christoph Decker 2015-12-21
Thank you Alan. I figured it out myself today. The problem was to implement the I(t-1,k) to the linear equality condition. I wanted to have the condition
I(t-1,k) + Q(t,k) - I(t,k) = d(t,k)
Which will set the previous stock I(t-1,k) plus the amount of units produced in this period Q(t,k) minus the left amount of units, which will be stored, equal to the demand of the current period d(t,k) I solved the problem:
% Demand is satisfied
for ii = 1:T
for jj = 1:K
xtemp = clearer2;
xtemp(ii,jj) = -1; % Every I(t,k) * -1
xtemp2 = clearer3;
xtemp2(ii,jj) = 1; % Every Q(t,k)
if(ii > 1)
xtemp(ii - 1,jj) = 1; % Every I(t-1,k)
else
xtemp(1,jj) = -1; % First period there is no I(t-1,k)
end
xtemp = sparse([clearer12;xtemp(:);xtemp2(:)]'); % Change to sparse row
Aeq(counter,:) = xtemp'; % Fill in
beq(counter) = d(ii,jj);
counter = counter + 1;
end
end

更多回答(1 个)

Alan Weiss
Alan Weiss 2015-12-21
What do you think the decision variables are, namely, the variables that the solver will change to minimize your cost? Do they include I(t,k) and Q(t,k)? If so, I believe that you can write a set of linear equality constraints to represent your condition.
If not, then what are your decision variables?
Alan Weiss
MATLAB mathematical toolbox documentation

类别

Help CenterFile Exchange 中查找有关 Solver Outputs and Iterative Display 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by