Need helps in facility location problem using ILP

6 views (last 30 days)
Hi, I'm new to matlab. I need to run the facility location objective function in ILP but i dont know how do i start in the coding part. So I need to minimize the objective function min z=∑_(d∈D)∑_(v∈V),v≠od C_dv.x_dv , subject to constraints 1.∑_(v∈V) x_dv = 1 2.x_dv <= x_v 3.x_v <= K 4. x_dv and x_v is binary where c_dv is a set of constant value that i already have, x_dv and x_v is decision variable. I have to get the output of x_dv and x_v in a matrix where it shows 1 or 0. If x_v is 1 means choose site v to build a facility, otherwise 0. I have check some of the ILP example in matlab such as factory,warehouse,sales allocation. But I'm still a little bit not clear as I have 2 decision variables in the constraints, and how do i define my objective functions?
  1 Comment
Ayesha Maroof
Ayesha Maroof on 7 Dec 2018
Dear I am trying to solve the same function.Can you tell me how to define x_v (facility location) as a binary variable only?

Sign in to comment.

Answers (1)

Alan Weiss
Alan Weiss on 29 Feb 2016
The first step in making a model for solution by Optimization Toolbox is to put all of your decision variables into one vector of unknowns. This example gives one approach, but you don't have to name your variables. The example you refer to, Factory, Warehouse, Sales Allocation Model, shows different variables for products, warehouses, and sales locations, all combined into one vector of unknowns.
I think that, perhaps, you just need to spend more time examining the (admittedly complicated) Factory example, or any of the other MILP examples.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
  4 Comments
Wilson Chong
Wilson Chong on 1 Mar 2016
Edited: Wilson Chong on 1 Mar 2016
Thank you for making my problem clear.
so if i have a set of known values for the constant c_dv in 6x6 matrix in my objective function. Is this correct way to implement it?
%let x_dv = x
%let x_v = y
for ii = 1:6
for jj = 1:6
x(ii,jj) = Cost(ii,jj);
end
end
obj = [x(:);y(:)];
The question is do I need to include vector y in the objective function ?
Alan Weiss
Alan Weiss on 1 Mar 2016
If y is a vector of variables that you control, meaning that you want to find the optimal values, then yes, you need to include it in the objective function. If it does not contribute to the objective function, but only to constraints, then set the corresponding objective function coefficients to zero. See, for example, the example I first linked to, that I think you still might not have read.
Alan Weiss
MATLAB mathematical toolbox documentation

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!