$25
Task 1
Consider that an army has located its units in π locations and has to supply soldiers to π battlegrounds. The cost of supplying one soldier to from unit π to battleground π, is π&’. Also, there is a demand of at least π’ soldiers in battleground π, and there is an upper bound of π’& on the total number of soldiers who can be accommodated at unit location π. The task is to find the optimal fraction of demand for soldiers π’ to be met by the unit location π, denoted as π₯&’. This can be obtained by solving the linear program:
./0 π₯&’
&
π π’π. π‘π. 1 π’π₯&’ , … , π
’45
6
1 π₯&’ , … , π
&45
π₯&’ ∈ [0,1] ∀π, π
Here, the objective function measures total cost of transporting all soldiers. Note that, π’ ∗ π₯&’ are the number of soldiers supplied from location π to battleground π. The first set of constraints ensures that not more than π’& soldiers are supplied from location π, and the second set of constraints ensure that at least π’ soldiers are supplied to battleground π.
Input:
The input file format is:
<value of n <value of m
<vector of π’& (n numbers in one line) <vector of π’ (m numbers in one line)
<first row of cost matrix π&’ (m numbers in one line)
…
<last (nth) row of cost matrix π&’ (m numbers in one line)
Output:
Print input data: values of n and m, u vector, d vector, and c matrix.
Print the matrix of optimal allocation of soldiers from unit location I to battleground j: π’ ∗ π₯&’
Task 2:
Consider the problem of locating army units in at most π locations (facility points) for servicing the needs of πbattle grounds (demand points). Each facility point π has a cost of π&’ of supplying the demand point π, this could be the cost of transporting one soldier to from unit location π to battleground π. Each battleground π has a demand for π’ soldiers, assumed to be known. Moreover, each facility π has an initial fixed cost of π& of setting up, and an upper bound π’& on the demand for number of soldiers which can be accommodated. Let us say we want to open π of the π facilities. The problem is to find out the optimal fraction π₯&’ of the soldiers π’ which will be supplied by facility location π to battleground π. Additionally, we must find out which of the π locations should be used to set up unit facilities, maximum number of them being π. This can be solved using a mixed integer linear programming problem. Let π¦& be a binary integer variable denoting whether facility location π should be opened (π¦& = 1) or not (π¦& = 0). The optimization problem becomes:
6 3 6
min./0 1 1 π&’ ∗ π’ ∗ π₯&’ + 1 π& ∗ π¦&
& &45
π π’π. π‘π. 1 π’π₯&’ ≤ π’&π¦& ∀π = 1, … , π
’45
π₯&’ , … , π
1 π¦& ≤ k
&45
π₯&’ ∈ [0,1] ∀π, π
π¦& π
Here, the objective function measures total cost of transporting all soldiers (first term) and the total setup cost of all open facilities (second term). Note that, π’ ∗ π₯&’ are the number of soldiers supplied from location π to battleground π. If location π is not open (π¦& = 0) the upper bound is 0, otherwise it is π’&. The first set of constraints ensures that not more than π’& soldiers are supplied from location π, and the second set of constraints ensure that at least π’ soldiers are supplied to battleground π. Here, π¦& are integral binary variables.
Input:
The input file format is:
<value of n <value of m
<vector of π’& (n numbers in one line)
<vector of π& (n numbers in one line)
<vector of π’ (m numbers in one line)
<first row of cost matrix π&’ (m numbers in one line)
…
<last (nth) row of cost matrix π&’ (m numbers in one line)
Output:
Print input data: values of n and m, u vector, f vector, d vector, and c matrix.
Print the list of opened facilities: y vector.
Print the matrix of optimal allocation of soldiers from unit location I to battleground j: π’ ∗ π₯&’