Optimization: Capacitated Facility Location Problem
39 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (2)
Matt J
el 24 de Nov. de 2022
Editada: Matt J
el 24 de Nov. de 2022
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 comentarios
Sebastian Daneli
el 28 de Nov. de 2022
Editada: Sebastian Daneli
el 28 de Nov. de 2022
Matt J
el 28 de Nov. de 2022
Editada: Matt J
el 28 de Nov. de 2022
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
el 24 de Nov. de 2022
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 comentarios
Sebastian Daneli
el 24 de Nov. de 2022
Editada: Sebastian Daneli
el 24 de Nov. de 2022
Torsten
el 24 de Nov. de 2022
You have c_ij for 1 <= i < = 5 and 1 <= j <= 3
So c in your example should be 5x3, not 3x5.
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!