SlideShare a Scribd company logo
IE-301 Integer Linear Programming Modelling and Implementation
pg. 1
IE-301
Optional Project
Integer Linear Programming Modeling and
Implementation
Fall 2016
Group #3
Project Group Members:
Sarp Uzel 18184
Barışcan Savaş16590
Utku Suer 16531
Supervised By:Kerem Bülbül
Date:08/12/2016
IE-301 Integer Linear Programming Modelling and Implementation
pg. 2
Table of Contents
Abstract................................................................................................................................................... 3
Introduction............................................................................................................................................ 3
Part A....................................................................................................................................................... 6
Part B..................................................................................................................................................... 11
Part C..................................................................................................................................................... 15
APPENDIX.............................................................................................................................................. 20
Code for connecting the data file in part A:.......................................................................................... 20
Code for connecting the data file in part B and C:................................................................................ 20
References: ........................................................................................................................................... 20
IE-301 Integer Linear Programming Modelling and Implementation
pg. 3
Abstract
The Linear Integer Programming is a widely used method in optimization of warehouse
selection problems(or p-median problems or location-allocation) by many Industrial
Engineers.This project focuses on a p-median problem, where the project members were
assumed to imagine Turkey’s well known charity organzation require them to find the optimal
values for disturbing relief supplies from depots to districts.The members of the project group
were asked to minimize the total cost of disturbing relief items, which are supplied by Kızılay,
to 13 different disctricts located in the Asia part of Istanbul by selecting 5 depot points out of
13 districts and determining the number of supplies sent from 5 depots to 13 districts, in case
of a disaster. The core important parts which separate this project’s problem from classical p-
median problems can be listed as: the fact that the multi-sourcing is allowed, the fact that
uncertainity is concerned.The project group, first structured the mathematical model of the
Kızılay’s minimum cost warehouse selection problems in different scenerios and then
implemented the model by using IBM ILOG CPLEX Optimization software, in order to find the
solution of the Linear Integer Program.At the very end, the project group found the objective
values for different demands of Kızılay as well as the optimum solution for decision variables.
Introduction
In this project, project team assumed that Kızılay is aware of the importance of the natural
disasters, so they want to be ready to disturibute relief supplies that they have with respect
to the different demands of different districts, under different types of circumstances, in case
of a disaster. Not only do Kızılay require to distribute these items according to the demands
IE-301 Integer Linear Programming Modelling and Implementation
pg. 4
of the districts, but also they want to minimize the cost of disturbing these items. The problem
states that there are 13 districts that have be supplied by 5 depots whom locations will be
selected amoung the same 13 districts. All of the depot capacities for stocking relief supplies
are the same for each depot candidate. The demands of the districts are given.The distance
between two different districts is also provided as a 13x13 matrix.The depots can only serve
to districts that are at most 20 km far away. The cost of carrying one item for 1 km is 1 TL.
Every district must be assigned to atleast one depot. There is no fixed cost of opening a new
depot. Below you can find the description of the original problem that is assigned to the
project members:
IE-301 Integer Linear Programming Modelling and Implementation
pg. 5
The p-median problem is stated as:” Given a graph or a network G = (V, E), find Vp ⊆ V such that
|Vp| = p, where p may either be variable or fixed (see Section 2.3), and that the sum of the shortest
distances from the vertices in {V Vp} to their nearest vertex in Vp is minimized. In this section we
provide an extended problem definition and a unified notation scheme.”( J. Reese,2005).
IE-301 Integer Linear Programming Modelling and Implementation
pg. 6
The reason why the project group state that this problem is also a p-median problem is the fact that
it satisfies the requirements of p-median problems.
Here are the criteria of p-median problem: (Jamshidi,2009)
1-The cost is directly proportional to the distance.
2-There is no time limit.
3-Total number of warehouses is known.
4-There is no fixed cost for opening a warehouse.
5-All warehouses have the same properties.
6-The candidates for warehouses are also known.
Part A
The data for distance,capacity and demands were all provided by the supervisor.
Here is the data for distance between two districts:
Here is the capacity data:
IE-301 Integer Linear Programming Modelling and Implementation
pg. 7
Here is the data for demand:
First thing that the project team did was analyzing the data. By using the =MAX() funtion in excel,
project team members determined the possible maximum relief item sent from district i to district
j(i=1,2..,13; j=1,2..,13).
Thus, analyze resulted in 6880.
IE-301 Integer Linear Programming Modelling and Implementation
pg. 8
The second step was to construct the MILP(Mixed Integer Linear Program)
Parameters:
M=6880 –Possible maximum item can be send from one district the another
𝑑𝑖𝑠𝑡𝑖𝑗=distance difference between district i and j—provided in the excel sheet(i=1,2..,13; j=1,2..,13).
𝑐𝑖=capacity of candidate i for stocking relief supplies. —provided in the excel sheet(j=1,2..,13).
𝑑𝑒𝑚𝑗=demand of district j-—provided in the excel sheet(j=1,2..,13).
Decision Variables:
𝑌𝑖=1 if candidate i is a depot , 0 else. (j=1,2..,13).
𝑋𝑖𝑗=1 if district i can carry relief items to district j, 0 else. (i=1,2..,13; j=1,2..,13).
𝑅𝑖𝑗=# of supplies carried from district i to district j(i=1,2..,13; j=1,2..,13).
Objective Function:
Minimize:Z=∑ ∑ (𝑑𝑖𝑠𝑡𝑖𝑗 ∗ 𝑅𝑖𝑗
13
𝑗=0
13
𝑖=1 *1)
Constraints:
∑ 𝑌𝑖
13
𝑖=1 =5 –Number of depot constraint.
𝑋İ𝐽 ≤ 𝑌İ (i=1,2..,13; j=1,2..,13)---i can only carry items to j if and only if there is a depot in i
∑ 𝑋İ𝐽
13
𝑖=1 ≥ 1 (i=1,2..,13; j=1,2..,13)---j must be supplied by at least one depot
∑ 𝑅İ𝐽
13
𝑗=1 ≤ 𝑌İ ∗ 𝑐𝑖 (i=1,2..,13; j=1,2..,13)---i is capable of suppliying items with respect to its
capacity
𝑋İ𝐽 ≤ 20 ∗ 𝑑𝑖𝑠𝑡𝑖𝑗(i=1,2..,13; j=1,2..,13)---if the distance is more than 20 km i can’t serve j.
∑ 𝑅İ𝐽
13
𝑖=1 =𝑑𝑒𝑚𝑗 (i=1,2..,13; j=1,2..,13)---#number of items sent to j should be equal to demand of j
𝑅𝑖𝑗 ≤ 𝑀 ∗ 𝑋𝑖𝑗 –at most M number of items can be sent from i to j
𝑅𝑖𝑗 ≥0
𝑋İ𝐽 , 𝑌İ 𝜖(0,1)
Here is the CPLEX code:
int M=6880;//Maximum demand of one district
int NDistricts=13;//There are 13 districts that will be supplied
range I=1..NDistricts;//Set of candidates for depot locations
range J=1..NDistricts;//Set of districts
//Note that there are in total 13 districts and also 13 canditates
//Also note that "..." meaning that data is going to be chosen from the excel file
//in the following lines
int dist[i in I,j in J]=...;//Distance from location i to location j
IE-301 Integer Linear Programming Modelling and Implementation
pg. 9
int dem[j in J]=...;//Demand of location i for relief supplies
int c[i in I]=...;//Capacity of each candidate distribution points
dvar boolean y[i in I];//if candidate i is assigned as a depot it takes value "1"
dvar boolean X[i in I,j in J];//if location j is assigned to depot location i x
takes value "1"
dvar int+ R[i in I,j in J];//ammount of supply coming from dist point i to j
dvar int Z;//The objective function
minimize Z;
subject to{
Z==sum(i in I,j in J) dist[i,j]*R[i,j] ;//since the price of one relief supply
for per km travelled is one we can directly multiply demand by distance
sum(i in I)y[i]==5;//The project concerns to locate 5 depots
forall(i in I,j in J)
X[i,j]<=y[i];// i can only carry items to j if and only if there is a depot in i
forall(j in J)
sum(i in I)X[i,j]>=1;//Every district must be attained to a distribution
point(atleast)
forall(i in I)
sum(j in J)R[i,j]<=y[i]*c[i];//capacity constraint
forall(j in J)
sum(i in I)R[i,j]==dem[j];//demand of j should be satisfied
forall(i in I,j in J)
R[i,j]<=M*X[i,j];//maximum number of supply carried from i to j
forall(i in I,j in J)
X[i,j]*dist[i,j]<=20;//distance constraint
}
IE-301 Integer Linear Programming Modelling and Implementation
pg. 10
Here are the optimal solutions provided by IBM ILOG :
// solution (optimal) with objective 274980
// Quality Incumbent solution:
// MILP objective 2.7498000000e+005
// MILP solution norm |x| (Total, Max) 3.26606e+005 2.74980e+005
// MILP solution error (Ax=b) (Total, Max) 0.00000e+000 0.00000e+000
// MILP x bound error (Total, Max) 0.00000e+000 0.00000e+000
// MILP x integrality error (Total, Max) 0.00000e+000 0.00000e+000
// MILP slack bound error (Total, Max) 0.00000e+000 0.00000e+000
//
Z = 274980;
R = [[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]
[4190 0 220 4650 0 0 0 0 0 0 0 0 5400]
[0 0 0 0 4570 4870 0 0 0 0 2340 0 0]
[0 0 0 0 0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 6810 0 3210 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 330 0 0 0]
[0 0 0 0 0 0 0 0 0 0 0 0 0]
[0 2490 2090 0 0 0 0 3540 0 0 0 6880 0]
[0 0 0 0 0 0 0 0 0 0 0 0 0]];
y = [0 0 0 1 1 0 1 0 0 1 0 1 0];
X = [[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 0 1 1 1 1 0 1 0 0 0 1 1]
[0 0 0 1 1 1 1 0 1 0 1 0 1]
[0 0 0 0 0 0 0 0 0 0 0 0 0]
[1 0 0 0 1 1 1 1 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 0 0]
[0 0 0 0 0 0 0 0 0 1 0 0 0]
[0 0 0 0 0 0 0 0 0 0 0 0 0]
[1 1 1 1 0 1 0 1 0 0 0 1 1]
[0 0 0 0 0 0 0 0 0 0 0 0 0]];
Optimal objective function value:274980 TL
Above one can see that all of the demands given in the excel sheet was satisfied from the objective
value of R[i,j]( 𝑅𝑖𝑗).
Computational Time:01:44
IE-301 Integer Linear Programming Modelling and Implementation
pg. 11
Part B
In part B,there are different scenarios and each scenario must be satisfied.Kızılay do not want to risk
anything, hence our program is to determine the specific number of items sent from i to j which
satisfies all the scenarios.There are 20 different scenarios in this part; in addition , all must be
satisfied.Here are the demand data for different scenarios:
The maximum number of demand again is calculated, in order to decide the possible maximum
number of item distribution.
IE-301 Integer Linear Programming Modelling and Implementation
pg. 12
Parameters:
MS=7377 –Possible maximum item can be send from one district the another
𝑑𝑖𝑠𝑡𝑖𝑗=distance difference between district i and j—provided in the excel sheet(i=1,2..,13; j=1,2..,13).
𝑐𝑖=capacity of candidate i for stocking relief supplies. —provided in the excel sheet(j=1,2..,13).
𝑢𝑐𝑑𝑒𝑚𝑗𝑠= uncertain demand of district j with respect to scenario s-—provided in the excel
sheet(j=1,2..,13,s=1,2,3,..20).
Decision Variables:
𝑌𝑖=1 if candidate i is a depot , 0 else. (j=1,2..,13).
𝑋𝑖𝑗=1 if district i can carry relief items to district j, 0 else. (i=1,2..,13; j=1,2..,13).
𝑅𝑖𝑗=# of supplies carried from district i to district j(i=1,2..,13; j=1,2..,13).
Objective Function:
Minimize:Z=∑ ∑ (𝑑𝑖𝑠𝑡𝑖𝑗 ∗ 𝑅𝑖𝑗
13
𝑗=0
13
𝑖=1 *1)
Constraints:
∑ 𝑌𝑖
13
𝑖=1 =5 –Number of depot constraint.
𝑋İ𝐽 ≤ 𝑌İ (i=1,2..,13; j=1,2..,13)---i can only carry items to j if and only if there is a depot in i
∑ 𝑋İ𝐽
13
𝑖=1 ≥ 1 (i=1,2..,13; j=1,2..,13)---j must be supplied by at least one depot
∑ 𝑅İ𝐽
13
𝑗=1 ≤ 𝑌İ ∗ 𝑐𝑖 (i=1,2..,13; j=1,2..,13)---i is capable of suppliying items with respect to its
capacity
𝑋İ𝐽 ≤ 20 ∗ 𝑑𝑖𝑠𝑡𝑖𝑗(i=1,2..,13; j=1,2..,13)---if the distance is more than 20 km i can’t serve j.
∑ 𝑅İ𝐽
13
𝑖=1 ≥ 𝑢𝑐𝑑𝑒𝑚𝑗𝑠 (i=1,2..,13; j=1,2..,13; s=1,2,3...20)---in order to satisfy all demands under every
scenario
𝑅𝑖𝑗 ≤ 𝑀𝑆 ∗ 𝑋𝑖𝑗 –at most MS number of items can be sent from i to j
𝑅𝑖𝑗 ≥0
𝑋İ𝐽 , 𝑌İ 𝜖(0,1)
Here is the CPLEX code:
int NDistricts=13;//There are 13 districts that will be supplied
range I=1..NDistricts;//Set of candidates for depot locations
range J=1..NDistricts;//Set of districts
//Note that there are in total 13 districts and also 13 canditates
//Also note that "..." meaning that data is going to be chosen from the excel file
IE-301 Integer Linear Programming Modelling and Implementation
pg. 13
//in the following lines
int dist[i in I,j in J]=...;//Distance from location i to location j
int c[i in I]=...;//Capacity of each candidate distribution points
int Nscenarios=20;//Number of Scenarios
range S=1..Nscenarios;//Set of Scenarios
int ucdemand[j in J,s in S]=...;
int MS=7377;
dvar boolean y[i in I];//if candidate i is assigned as a depot it takes value "1"
dvar boolean X[i in I,j in J];//if location j is assigned to depot location i x
takes value "1"
dvar int+ R[i in I,j in J];//ammount of supply coming from dist point i to j
dvar int Z;//The objective function
minimize Z;
subject to{
Z==sum(i in I,j in J) dist[i,j]*R[i,j] ;//since the price of one relief supply
for per km travelled is one we can directly multiply demand by distance
sum(i in I)y[i]==5;//The project concerns to locate 5 depots
forall(i in I,j in J)
X[i,j]<=y[i];
forall(j in J)
sum(i in I)X[i,j]>=1;//Every district must be attained to a distribution
point(atleast)
forall(i in I)
sum(j in J)R[i,j]<=y[i]*c[i]; //capacity constraint
forall(i in I,j in J)
X[i,j]*dist[i,j]<=20;//distance constraint
forall(j in J,s in S)
sum(i in I)R[i,j]>=ucdemand[j,s]; //demand constraint
forall(i in I,j in J)
R[i,j]<=MS*X[i,j];//possible maximum number of supply sent
IE-301 Integer Linear Programming Modelling and Implementation
pg. 14
}
Here is the report:
// solution (optimal) with objective 311658
// Quality Incumbent solution:
// MILP objective 3.1165800000e+005
// MILP solution norm |x| (Total, Max) 3.67913e+005 3.11658e+005
// MILP solution error (Ax=b) (Total, Max) 0.00000e+000 0.00000e+000
// MILP x bound error (Total, Max) 0.00000e+000 0.00000e+000
// MILP x integrality error (Total, Max) 0.00000e+000 0.00000e+000
// MILP slack bound error (Total, Max) 0.00000e+000 0.00000e+000
//
Z = 311658;
R = [[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]
[4347 0 0 4962 0 0 0 0 0 0 0 0 5691]
[0 0 0 0 4899 5191 0 0 0 0 2711 0 0]
[0 0 0 0 0 0 0 0 0 0 0 0 0]
[240 0 0 0 0 0 7228 1665 3553 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 732 0 0 0]
[0 0 0 0 0 0 0 0 0 0 0 0 0]
[0 2680 2754 0 0 0 0 2189 0 0 0 7377 0]
[0 0 0 0 0 0 0 0 0 0 0 0 0]];
y = [0 0 0 1 1 0 1 0 0 1 0 1 0];
X = [[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 0 1 1 1 1 0 1 0 0 0 1 1]
[0 0 0 1 1 1 1 0 1 0 1 0 1]
[0 0 0 0 0 0 0 0 0 0 0 0 0]
[1 0 0 0 1 1 1 1 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 0 0]
[0 0 0 0 0 0 0 0 0 1 0 0 0]
[0 0 0 0 0 0 0 0 0 0 0 0 0]
[1 1 1 1 0 1 0 1 0 0 0 1 1]
[0 0 0 0 0 0 0 0 0 0 0 0 0]];
Optimal objective value is=311658
Computational Time: 01:70
It is no surprise that summation of the elements in the columns of R matrix is equal to the maximum
demand for the corresponding district under among all scenarios.This is the only way to satisfy all the
scenarios. Part B will give the maximum optimal cost for this problem, since the program collects the
maximum demand for each district out of 20 scenarios, in order to satisfy all the scenarios.This is why
the optimal objective value is higher than the part a. Moreover; computational time increased when
part b is compared to the part a which means that the software spent more computational effort.This is
IE-301 Integer Linear Programming Modelling and Implementation
pg. 15
just because adding new constraint **∑ 𝑅İ𝐽
13
𝑖=1 ≥ 𝑢𝑐𝑑𝑒𝑚𝑗𝑠**. This constraint definetely increased the
complexity of the problem.
For(j=1;j<=13;i++)
For(s=1;s<=10;s++)
For(i=1;i<=13;i++)
The complexity of this psedue-code which is the representation of the **∑ 𝑅İ𝐽
13
𝑖=1 ≥ 𝑢𝑐𝑑𝑒𝑚𝑗𝑠**
constraint is basically j*s*i.
The interesting part is optimal depot locations are the same as part a. And also optimal values for 𝑋İ𝐽’s
Are the same.This explains why the cost is higher than part a better.Since, matrix R is the multiplied
version of matrix X. Since X matrices are same for part a and b, also the summation of the columns
are higher than part a the optimal objective function value is also greater than part a. Obviously
number of items sent from i to j in part b is greater than the items sent from i to j in part a, hence the
optimal solution of part b’s objective function is greater,since they have the same depot locations
and same assignments for depots.
Part C
In this part, the uncertain data did not change.However, in the first phase of the question, it is stated
that Kızılay is optimistic and it is enough to satisfy 80 percent of the scenarios.In the second phase we
will try the same problem with 60 percent satisfaction of scenarios.
Parameters:
MS=7377 –Possible maximum item can be send from one district the another
𝑑𝑖𝑠𝑡𝑖𝑗=distance difference between district i and j—provided in the excel sheet(i=1,2..,13; j=1,2..,13).
𝑐𝑖=capacity of candidate i for stocking relief supplies. —provided in the excel sheet(j=1,2..,13).
𝑢𝑐𝑑𝑒𝑚𝑗𝑠= uncertain demand of district j with respect to scenario s-—provided in the excel
sheet(j=1,2..,13,s=1,2,3,..20).
IE-301 Integer Linear Programming Modelling and Implementation
pg. 16
Decision Variables:
𝑌𝑖=1 if candidate i is a depot , 0 else. (j=1,2..,13).
𝑋𝑖𝑗=1 if district i can carry relief items to district j, 0 else. (i=1,2..,13; j=1,2..,13).
𝑅𝑖𝑗=# of supplies carried from district i to district j(i=1,2..,13; j=1,2..,13).
𝑆𝑐𝑛 𝑠=If scenario s is satisfied it returns 1; 0 otherwise (s=1,2,3...20)
Objective Function:
Minimize:Z=∑ ∑ (𝑑𝑖𝑠𝑡𝑖𝑗 ∗ 𝑅𝑖𝑗
13
𝑗=0
13
𝑖=1 *1)
Constraints:
∑ 𝑌𝑖
13
𝑖=1 =5 --Number of depot constraint.
𝑋İ𝐽 ≤ 𝑌İ (i=1,2..,13; j=1,2..,13)---i can only carry items to j if and only if there is a depot in i
∑ 𝑋İ𝐽
13
𝑖=1 ≥ 1 (i=1,2..,13; j=1,2..,13)---j must be supplied by at least one depot
∑ 𝑅İ𝐽
13
𝑗=1 ≤ 𝑌İ ∗ 𝑐𝑖 (i=1,2..,13; j=1,2..,13)---i is capable of suppliying items with respect to its
capacity
𝑋İ𝐽 ≤ 20 ∗ 𝑑𝑖𝑠𝑡𝑖𝑗(i=1,2..,13; j=1,2..,13)---if the distance is more than 20 km i can’t serve j.
∑ 𝑅İ𝐽
13
𝑖=1 ≥ 𝑢𝑐𝑑𝑒𝑚𝑗𝑠 *𝑆𝑐𝑛 𝑠 (i=1,2..,13; j=1,2..,13; s=1,2,3...20)---in order to satisfy all demands
under every scenario
𝑅𝑖𝑗 ≤ 𝑀𝑆 ∗ 𝑋𝑖𝑗 –at most MS number of items can be sent from i to j
∑13
𝑖=1 𝑆𝑐𝑛 𝑠=16 (s=1,2,3...20)
𝑅𝑖𝑗 ≥0 ,𝑋İ𝐽 , 𝑌İ 𝑆𝑐𝑛 𝑠 𝜖(0,1) (i=1,2..,13; j=1,2..,13; s=1,2,3...20)
Here is the CPLEX code:
int NDistricts=13;//There are 13 districts that will be supplied
range I=1..NDistricts;//Set of candidates for depot locations
range J=1..NDistricts;//Set of districts
//Note that there are in total 13 districts and also 13 canditates
//Also note that "..." meaning that data is going to be chosen from the excel file
//in the following lines
int dist[i in I,j in J]=...;//Distance from location i to location j
int c[i in I]=...;//Capacity of each candidate distribution points
int Nscenarios=20;//Number of Scenarios
range S=1..Nscenarios;//Set of Scenarios
int ucdemand[j in J,s in S]=...;
int MS=7377;
dvar boolean y[i in I];//if candidate i is assigned as a depot it takes value "1"
dvar boolean X[i in I,j in J];//if location j is assigned to depot location i x
takes value "1"
IE-301 Integer Linear Programming Modelling and Implementation
pg. 17
dvar int+ R[i in I,j in J];//ammount of supply coming from dist point i to j
dvar int Z;//The objective function
dvar boolean Scn[s in S];//If scene s is satisfied then it returns 1
minimize Z;
subject to{
Z==sum(i in I,j in J) dist[i,j]*R[i,j] ;//since the price of one relief supply
for per km travelled is one we can directly multiply demand by distance
sum(i in I)y[i]==5;//The project concerns to locate 5 depots
forall(i in I,j in J)
X[i,j]<=y[i];// i can serve j if and only if there is a depot in i
forall(j in J)
sum(i in I)X[i,j]>=1;//Every district must be assigned to a distribution
point(atleast)
forall(i in I)
sum(j in J)R[i,j]<=y[i]*c[i];//capacity constraint
forall(i in I,j in J)
X[i,j]*dist[i,j]<=20;//distance constraint
forall(j in J,s in S)
sum(i in I)R[i,j]>=Scn[s]*ucdemand[j,s];//demand contraint of the satisfied
scenarios
sum(s in S)Scn[s]==16;//80 percent satisfaction of scenarios
forall(i in I,j in J)
R[i,j]<=MS*X[i,j];//possible maximum number of carrying items from i to j
}
IE-301 Integer Linear Programming Modelling and Implementation
pg. 18
Here is the report:
// solution (optimal) with objective 303513
// Quality Incumbent solution:
// MILP objective 3.0351300000e+005
// MILP solution norm |x| (Total, Max) 3.65988e+005 3.03513e+005
// MILP solution error (Ax=b) (Total, Max) 0.00000e+000 0.00000e+000
// MILP x bound error (Total, Max) 0.00000e+000 0.00000e+000
// MILP x integrality error (Total, Max) 0.00000e+000 0.00000e+000
// MILP slack bound error (Total, Max) 0.00000e+000 0.00000e+000
//
Z = 303513;
R = [[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]
[4347 0 0 4962 0 0 0 0 0 0 0 0 5691]
[0 0 0 0 4899 5191 0 0 0 0 2711 0 0]
[0 0 0 0 0 0 0 0 0 0 0 0 0]
[24 0 0 0 0 0 7228 1440 3553 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 7377 0 0 0]
[0 0 0 0 0 0 0 0 0 0 0 0 0]
[0 2680 2754 0 0 0 0 2189 0 0 0 7377 0]
[0 0 0 0 0 0 0 0 0 0 0 0 0]];
y = [0 0 0 1 1 0 1 0 0 1 0 1 0];
X = [[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 0 1 1 1 1 0 1 0 0 0 1 1]
[0 0 0 1 1 1 1 0 1 0 1 0 1]
[0 0 0 0 0 0 0 0 0 0 0 0 0]
[1 0 0 0 1 1 1 1 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 0 0]
[0 0 0 0 0 0 0 0 0 1 0 0 0]
[0 0 0 0 0 0 0 0 0 0 0 0 0]
[1 1 1 1 0 1 0 1 0 0 0 1 1]
[0 0 0 0 0 0 0 0 0 0 0 0 0]];
Scn = [0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0];
Optimal objective value when p=0.8 : 303513 TL
Computational Time: 02:79
***Note that R[10,10] is 7377 ; however, in demand/scenario data there is no demand as 7377 for
Şile under any scenario. But, this is not going to change anything, since the distance between Şile and
Şile is 0.Moreover; Şile is more than 20 km far away from any district, so it cannot send any items to
any district and also there must be a depot in Şile to satisfy the demand of Şile. Therefore, Şile can
IE-301 Integer Linear Programming Modelling and Implementation
pg. 19
use all of the capacity it has just for itself with 0 cost. Also note that, scenarios 1,3,19,20 can not be
satisfied.
For the second part of the part c, all we need to modify line 59:
** sum(s in S)Scn[s]==12;//60 percent satisfaction of scenarios **(Make the
summation of scenarios satisfied equal to 12 since it is enough)
Here are the results:
// solution (integer optimal, tolerance) with objective 296732
// Quality Incumbent solution:
// MILP objective 2.9673200000e+005
// MILP solution norm |x| (Total, Max) 3.58456e+005 2.96732e+005
// MILP solution error (Ax=b) (Total, Max) 0.00000e+000 0.00000e+000
// MILP x bound error (Total, Max) 0.00000e+000 0.00000e+000
// MILP x integrality error (Total, Max) 0.00000e+000 0.00000e+000
// MILP slack bound error (Total, Max) 0.00000e+000 0.00000e+000
//
Z = 296732;
R = [[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]
[4311 0 0 4962 0 0 0 0 0 0 0 0 5691]
[0 0 0 0 4899 5098 0 0 0 0 2602 0 0]
[0 0 0 0 0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 7228 955 3553 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 7377 0 0 0]
[0 0 0 0 0 0 0 0 0 0 0 0 0]
[0 2680 2623 0 0 0 0 2674 0 0 0 7023 0]
[0 0 0 0 0 0 0 0 0 0 0 0 0]];
y = [0 0 0 1 1 0 1 0 0 1 0 1 0];
X = [[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 0 1 1 1 1 0 1 0 0 0 1 1]
[0 0 0 1 1 1 1 0 1 0 1 0 1]
[0 0 0 0 0 0 0 0 0 0 0 0 0]
[1 0 0 0 1 1 1 1 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 0 0]
[0 0 0 0 0 0 0 0 0 1 0 0 0]
[0 0 0 0 0 0 0 0 0 0 0 0 0]
[1 1 1 1 0 1 0 1 0 0 0 1 1]
[0 0 0 0 0 0 0 0 0 0 0 0 0]];
Scn = [0 1 0 0 1 1 1 0 1 1 1 1 0 1 0 1 1 1 0 0];
Optimal value for objective function :296732TL
IE-301 Integer Linear Programming Modelling and Implementation
pg. 20
Computational Time: 02:73
Note that, scenarios 1,3,4,8,13,15,19,20 can not be satisfied.
The optimal solutions for p=0.8 p=0.6 and p=1 are totally different. p=1>p=0.8>p=0.6. The main
reason is when the all scenarios do not necessarily have to be satisfied, Cplex eliminates the
scenarios which cost more ,since the objective funtion tries to minimize the cost.Number of items
sent from i to j decreased for almost every element of the R matrix as p gets closer to 0. For instance
when p=0.8 ammount of supply sent from 4 to 1 was 4371 but when p was P=0.6 of supply sent
from 4 to 1 became 4311. This is what Cplex handles, as we decrese the size of the set of the feasible
region for a minimization problem by relaxing the constraints, we are more prone to observe lower
values for optimal objective funtion solution. The depot locations and their assignments in part c is
again the same as part a and b.
APPENDIX
Code for connecting the data file in part A:
SheetConnection sheet("KizilayData.xlsx");
dist from SheetRead(sheet,"Distances!B2:N14");
dem from SheetRead(sheet,"Demands_CaseA!B2:B14");
c from SheetRead(sheet,"Capacities!B2:B14");
Code for connecting the data file in part B and C:
SheetConnection sheet("KizilayData.xlsx");
dist from SheetRead(sheet,"Distances!B2:N14");
c from SheetRead(sheet,"Capacities!B2:B14");
ucdemand from SheetRead(sheet,"Demands_CaseB_C!B2:U14");
References:
Jamshidi, M. (2009). “Median Location Problem”, Facility Location: Concepts, Models, Algorithms and
Case Studies, Ed. by. R.Z. Farahani and M. Hekmatfar, PhysicaVerlag Heidelberg, pp.177-191
IE-301 Integer Linear Programming Modelling and Implementation
pg. 21
J. Reese(2005) ” Methods for Solving the p-Median Problem: An Annotated Bibliography” pp.2-3

