Optimization: Capacitated Facility Location Problem
조회 수: 39 (최근 30일)
이전 댓글 표시
Am tasked to solve the capacitated facility location problem, i.e.,
subject to
I've looked at intlinprog, but I don't understand how to use this function (if it's possible) to solve this type of problem due to the summations.
If it's possible, how would I go about?
댓글 수: 0
답변 (2개)
Matt J
2022년 11월 24일
편집: Matt J
2022년 11월 24일
x=optimvar('x',[n,m],'Upper',0);
y=optimvar('y',n,'type','integer','Lower',0,'Upper',1);
objective=sum(f(:).*y(:))+sum(c(:).*x(:));
constraints.colsum=sum(x,1)==d(:).';
constraints.rowsum=sum(x,2)<=s(:).*y(:);
solution=solve( optimproblem('Objective', objective,'Constraints', constraints ) );
댓글 수: 8
Matt J
2022년 11월 28일
편집: Matt J
2022년 11월 28일
The problem is not feasible because the d(j) values that you have supplied are all positive, while xij are constrained to be negative. That makes it impossible to satisfy .
Your second call to intlinprog doesn't show this because you have mixed up the order of some of the inputs:
[x,fval,exitflat,output]=intlinprog(p.f,p.intcon,p.Aineq,p.bineq,p.Aeq,p.beq,p.lb,p.ub)
John D'Errico
2022년 11월 24일
First, what is the difference between the summation over i in a sum like this:
sum(f(i)*yi))
and the dot product of two vectors:
f' * y
where f and y are column vectors of the same lengths?
Answer: Nothing, as long as the vectors are real numbers. If they could be complex, then I might need to worry about conjugate tranpose, versus transpose, but that is irrlevant here.
Is that not the first part of your objective? Next, look at the second term in the objective. x is apparently an array, of size n by m. Can you represent that double sum as a linear combination of the elements of x? (Yes.) You will need to use kron to do it.
Next, both x AND y are unknowns in the problem. So you will need to treat x and y as part of the same vector. essentially, you need to pack it all into one long vector.
I won't get more into those questions, since your problem as stated is meaningless. You have a fundamental flaw in the equatinos you wrote as equaity constraints.
You show the sum over i, of the matrix x(i,j). Once you sum over i, i goes away. The result cannot be another matrix d(i,j). Until you resolve that, this problem has no solution.
댓글 수: 5
Torsten
2022년 11월 24일
You have c_ij for 1 <= i < = 5 and 1 <= j <= 3
So c in your example should be 5x3, not 3x5.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!