Linear programming, interested in only 1 variable
1 次查看(过去 30 天)
显示 更早的评论
Hello
It might be a stupid question, but I'm a bit confused. You have
inequalities, want to find the smallest for example
value.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/238528/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/238529/image.png)
So you need to solve
s.t.
. Calling a solver will give a result with ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/238532/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/238530/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/238531/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/238532/image.png)
Is this the correct way to solve it?
variable values are meaningless
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/238533/image.png)
0 个评论
采纳的回答
Bruno Luong
2019-9-16
编辑:Bruno Luong
2019-9-16
If you want to minimize x1 under A*x <= b
f = zeros(size(x));
f(1) = 1;
x = linprog(f, A, b);
(x2,...,xn) is not meaningless, it's the associate components such that your constraint A*x <= b is satisfied.
Imagine you want to find most left corner of a 2D triangle.
It can be written as
A*x <= b
with x is 2 x 1, A is 3 x 2, b and 3 x 1.
the LINPROG returns you (x1,x2) coordinates of the left most corner (minimize x1) even if you ignore x2 it's still the ordinate of the corner.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!