Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

How to solve linear programming problem?

1 visualización (últimos 30 días)
Nika Dolnikava
Nika Dolnikava el 26 de Jul. de 2020
Cerrada: John D'Errico el 27 de Jul. de 2020
I have a linear programming problem to solve. It looks like:
zx = max z
s.t. z ≤ c*y1 + y1*x
z ≤ c*y2 + y2*x
Σ x ≤ 5
Where:
c = 0
1
1
100
1
0
1
1
1
1
0
1
100
1
1
0
y1 = 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0
y2 = 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0.
x is an array of 16 numbers.
The result should be optimized for x.
How do I solve it using Matlab?
  2 comentarios
John D'Errico
John D'Errico el 27 de Jul. de 2020
Editada: John D'Errico el 27 de Jul. de 2020
Of course, having modified your question to a completely different question, my original answer is no longer valid for the problem posed. Your problem as posed, even in its new incarnation now does not even have a solution.
John D'Errico
John D'Errico el 27 de Jul. de 2020
WILL YOU PLEASE STOP POSTING DUPLICATE QUESTIONS?

Respuestas (1)

John D'Errico
John D'Errico el 27 de Jul. de 2020
Editada: John D'Errico el 27 de Jul. de 2020
Second answer, since the problem has now completely changed. Again, MATLAB is still totally unnecessary.
Since you will probably change the problem again after I respond, this is your current posted problem:
Maximize z, as a function of an unknown vector x.
s.t. z ≤ c*y1 + y1*x
z ≤ c*y2 + y2*x
Where:
c = 0
1
1
100
1
0
1
1
1
1
0
1
100
1
1
0
y1 = 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0
y2 = 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0.
x is an array of 16 numbers.
The result should be optimized for x.
Note that BOTH of the inequalities can be written as
z <= y1.*(c + x)
z <= y2.*(c + x)
Next, look at y1 and y2. We should see there are MULTIPLE cases where y1 and y2 are zero for both vectors.
y1 = [0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0];
y2 = [0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0];
find(y1 == 0 & y2 == 0)
ans =
1 4 5 6 7 9 10 11 13 14 15 16
So elements [1 4 5 6 7 9 10 11 13 14 15 16] have no impact at all in terms of x.
You can freely pick ANY value at all for those values of x.
As well, since the goal is to maximize z, the maximum value obtainable for z will be zero.
Finally, I'm a bit worried that you have a problem with matrix dimensions, since c is a COLUMN vector of size 16x1, but y1 and y2 are row vectors. That is, if x is a column vector, then we would have y1*x is a calar. However c*y1 and c*y2 would each be 16x16 arrays.
So honestly, I have no idea what you are asking to do here. I can make wild guesses at best, as I seem to be doing in my first answer and in this answer.

Community Treasure Hunt

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

Start Hunting!

Translated by