More Related Content

What's hot

The automatic license plate recognition(alpr)
The automatic license plate recognition(alpr)The automatic license plate recognition(alpr)
The automatic license plate recognition(alpr)
eSAT Journals
 
The automatic license plate recognition(alpr)
The automatic license plate recognition(alpr)The automatic license plate recognition(alpr)
The automatic license plate recognition(alpr)
eSAT Journals
 
kunjan ieee paper 1 bit full adder
kunjan ieee paper 1 bit full adderkunjan ieee paper 1 bit full adder
kunjan ieee paper 1 bit full adder
Kunjan Shinde
 
IRJET- A Novel Gabor Feed Forward Network for Pose Invariant Face Recogni...
IRJET-  	  A Novel Gabor Feed Forward Network for Pose Invariant Face Recogni...IRJET-  	  A Novel Gabor Feed Forward Network for Pose Invariant Face Recogni...
IRJET- A Novel Gabor Feed Forward Network for Pose Invariant Face Recogni...
IRJET Journal
 
ARCHAEOLOGICAL LAND USE CHARACTERIZATION USING MULTISPECTRAL REMOTE SENSING DATA
ARCHAEOLOGICAL LAND USE CHARACTERIZATION USING MULTISPECTRAL REMOTE SENSING DATAARCHAEOLOGICAL LAND USE CHARACTERIZATION USING MULTISPECTRAL REMOTE SENSING DATA
ARCHAEOLOGICAL LAND USE CHARACTERIZATION USING MULTISPECTRAL REMOTE SENSING DATA
grssieee
 
