Adding a binary decision variable in a linear optimization problem
Show older comments
Hi everybody!
I have the following optimization problem that is related to recycling of plastic waste:
1) There are three plastic waste collection points with different recycling demands per year:
P_CP = [1500,1000,200]; % [t/yr] Recycling Demand
2) There are two recycling stations with two different recycling capacities per year (1000 or 2000 t/yr):
C_RS = [1000,2000,1000,2000]; % [t/yr] Recycling Capacity
3) Due to the fact that the two recycling stations have two different capacity levels, but are at the same location, the column 1,2 and 3,4 in the transport cost matrix are the same:
k_TC = [1,1,2,2; % [$/yr] Transport Costs
2,2,4,4;
4,4,3,3];
The MATLAB code for the linear optimization problem is given below:
%% Cleanup
clear;close all;clc;
%% Define Problem
% Transport Costs
k_TC = [1,1,2,2;
2,2,4,4;
4,4,3,3];
% Collection Points
P_CP = [1500,1000,200]; % Recycling Demand
% Recycling Stations
C_RS = [1000,2000,1000,2000]; % Recycling Capacity
%% Form the LPP (Linear Programming Problem)
N_CP = size(k_TC,1); % Number of Collection Points
N_RS = size(k_TC,2); % Number of Recycling Stations
N_x = numel(k_TC); % Number of Decision Variables
% Index Converter
ind = @(i,j) sub2ind(size(k_TC),i,j);
% Objective Function
f = k_TC(:);
% Preallocate A, b
A = zeros(N_RS,N_x);
b = zeros(N_RS,1);
c = 0; % Initialize Counter
% Nonlinear Constraints for Recycling Capacities
for j = 1:N_RS
c = c+1;
for i = 1:N_CP
A(c,ind(i,j)) = 1;
end
b(c,1) = C_RS(j);
end
% Preallocate Aeq, beq
Aeq = zeros(N_CP,N_x);
beq = zeros(N_CP,1);
c = 0; % Initialize Counter
% Linear Constraints for Recycling Demands
for i = 1:N_CP
c = c+1;
for j = 1:N_RS
Aeq(c,ind(i,j)) = 1;
end
beq(c,1) = P_CP(i);
end
% Bounds
lb = zeros(N_x,1);
ub = [];
%% Sove the LPP
[x_opt,f_val] = linprog(f,A,b,Aeq,beq,lb,ub);
x_opt = reshape(x_opt,size(k_TC))
As the result shows, for the first recycling station, both capacity levels are used.
One possibility would be to run the optimization problem 2^2 times for every combination of recycling capacities. However, if this problem is scaled up to 10 different capacity levels and 500 possible recycling stations, the number of combinations explodes.
Therefore, my question is how to include additional binary decision variables that allow just the use of one capacity level for each recycling station.
Thank you very much for your help!
Accepted Answer
More Answers (0)
Categories
Find more on Linear Programming and Mixed-Integer Linear Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!