Need helps in facility location problem using ILP
이전 댓글 표시
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
Ayesha Maroof
2018년 12월 7일
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?
답변 (1개)
Alan Weiss
2016년 2월 29일
0 개 추천
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
Wilson Chong
2016년 2월 29일
Alan Weiss
2016년 2월 29일
It would really do you good to work through the example I linked before. But here is a taste of the kind of thing that example describes.
If you have a linear constraint such as x(5) <= x(14), rewrite it to have the form
x(5) - x(14) <= 0;
Then, with an appropriate definition of an A matrix, you can write this constraint as
A*x <= 0;
Hint:
A = zeros(1,N);
A(5) = 1;
A(14) = -1;
b = 0;
If you have more inequalities, just add more rows to A and b.
Alan Weiss
MATLAB mathematical toolbox documentation
Wilson Chong
2016년 3월 1일
편집: Wilson Chong
2016년 3월 1일
Alan Weiss
2016년 3월 1일
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
카테고리
도움말 센터 및 File Exchange에서 Choose a Solver에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!