Linear Feature Separation From Topographic Maps Using Energy Density and The ...
Linear Feature Separation From Topographic Maps Using Energy Density and The ...Linear Feature Separation From Topographic Maps Using Energy Density and The ...
Linear Feature Separation From Topographic Maps Using Energy Density and The ...
Rojith Thomas
 
ALGORITHMIC AND ARCHITECTURAL OPTIMIZATION OF A 3D RECONSTRUCTION MEDICAL IMA...
ALGORITHMIC AND ARCHITECTURAL OPTIMIZATION OF A 3D RECONSTRUCTION MEDICAL IMA...ALGORITHMIC AND ARCHITECTURAL OPTIMIZATION OF A 3D RECONSTRUCTION MEDICAL IMA...
ALGORITHMIC AND ARCHITECTURAL OPTIMIZATION OF A 3D RECONSTRUCTION MEDICAL IMA...
IJCSEIT Journal
 
Y34147151
Y34147151Y34147151
Y34147151
IJERA Editor
 
H010414651
H010414651H010414651
H010414651
IOSR Journals
 
Optimization and implementation of parallel squarer
Optimization and implementation of parallel squarerOptimization and implementation of parallel squarer
Optimization and implementation of parallel squarer
eSAT Publishing House
 
paper
paperpaper
IRJET - Distributed Arithmetic Method for Complex Multiplication
IRJET -  	  Distributed Arithmetic Method for Complex MultiplicationIRJET -  	  Distributed Arithmetic Method for Complex Multiplication
IRJET - Distributed Arithmetic Method for Complex Multiplication
IRJET Journal
 
1.arithmetic & logical operations
1.arithmetic & logical operations1.arithmetic & logical operations
1.arithmetic & logical operations
mukesh bhardwaj
 
Design and implementation of high speed baugh wooley and modified booth multi...
Design and implementation of high speed baugh wooley and modified booth multi...Design and implementation of high speed baugh wooley and modified booth multi...
Design and implementation of high speed baugh wooley and modified booth multi...
eSAT Publishing House
 
A Novel Efficient VLSI Architecture for IEEE 754 Floating point multiplier us...
A Novel Efficient VLSI Architecture for IEEE 754 Floating point multiplier us...A Novel Efficient VLSI Architecture for IEEE 754 Floating point multiplier us...
A Novel Efficient VLSI Architecture for IEEE 754 Floating point multiplier us...
IJERA Editor
 
Face recognition using selected topographical features
Face recognition using selected topographical features Face recognition using selected topographical features
Face recognition using selected topographical features
IJECEIAES
 
IRJET- Asic Implementation of Efficient Error Detection for Floating Poin...
IRJET-  	  Asic Implementation of Efficient Error Detection for Floating Poin...IRJET-  	  Asic Implementation of Efficient Error Detection for Floating Poin...
IRJET- Asic Implementation of Efficient Error Detection for Floating Poin...
IRJET Journal
 
Enhancement of genetic image watermarking robust against cropping attack
Enhancement of genetic image watermarking robust against cropping attackEnhancement of genetic image watermarking robust against cropping attack
Enhancement of genetic image watermarking robust against cropping attack
ijfcstjournal
 
E0364025031
E0364025031E0364025031
E0364025031
theijes
 
Matlab Working With Images
Matlab Working With ImagesMatlab Working With Images
Matlab Working With Images
DataminingTools Inc
 

What's hot (20)

The automatic license plate recognition(alpr)
The automatic license plate recognition(alpr)The automatic license plate recognition(alpr)
The automatic license plate recognition(alpr)
 
The automatic license plate recognition(alpr)
The automatic license plate recognition(alpr)The automatic license plate recognition(alpr)
The automatic license plate recognition(alpr)
 
kunjan ieee paper 1 bit full adder
kunjan ieee paper 1 bit full adderkunjan ieee paper 1 bit full adder
kunjan ieee paper 1 bit full adder
 
IRJET- A Novel Gabor Feed Forward Network for Pose Invariant Face Recogni...
IRJET-  	  A Novel Gabor Feed Forward Network for Pose Invariant Face Recogni...IRJET-  	  A Novel Gabor Feed Forward Network for Pose Invariant Face Recogni...
IRJET- A Novel Gabor Feed Forward Network for Pose Invariant Face Recogni...
 
ARCHAEOLOGICAL LAND USE CHARACTERIZATION USING MULTISPECTRAL REMOTE SENSING DATA
ARCHAEOLOGICAL LAND USE CHARACTERIZATION USING MULTISPECTRAL REMOTE SENSING DATAARCHAEOLOGICAL LAND USE CHARACTERIZATION USING MULTISPECTRAL REMOTE SENSING DATA
ARCHAEOLOGICAL LAND USE CHARACTERIZATION USING MULTISPECTRAL REMOTE SENSING DATA
 
Linear Feature Separation From Topographic Maps Using Energy Density and The ...
Linear Feature Separation From Topographic Maps Using Energy Density and The ...Linear Feature Separation From Topographic Maps Using Energy Density and The ...
Linear Feature Separation From Topographic Maps Using Energy Density and The ...
 
ALGORITHMIC AND ARCHITECTURAL OPTIMIZATION OF A 3D RECONSTRUCTION MEDICAL IMA...
ALGORITHMIC AND ARCHITECTURAL OPTIMIZATION OF A 3D RECONSTRUCTION MEDICAL IMA...ALGORITHMIC AND ARCHITECTURAL OPTIMIZATION OF A 3D RECONSTRUCTION MEDICAL IMA...
ALGORITHMIC AND ARCHITECTURAL OPTIMIZATION OF A 3D RECONSTRUCTION MEDICAL IMA...
 
Y34147151
Y34147151Y34147151
Y34147151
 
H010414651
H010414651H010414651
H010414651
 
Optimization and implementation of parallel squarer
Optimization and implementation of parallel squarerOptimization and implementation of parallel squarer
Optimization and implementation of parallel squarer
 
paper
paperpaper
paper
 
IRJET - Distributed Arithmetic Method for Complex Multiplication
IRJET -  	  Distributed Arithmetic Method for Complex MultiplicationIRJET -  	  Distributed Arithmetic Method for Complex Multiplication
IRJET - Distributed Arithmetic Method for Complex Multiplication
 
1.arithmetic & logical operations
1.arithmetic & logical operations1.arithmetic & logical operations
1.arithmetic & logical operations
 
Design and implementation of high speed baugh wooley and modified booth multi...
Design and implementation of high speed baugh wooley and modified booth multi...Design and implementation of high speed baugh wooley and modified booth multi...
Design and implementation of high speed baugh wooley and modified booth multi...
 
A Novel Efficient VLSI Architecture for IEEE 754 Floating point multiplier us...
A Novel Efficient VLSI Architecture for IEEE 754 Floating point multiplier us...A Novel Efficient VLSI Architecture for IEEE 754 Floating point multiplier us...
A Novel Efficient VLSI Architecture for IEEE 754 Floating point multiplier us...
 
Face recognition using selected topographical features
Face recognition using selected topographical features Face recognition using selected topographical features
Face recognition using selected topographical features
 
IRJET- Asic Implementation of Efficient Error Detection for Floating Poin...
IRJET-  	  Asic Implementation of Efficient Error Detection for Floating Poin...IRJET-  	  Asic Implementation of Efficient Error Detection for Floating Poin...
IRJET- Asic Implementation of Efficient Error Detection for Floating Poin...
 
Enhancement of genetic image watermarking robust against cropping attack
Enhancement of genetic image watermarking robust against cropping attackEnhancement of genetic image watermarking robust against cropping attack
Enhancement of genetic image watermarking robust against cropping attack
 
E0364025031
E0364025031E0364025031
E0364025031
 
Matlab Working With Images
Matlab Working With ImagesMatlab Working With Images
Matlab Working With Images
 

Similar to IE-301_OptionalProject_Group2_Report

Composable Energy Modeling for ML-Driven Drone Applications
Composable Energy Modeling for ML-Driven Drone ApplicationsComposable Energy Modeling for ML-Driven Drone Applications
Composable Energy Modeling for ML-Driven Drone Applications
Demetris Trihinas
 
IRJET- Parallelization of Definite Integration
IRJET- Parallelization of Definite IntegrationIRJET- Parallelization of Definite Integration
IRJET- Parallelization of Definite Integration
IRJET Journal
 
MULTI-OBJECTIVE ANALYSIS OF INTEGRATED SUPPLY CHAIN PROBLEM
MULTI-OBJECTIVE ANALYSIS OF INTEGRATED SUPPLY CHAIN PROBLEMMULTI-OBJECTIVE ANALYSIS OF INTEGRATED SUPPLY CHAIN PROBLEM
MULTI-OBJECTIVE ANALYSIS OF INTEGRATED SUPPLY CHAIN PROBLEM
National Institute of Technology Calicut
 
IRJET- Comparison for Max-Flow Min-Cut Algorithms for Optimal Assignment Problem
IRJET- Comparison for Max-Flow Min-Cut Algorithms for Optimal Assignment ProblemIRJET- Comparison for Max-Flow Min-Cut Algorithms for Optimal Assignment Problem
IRJET- Comparison for Max-Flow Min-Cut Algorithms for Optimal Assignment Problem
IRJET Journal
 
Optimization of Time Restriction in Construction Project Management Using Lin...
Optimization of Time Restriction in Construction Project Management Using Lin...Optimization of Time Restriction in Construction Project Management Using Lin...
Optimization of Time Restriction in Construction Project Management Using Lin...
IJERA Editor
 
A Hybrid Data Clustering Approach using K-Means and Simplex Method-based Bact...
A Hybrid Data Clustering Approach using K-Means and Simplex Method-based Bact...A Hybrid Data Clustering Approach using K-Means and Simplex Method-based Bact...
A Hybrid Data Clustering Approach using K-Means and Simplex Method-based Bact...
IRJET Journal
 
IRJET - Design of a Low Power Serial- Parallel Multiplier with Low Transition...
IRJET - Design of a Low Power Serial- Parallel Multiplier with Low Transition...IRJET - Design of a Low Power Serial- Parallel Multiplier with Low Transition...
IRJET - Design of a Low Power Serial- Parallel Multiplier with Low Transition...
IRJET Journal
 
Application of local search methods for solving a quadratic assignment proble...
Application of local search methods for solving a quadratic assignment proble...Application of local search methods for solving a quadratic assignment proble...
Application of local search methods for solving a quadratic assignment proble...
Gurdal Ertek
 
Questions On The Equation For Regression
Questions On The Equation For RegressionQuestions On The Equation For Regression
Questions On The Equation For Regression
Tiffany Sandoval
 
Paper id 37201520
Paper id 37201520Paper id 37201520
Paper id 37201520
IJRAT
 
A fast fpga based architecture for measuring the distance between
A fast fpga based architecture for measuring the distance betweenA fast fpga based architecture for measuring the distance between
A fast fpga based architecture for measuring the distance between
IAEME Publication
 
AMAZON STOCK PRICE PREDICTION BY USING SMLT
AMAZON STOCK PRICE PREDICTION BY USING SMLTAMAZON STOCK PRICE PREDICTION BY USING SMLT
AMAZON STOCK PRICE PREDICTION BY USING SMLT
IRJET Journal
 
J045075661
J045075661J045075661
J045075661
IJERA Editor
 
Scientific calculator project in c language
Scientific calculator project in c languageScientific calculator project in c language
Scientific calculator project in c language
AMIT KUMAR
 
Sequences classification based on group technology
Sequences classification based on group technologySequences classification based on group technology
Sequences classification based on group technology
eSAT Publishing House
 
D05511625
D05511625D05511625
D05511625
IOSR-JEN
 
IRJET- Optimal Placement and Size of DG and DER for Minimizing Power Loss and...
IRJET- Optimal Placement and Size of DG and DER for Minimizing Power Loss and...IRJET- Optimal Placement and Size of DG and DER for Minimizing Power Loss and...
IRJET- Optimal Placement and Size of DG and DER for Minimizing Power Loss and...
IRJET Journal
 
International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)
ijceronline
 
Al04605265270
Al04605265270Al04605265270
Al04605265270
IJERA Editor
 
Sequences classification based on group technology for flexible manufacturing...
Sequences classification based on group technology for flexible manufacturing...Sequences classification based on group technology for flexible manufacturing...
Sequences classification based on group technology for flexible manufacturing...
eSAT Journals
 

Similar to IE-301_OptionalProject_Group2_Report (20)

Composable Energy Modeling for ML-Driven Drone Applications
Composable Energy Modeling for ML-Driven Drone ApplicationsComposable Energy Modeling for ML-Driven Drone Applications
Composable Energy Modeling for ML-Driven Drone Applications
 
IRJET- Parallelization of Definite Integration
IRJET- Parallelization of Definite IntegrationIRJET- Parallelization of Definite Integration
IRJET- Parallelization of Definite Integration
 
MULTI-OBJECTIVE ANALYSIS OF INTEGRATED SUPPLY CHAIN PROBLEM
MULTI-OBJECTIVE ANALYSIS OF INTEGRATED SUPPLY CHAIN PROBLEMMULTI-OBJECTIVE ANALYSIS OF INTEGRATED SUPPLY CHAIN PROBLEM
MULTI-OBJECTIVE ANALYSIS OF INTEGRATED SUPPLY CHAIN PROBLEM
 
IRJET- Comparison for Max-Flow Min-Cut Algorithms for Optimal Assignment Problem
IRJET- Comparison for Max-Flow Min-Cut Algorithms for Optimal Assignment ProblemIRJET- Comparison for Max-Flow Min-Cut Algorithms for Optimal Assignment Problem
IRJET- Comparison for Max-Flow Min-Cut Algorithms for Optimal Assignment Problem
 
Optimization of Time Restriction in Construction Project Management Using Lin...
Optimization of Time Restriction in Construction Project Management Using Lin...Optimization of Time Restriction in Construction Project Management Using Lin...
Optimization of Time Restriction in Construction Project Management Using Lin...
 
A Hybrid Data Clustering Approach using K-Means and Simplex Method-based Bact...
A Hybrid Data Clustering Approach using K-Means and Simplex Method-based Bact...A Hybrid Data Clustering Approach using K-Means and Simplex Method-based Bact...
A Hybrid Data Clustering Approach using K-Means and Simplex Method-based Bact...
 
IRJET - Design of a Low Power Serial- Parallel Multiplier with Low Transition...
IRJET - Design of a Low Power Serial- Parallel Multiplier with Low Transition...IRJET - Design of a Low Power Serial- Parallel Multiplier with Low Transition...
IRJET - Design of a Low Power Serial- Parallel Multiplier with Low Transition...
 
Application of local search methods for solving a quadratic assignment proble...
Application of local search methods for solving a quadratic assignment proble...Application of local search methods for solving a quadratic assignment proble...
Application of local search methods for solving a quadratic assignment proble...
 
Questions On The Equation For Regression
Questions On The Equation For RegressionQuestions On The Equation For Regression
Questions On The Equation For Regression
 
Paper id 37201520
Paper id 37201520Paper id 37201520
Paper id 37201520
 
A fast fpga based architecture for measuring the distance between
A fast fpga based architecture for measuring the distance betweenA fast fpga based architecture for measuring the distance between
A fast fpga based architecture for measuring the distance between
 
AMAZON STOCK PRICE PREDICTION BY USING SMLT
AMAZON STOCK PRICE PREDICTION BY USING SMLTAMAZON STOCK PRICE PREDICTION BY USING SMLT
AMAZON STOCK PRICE PREDICTION BY USING SMLT
 
J045075661
J045075661J045075661
J045075661
 
Scientific calculator project in c language
Scientific calculator project in c languageScientific calculator project in c language
Scientific calculator project in c language
 
Sequences classification based on group technology
Sequences classification based on group technologySequences classification based on group technology
Sequences classification based on group technology
 
D05511625
D05511625D05511625
D05511625
 
IRJET- Optimal Placement and Size of DG and DER for Minimizing Power Loss and...
IRJET- Optimal Placement and Size of DG and DER for Minimizing Power Loss and...IRJET- Optimal Placement and Size of DG and DER for Minimizing Power Loss and...
IRJET- Optimal Placement and Size of DG and DER for Minimizing Power Loss and...
 
International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)
 
Al04605265270
Al04605265270Al04605265270
Al04605265270
 
Sequences classification based on group technology for flexible manufacturing...
Sequences classification based on group technology for flexible manufacturing...Sequences classification based on group technology for flexible manufacturing...
Sequences classification based on group technology for flexible manufacturing...
 

IE-301_OptionalProject_Group2_Report

  • 1. IE-301 Integer Linear Programming Modelling and Implementation pg. 1 IE-301 Optional Project Integer Linear Programming Modeling and Implementation Fall 2016 Group #3 Project Group Members: Sarp Uzel 18184 Barışcan Savaş16590 Utku Suer 16531 Supervised By:Kerem Bülbül Date:08/12/2016
  • 2. IE-301 Integer Linear Programming Modelling and Implementation pg. 2 Table of Contents Abstract................................................................................................................................................... 3 Introduction............................................................................................................................................ 3 Part A....................................................................................................................................................... 6 Part B..................................................................................................................................................... 11 Part C..................................................................................................................................................... 15 APPENDIX.............................................................................................................................................. 20 Code for connecting the data file in part A:.......................................................................................... 20 Code for connecting the data file in part B and C:................................................................................ 20 References: ........................................................................................................................................... 20
  • 3. IE-301 Integer Linear Programming Modelling and Implementation pg. 3 Abstract The Linear Integer Programming is a widely used method in optimization of warehouse selection problems(or p-median problems or location-allocation) by many Industrial Engineers.This project focuses on a p-median problem, where the project members were assumed to imagine Turkey’s well known charity organzation require them to find the optimal values for disturbing relief supplies from depots to districts.The members of the project group were asked to minimize the total cost of disturbing relief items, which are supplied by Kızılay, to 13 different disctricts located in the Asia part of Istanbul by selecting 5 depot points out of 13 districts and determining the number of supplies sent from 5 depots to 13 districts, in case of a disaster. The core important parts which separate this project’s problem from classical p- median problems can be listed as: the fact that the multi-sourcing is allowed, the fact that uncertainity is concerned.The project group, first structured the mathematical model of the Kızılay’s minimum cost warehouse selection problems in different scenerios and then implemented the model by using IBM ILOG CPLEX Optimization software, in order to find the solution of the Linear Integer Program.At the very end, the project group found the objective values for different demands of Kızılay as well as the optimum solution for decision variables. Introduction In this project, project team assumed that Kızılay is aware of the importance of the natural disasters, so they want to be ready to disturibute relief supplies that they have with respect to the different demands of different districts, under different types of circumstances, in case of a disaster. Not only do Kızılay require to distribute these items according to the demands
  • 4. IE-301 Integer Linear Programming Modelling and Implementation pg. 4 of the districts, but also they want to minimize the cost of disturbing these items. The problem states that there are 13 districts that have be supplied by 5 depots whom locations will be selected amoung the same 13 districts. All of the depot capacities for stocking relief supplies are the same for each depot candidate. The demands of the districts are given.The distance between two different districts is also provided as a 13x13 matrix.The depots can only serve to districts that are at most 20 km far away. The cost of carrying one item for 1 km is 1 TL. Every district must be assigned to atleast one depot. There is no fixed cost of opening a new depot. Below you can find the description of the original problem that is assigned to the project members:
  • 5. IE-301 Integer Linear Programming Modelling and Implementation pg. 5 The p-median problem is stated as:” Given a graph or a network G = (V, E), find Vp ⊆ V such that |Vp| = p, where p may either be variable or fixed (see Section 2.3), and that the sum of the shortest distances from the vertices in {V Vp} to their nearest vertex in Vp is minimized. In this section we provide an extended problem definition and a unified notation scheme.”( J. Reese,2005).
  • 6. IE-301 Integer Linear Programming Modelling and Implementation pg. 6 The reason why the project group state that this problem is also a p-median problem is the fact that it satisfies the requirements of p-median problems. Here are the criteria of p-median problem: (Jamshidi,2009) 1-The cost is directly proportional to the distance. 2-There is no time limit. 3-Total number of warehouses is known. 4-There is no fixed cost for opening a warehouse. 5-All warehouses have the same properties. 6-The candidates for warehouses are also known. Part A The data for distance,capacity and demands were all provided by the supervisor. Here is the data for distance between two districts: Here is the capacity data:
  • 7. IE-301 Integer Linear Programming Modelling and Implementation pg. 7 Here is the data for demand: First thing that the project team did was analyzing the data. By using the =MAX() funtion in excel, project team members determined the possible maximum relief item sent from district i to district j(i=1,2..,13; j=1,2..,13). Thus, analyze resulted in 6880.
  • 8. IE-301 Integer Linear Programming Modelling and Implementation pg. 8 The second step was to construct the MILP(Mixed Integer Linear Program) Parameters: M=6880 –Possible maximum item can be send from one district the another 𝑑𝑖𝑠𝑡𝑖𝑗=distance difference between district i and j—provided in the excel sheet(i=1,2..,13; j=1,2..,13). 𝑐𝑖=capacity of candidate i for stocking relief supplies. —provided in the excel sheet(j=1,2..,13). 𝑑𝑒𝑚𝑗=demand of district j-—provided in the excel sheet(j=1,2..,13). Decision Variables: 𝑌𝑖=1 if candidate i is a depot , 0 else. (j=1,2..,13). 𝑋𝑖𝑗=1 if district i can carry relief items to district j, 0 else. (i=1,2..,13; j=1,2..,13). 𝑅𝑖𝑗=# of supplies carried from district i to district j(i=1,2..,13; j=1,2..,13). Objective Function: Minimize:Z=∑ ∑ (𝑑𝑖𝑠𝑡𝑖𝑗 ∗ 𝑅𝑖𝑗 13 𝑗=0 13 𝑖=1 *1) Constraints: ∑ 𝑌𝑖 13 𝑖=1 =5 –Number of depot constraint. 𝑋İ𝐽 ≤ 𝑌İ (i=1,2..,13; j=1,2..,13)---i can only carry items to j if and only if there is a depot in i ∑ 𝑋İ𝐽 13 𝑖=1 ≥ 1 (i=1,2..,13; j=1,2..,13)---j must be supplied by at least one depot ∑ 𝑅İ𝐽 13 𝑗=1 ≤ 𝑌İ ∗ 𝑐𝑖 (i=1,2..,13; j=1,2..,13)---i is capable of suppliying items with respect to its capacity 𝑋İ𝐽 ≤ 20 ∗ 𝑑𝑖𝑠𝑡𝑖𝑗(i=1,2..,13; j=1,2..,13)---if the distance is more than 20 km i can’t serve j. ∑ 𝑅İ𝐽 13 𝑖=1 =𝑑𝑒𝑚𝑗 (i=1,2..,13; j=1,2..,13)---#number of items sent to j should be equal to demand of j 𝑅𝑖𝑗 ≤ 𝑀 ∗ 𝑋𝑖𝑗 –at most M number of items can be sent from i to j 𝑅𝑖𝑗 ≥0 𝑋İ𝐽 , 𝑌İ 𝜖(0,1) Here is the CPLEX code: int M=6880;//Maximum demand of one district int NDistricts=13;//There are 13 districts that will be supplied range I=1..NDistricts;//Set of candidates for depot locations range J=1..NDistricts;//Set of districts //Note that there are in total 13 districts and also 13 canditates //Also note that "..." meaning that data is going to be chosen from the excel file //in the following lines int dist[i in I,j in J]=...;//Distance from location i to location j
  • 9. IE-301 Integer Linear Programming Modelling and Implementation pg. 9 int dem[j in J]=...;//Demand of location i for relief supplies int c[i in I]=...;//Capacity of each candidate distribution points dvar boolean y[i in I];//if candidate i is assigned as a depot it takes value "1" dvar boolean X[i in I,j in J];//if location j is assigned to depot location i x takes value "1" dvar int+ R[i in I,j in J];//ammount of supply coming from dist point i to j dvar int Z;//The objective function minimize Z; subject to{ Z==sum(i in I,j in J) dist[i,j]*R[i,j] ;//since the price of one relief supply for per km travelled is one we can directly multiply demand by distance sum(i in I)y[i]==5;//The project concerns to locate 5 depots forall(i in I,j in J) X[i,j]<=y[i];// i can only carry items to j if and only if there is a depot in i forall(j in J) sum(i in I)X[i,j]>=1;//Every district must be attained to a distribution point(atleast) forall(i in I) sum(j in J)R[i,j]<=y[i]*c[i];//capacity constraint forall(j in J) sum(i in I)R[i,j]==dem[j];//demand of j should be satisfied forall(i in I,j in J) R[i,j]<=M*X[i,j];//maximum number of supply carried from i to j forall(i in I,j in J) X[i,j]*dist[i,j]<=20;//distance constraint }
  • 10. IE-301 Integer Linear Programming Modelling and Implementation pg. 10 Here are the optimal solutions provided by IBM ILOG : // solution (optimal) with objective 274980 // Quality Incumbent solution: // MILP objective 2.7498000000e+005 // MILP solution norm |x| (Total, Max) 3.26606e+005 2.74980e+005 // MILP solution error (Ax=b) (Total, Max) 0.00000e+000 0.00000e+000 // MILP x bound error (Total, Max) 0.00000e+000 0.00000e+000 // MILP x integrality error (Total, Max) 0.00000e+000 0.00000e+000 // MILP slack bound error (Total, Max) 0.00000e+000 0.00000e+000 // Z = 274980; R = [[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] [4190 0 220 4650 0 0 0 0 0 0 0 0 5400] [0 0 0 0 4570 4870 0 0 0 0 2340 0 0] [0 0 0 0 0 0 0 0 0 0 0 0 0] [0 0 0 0 0 0 6810 0 3210 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 330 0 0 0] [0 0 0 0 0 0 0 0 0 0 0 0 0] [0 2490 2090 0 0 0 0 3540 0 0 0 6880 0] [0 0 0 0 0 0 0 0 0 0 0 0 0]]; y = [0 0 0 1 1 0 1 0 0 1 0 1 0]; X = [[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 0 1 1 1 1 0 1 0 0 0 1 1] [0 0 0 1 1 1 1 0 1 0 1 0 1] [0 0 0 0 0 0 0 0 0 0 0 0 0] [1 0 0 0 1 1 1 1 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 0 0] [0 0 0 0 0 0 0 0 0 1 0 0 0] [0 0 0 0 0 0 0 0 0 0 0 0 0] [1 1 1 1 0 1 0 1 0 0 0 1 1] [0 0 0 0 0 0 0 0 0 0 0 0 0]]; Optimal objective function value:274980 TL Above one can see that all of the demands given in the excel sheet was satisfied from the objective value of R[i,j]( 𝑅𝑖𝑗). Computational Time:01:44
  • 11. IE-301 Integer Linear Programming Modelling and Implementation pg. 11 Part B In part B,there are different scenarios and each scenario must be satisfied.Kızılay do not want to risk anything, hence our program is to determine the specific number of items sent from i to j which satisfies all the scenarios.There are 20 different scenarios in this part; in addition , all must be satisfied.Here are the demand data for different scenarios: The maximum number of demand again is calculated, in order to decide the possible maximum number of item distribution.
  • 12. IE-301 Integer Linear Programming Modelling and Implementation pg. 12 Parameters: MS=7377 –Possible maximum item can be send from one district the another 𝑑𝑖𝑠𝑡𝑖𝑗=distance difference between district i and j—provided in the excel sheet(i=1,2..,13; j=1,2..,13). 𝑐𝑖=capacity of candidate i for stocking relief supplies. —provided in the excel sheet(j=1,2..,13). 𝑢𝑐𝑑𝑒𝑚𝑗𝑠= uncertain demand of district j with respect to scenario s-—provided in the excel sheet(j=1,2..,13,s=1,2,3,..20). Decision Variables: 𝑌𝑖=1 if candidate i is a depot , 0 else. (j=1,2..,13). 𝑋𝑖𝑗=1 if district i can carry relief items to district j, 0 else. (i=1,2..,13; j=1,2..,13). 𝑅𝑖𝑗=# of supplies carried from district i to district j(i=1,2..,13; j=1,2..,13). Objective Function: Minimize:Z=∑ ∑ (𝑑𝑖𝑠𝑡𝑖𝑗 ∗ 𝑅𝑖𝑗 13 𝑗=0 13 𝑖=1 *1) Constraints: ∑ 𝑌𝑖 13 𝑖=1 =5 –Number of depot constraint. 𝑋İ𝐽 ≤ 𝑌İ (i=1,2..,13; j=1,2..,13)---i can only carry items to j if and only if there is a depot in i ∑ 𝑋İ𝐽 13 𝑖=1 ≥ 1 (i=1,2..,13; j=1,2..,13)---j must be supplied by at least one depot ∑ 𝑅İ𝐽 13 𝑗=1 ≤ 𝑌İ ∗ 𝑐𝑖 (i=1,2..,13; j=1,2..,13)---i is capable of suppliying items with respect to its capacity 𝑋İ𝐽 ≤ 20 ∗ 𝑑𝑖𝑠𝑡𝑖𝑗(i=1,2..,13; j=1,2..,13)---if the distance is more than 20 km i can’t serve j. ∑ 𝑅İ𝐽 13 𝑖=1 ≥ 𝑢𝑐𝑑𝑒𝑚𝑗𝑠 (i=1,2..,13; j=1,2..,13; s=1,2,3...20)---in order to satisfy all demands under every scenario 𝑅𝑖𝑗 ≤ 𝑀𝑆 ∗ 𝑋𝑖𝑗 –at most MS number of items can be sent from i to j 𝑅𝑖𝑗 ≥0 𝑋İ𝐽 , 𝑌İ 𝜖(0,1) Here is the CPLEX code: int NDistricts=13;//There are 13 districts that will be supplied range I=1..NDistricts;//Set of candidates for depot locations range J=1..NDistricts;//Set of districts //Note that there are in total 13 districts and also 13 canditates //Also note that "..." meaning that data is going to be chosen from the excel file
  • 13. IE-301 Integer Linear Programming Modelling and Implementation pg. 13 //in the following lines int dist[i in I,j in J]=...;//Distance from location i to location j int c[i in I]=...;//Capacity of each candidate distribution points int Nscenarios=20;//Number of Scenarios range S=1..Nscenarios;//Set of Scenarios int ucdemand[j in J,s in S]=...; int MS=7377; dvar boolean y[i in I];//if candidate i is assigned as a depot it takes value "1" dvar boolean X[i in I,j in J];//if location j is assigned to depot location i x takes value "1" dvar int+ R[i in I,j in J];//ammount of supply coming from dist point i to j dvar int Z;//The objective function minimize Z; subject to{ Z==sum(i in I,j in J) dist[i,j]*R[i,j] ;//since the price of one relief supply for per km travelled is one we can directly multiply demand by distance sum(i in I)y[i]==5;//The project concerns to locate 5 depots forall(i in I,j in J) X[i,j]<=y[i]; forall(j in J) sum(i in I)X[i,j]>=1;//Every district must be attained to a distribution point(atleast) forall(i in I) sum(j in J)R[i,j]<=y[i]*c[i]; //capacity constraint forall(i in I,j in J) X[i,j]*dist[i,j]<=20;//distance constraint forall(j in J,s in S) sum(i in I)R[i,j]>=ucdemand[j,s]; //demand constraint forall(i in I,j in J) R[i,j]<=MS*X[i,j];//possible maximum number of supply sent
  • 14. IE-301 Integer Linear Programming Modelling and Implementation pg. 14 } Here is the report: // solution (optimal) with objective 311658 // Quality Incumbent solution: // MILP objective 3.1165800000e+005 // MILP solution norm |x| (Total, Max) 3.67913e+005 3.11658e+005 // MILP solution error (Ax=b) (Total, Max) 0.00000e+000 0.00000e+000 // MILP x bound error (Total, Max) 0.00000e+000 0.00000e+000 // MILP x integrality error (Total, Max) 0.00000e+000 0.00000e+000 // MILP slack bound error (Total, Max) 0.00000e+000 0.00000e+000 // Z = 311658; R = [[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] [4347 0 0 4962 0 0 0 0 0 0 0 0 5691] [0 0 0 0 4899 5191 0 0 0 0 2711 0 0] [0 0 0 0 0 0 0 0 0 0 0 0 0] [240 0 0 0 0 0 7228 1665 3553 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 732 0 0 0] [0 0 0 0 0 0 0 0 0 0 0 0 0] [0 2680 2754 0 0 0 0 2189 0 0 0 7377 0] [0 0 0 0 0 0 0 0 0 0 0 0 0]]; y = [0 0 0 1 1 0 1 0 0 1 0 1 0]; X = [[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 0 1 1 1 1 0 1 0 0 0 1 1] [0 0 0 1 1 1 1 0 1 0 1 0 1] [0 0 0 0 0 0 0 0 0 0 0 0 0] [1 0 0 0 1 1 1 1 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 0 0] [0 0 0 0 0 0 0 0 0 1 0 0 0] [0 0 0 0 0 0 0 0 0 0 0 0 0] [1 1 1 1 0 1 0 1 0 0 0 1 1] [0 0 0 0 0 0 0 0 0 0 0 0 0]]; Optimal objective value is=311658 Computational Time: 01:70 It is no surprise that summation of the elements in the columns of R matrix is equal to the maximum demand for the corresponding district under among all scenarios.This is the only way to satisfy all the scenarios. Part B will give the maximum optimal cost for this problem, since the program collects the maximum demand for each district out of 20 scenarios, in order to satisfy all the scenarios.This is why the optimal objective value is higher than the part a. Moreover; computational time increased when part b is compared to the part a which means that the software spent more computational effort.This is
  • 15. IE-301 Integer Linear Programming Modelling and Implementation pg. 15 just because adding new constraint **∑ 𝑅İ𝐽 13 𝑖=1 ≥ 𝑢𝑐𝑑𝑒𝑚𝑗𝑠**. This constraint definetely increased the complexity of the problem. For(j=1;j<=13;i++) For(s=1;s<=10;s++) For(i=1;i<=13;i++) The complexity of this psedue-code which is the representation of the **∑ 𝑅İ𝐽 13 𝑖=1 ≥ 𝑢𝑐𝑑𝑒𝑚𝑗𝑠** constraint is basically j*s*i. The interesting part is optimal depot locations are the same as part a. And also optimal values for 𝑋İ𝐽’s Are the same.This explains why the cost is higher than part a better.Since, matrix R is the multiplied version of matrix X. Since X matrices are same for part a and b, also the summation of the columns are higher than part a the optimal objective function value is also greater than part a. Obviously number of items sent from i to j in part b is greater than the items sent from i to j in part a, hence the optimal solution of part b’s objective function is greater,since they have the same depot locations and same assignments for depots. Part C In this part, the uncertain data did not change.However, in the first phase of the question, it is stated that Kızılay is optimistic and it is enough to satisfy 80 percent of the scenarios.In the second phase we will try the same problem with 60 percent satisfaction of scenarios. Parameters: MS=7377 –Possible maximum item can be send from one district the another 𝑑𝑖𝑠𝑡𝑖𝑗=distance difference between district i and j—provided in the excel sheet(i=1,2..,13; j=1,2..,13). 𝑐𝑖=capacity of candidate i for stocking relief supplies. —provided in the excel sheet(j=1,2..,13). 𝑢𝑐𝑑𝑒𝑚𝑗𝑠= uncertain demand of district j with respect to scenario s-—provided in the excel sheet(j=1,2..,13,s=1,2,3,..20).
  • 16. IE-301 Integer Linear Programming Modelling and Implementation pg. 16 Decision Variables: 𝑌𝑖=1 if candidate i is a depot , 0 else. (j=1,2..,13). 𝑋𝑖𝑗=1 if district i can carry relief items to district j, 0 else. (i=1,2..,13; j=1,2..,13). 𝑅𝑖𝑗=# of supplies carried from district i to district j(i=1,2..,13; j=1,2..,13). 𝑆𝑐𝑛 𝑠=If scenario s is satisfied it returns 1; 0 otherwise (s=1,2,3...20) Objective Function: Minimize:Z=∑ ∑ (𝑑𝑖𝑠𝑡𝑖𝑗 ∗ 𝑅𝑖𝑗 13 𝑗=0 13 𝑖=1 *1) Constraints: ∑ 𝑌𝑖 13 𝑖=1 =5 --Number of depot constraint. 𝑋İ𝐽 ≤ 𝑌İ (i=1,2..,13; j=1,2..,13)---i can only carry items to j if and only if there is a depot in i ∑ 𝑋İ𝐽 13 𝑖=1 ≥ 1 (i=1,2..,13; j=1,2..,13)---j must be supplied by at least one depot ∑ 𝑅İ𝐽 13 𝑗=1 ≤ 𝑌İ ∗ 𝑐𝑖 (i=1,2..,13; j=1,2..,13)---i is capable of suppliying items with respect to its capacity 𝑋İ𝐽 ≤ 20 ∗ 𝑑𝑖𝑠𝑡𝑖𝑗(i=1,2..,13; j=1,2..,13)---if the distance is more than 20 km i can’t serve j. ∑ 𝑅İ𝐽 13 𝑖=1 ≥ 𝑢𝑐𝑑𝑒𝑚𝑗𝑠 *𝑆𝑐𝑛 𝑠 (i=1,2..,13; j=1,2..,13; s=1,2,3...20)---in order to satisfy all demands under every scenario 𝑅𝑖𝑗 ≤ 𝑀𝑆 ∗ 𝑋𝑖𝑗 –at most MS number of items can be sent from i to j ∑13 𝑖=1 𝑆𝑐𝑛 𝑠=16 (s=1,2,3...20) 𝑅𝑖𝑗 ≥0 ,𝑋İ𝐽 , 𝑌İ 𝑆𝑐𝑛 𝑠 𝜖(0,1) (i=1,2..,13; j=1,2..,13; s=1,2,3...20) Here is the CPLEX code: int NDistricts=13;//There are 13 districts that will be supplied range I=1..NDistricts;//Set of candidates for depot locations range J=1..NDistricts;//Set of districts //Note that there are in total 13 districts and also 13 canditates //Also note that "..." meaning that data is going to be chosen from the excel file //in the following lines int dist[i in I,j in J]=...;//Distance from location i to location j int c[i in I]=...;//Capacity of each candidate distribution points int Nscenarios=20;//Number of Scenarios range S=1..Nscenarios;//Set of Scenarios int ucdemand[j in J,s in S]=...; int MS=7377; dvar boolean y[i in I];//if candidate i is assigned as a depot it takes value "1" dvar boolean X[i in I,j in J];//if location j is assigned to depot location i x takes value "1"
  • 17. IE-301 Integer Linear Programming Modelling and Implementation pg. 17 dvar int+ R[i in I,j in J];//ammount of supply coming from dist point i to j dvar int Z;//The objective function dvar boolean Scn[s in S];//If scene s is satisfied then it returns 1 minimize Z; subject to{ Z==sum(i in I,j in J) dist[i,j]*R[i,j] ;//since the price of one relief supply for per km travelled is one we can directly multiply demand by distance sum(i in I)y[i]==5;//The project concerns to locate 5 depots forall(i in I,j in J) X[i,j]<=y[i];// i can serve j if and only if there is a depot in i forall(j in J) sum(i in I)X[i,j]>=1;//Every district must be assigned to a distribution point(atleast) forall(i in I) sum(j in J)R[i,j]<=y[i]*c[i];//capacity constraint forall(i in I,j in J) X[i,j]*dist[i,j]<=20;//distance constraint forall(j in J,s in S) sum(i in I)R[i,j]>=Scn[s]*ucdemand[j,s];//demand contraint of the satisfied scenarios sum(s in S)Scn[s]==16;//80 percent satisfaction of scenarios forall(i in I,j in J) R[i,j]<=MS*X[i,j];//possible maximum number of carrying items from i to j }
  • 18. IE-301 Integer Linear Programming Modelling and Implementation pg. 18 Here is the report: // solution (optimal) with objective 303513 // Quality Incumbent solution: // MILP objective 3.0351300000e+005 // MILP solution norm |x| (Total, Max) 3.65988e+005 3.03513e+005 // MILP solution error (Ax=b) (Total, Max) 0.00000e+000 0.00000e+000 // MILP x bound error (Total, Max) 0.00000e+000 0.00000e+000 // MILP x integrality error (Total, Max) 0.00000e+000 0.00000e+000 // MILP slack bound error (Total, Max) 0.00000e+000 0.00000e+000 // Z = 303513; R = [[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] [4347 0 0 4962 0 0 0 0 0 0 0 0 5691] [0 0 0 0 4899 5191 0 0 0 0 2711 0 0] [0 0 0 0 0 0 0 0 0 0 0 0 0] [24 0 0 0 0 0 7228 1440 3553 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 7377 0 0 0] [0 0 0 0 0 0 0 0 0 0 0 0 0] [0 2680 2754 0 0 0 0 2189 0 0 0 7377 0] [0 0 0 0 0 0 0 0 0 0 0 0 0]]; y = [0 0 0 1 1 0 1 0 0 1 0 1 0]; X = [[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 0 1 1 1 1 0 1 0 0 0 1 1] [0 0 0 1 1 1 1 0 1 0 1 0 1] [0 0 0 0 0 0 0 0 0 0 0 0 0] [1 0 0 0 1 1 1 1 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 0 0] [0 0 0 0 0 0 0 0 0 1 0 0 0] [0 0 0 0 0 0 0 0 0 0 0 0 0] [1 1 1 1 0 1 0 1 0 0 0 1 1] [0 0 0 0 0 0 0 0 0 0 0 0 0]]; Scn = [0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0]; Optimal objective value when p=0.8 : 303513 TL Computational Time: 02:79 ***Note that R[10,10] is 7377 ; however, in demand/scenario data there is no demand as 7377 for Şile under any scenario. But, this is not going to change anything, since the distance between Şile and Şile is 0.Moreover; Şile is more than 20 km far away from any district, so it cannot send any items to any district and also there must be a depot in Şile to satisfy the demand of Şile. Therefore, Şile can
  • 19. IE-301 Integer Linear Programming Modelling and Implementation pg. 19 use all of the capacity it has just for itself with 0 cost. Also note that, scenarios 1,3,19,20 can not be satisfied. For the second part of the part c, all we need to modify line 59: ** sum(s in S)Scn[s]==12;//60 percent satisfaction of scenarios **(Make the summation of scenarios satisfied equal to 12 since it is enough) Here are the results: // solution (integer optimal, tolerance) with objective 296732 // Quality Incumbent solution: // MILP objective 2.9673200000e+005 // MILP solution norm |x| (Total, Max) 3.58456e+005 2.96732e+005 // MILP solution error (Ax=b) (Total, Max) 0.00000e+000 0.00000e+000 // MILP x bound error (Total, Max) 0.00000e+000 0.00000e+000 // MILP x integrality error (Total, Max) 0.00000e+000 0.00000e+000 // MILP slack bound error (Total, Max) 0.00000e+000 0.00000e+000 // Z = 296732; R = [[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] [4311 0 0 4962 0 0 0 0 0 0 0 0 5691] [0 0 0 0 4899 5098 0 0 0 0 2602 0 0] [0 0 0 0 0 0 0 0 0 0 0 0 0] [0 0 0 0 0 0 7228 955 3553 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 7377 0 0 0] [0 0 0 0 0 0 0 0 0 0 0 0 0] [0 2680 2623 0 0 0 0 2674 0 0 0 7023 0] [0 0 0 0 0 0 0 0 0 0 0 0 0]]; y = [0 0 0 1 1 0 1 0 0 1 0 1 0]; X = [[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 0 1 1 1 1 0 1 0 0 0 1 1] [0 0 0 1 1 1 1 0 1 0 1 0 1] [0 0 0 0 0 0 0 0 0 0 0 0 0] [1 0 0 0 1 1 1 1 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 0 0] [0 0 0 0 0 0 0 0 0 1 0 0 0] [0 0 0 0 0 0 0 0 0 0 0 0 0] [1 1 1 1 0 1 0 1 0 0 0 1 1] [0 0 0 0 0 0 0 0 0 0 0 0 0]]; Scn = [0 1 0 0 1 1 1 0 1 1 1 1 0 1 0 1 1 1 0 0]; Optimal value for objective function :296732TL
  • 20. IE-301 Integer Linear Programming Modelling and Implementation pg. 20 Computational Time: 02:73 Note that, scenarios 1,3,4,8,13,15,19,20 can not be satisfied. The optimal solutions for p=0.8 p=0.6 and p=1 are totally different. p=1>p=0.8>p=0.6. The main reason is when the all scenarios do not necessarily have to be satisfied, Cplex eliminates the scenarios which cost more ,since the objective funtion tries to minimize the cost.Number of items sent from i to j decreased for almost every element of the R matrix as p gets closer to 0. For instance when p=0.8 ammount of supply sent from 4 to 1 was 4371 but when p was P=0.6 of supply sent from 4 to 1 became 4311. This is what Cplex handles, as we decrese the size of the set of the feasible region for a minimization problem by relaxing the constraints, we are more prone to observe lower values for optimal objective funtion solution. The depot locations and their assignments in part c is again the same as part a and b. APPENDIX Code for connecting the data file in part A: SheetConnection sheet("KizilayData.xlsx"); dist from SheetRead(sheet,"Distances!B2:N14"); dem from SheetRead(sheet,"Demands_CaseA!B2:B14"); c from SheetRead(sheet,"Capacities!B2:B14"); Code for connecting the data file in part B and C: SheetConnection sheet("KizilayData.xlsx"); dist from SheetRead(sheet,"Distances!B2:N14"); c from SheetRead(sheet,"Capacities!B2:B14"); ucdemand from SheetRead(sheet,"Demands_CaseB_C!B2:U14"); References: Jamshidi, M. (2009). “Median Location Problem”, Facility Location: Concepts, Models, Algorithms and Case Studies, Ed. by. R.Z. Farahani and M. Hekmatfar, PhysicaVerlag Heidelberg, pp.177-191
  • 21. IE-301 Integer Linear Programming Modelling and Implementation pg. 21 J. Reese(2005) ” Methods for Solving the p-Median Problem: An Annotated Bibliography” pp.2-3