制定线性规划问题
对于了解线性规划的人来说,这可能是一个非常基本的问题。
我在 LP 上看到的大多数问题都与以下格式有些相似
max 3x+4y
subject to 4x-5y = -34
3x-5y = 10 (and similar other constraints)
。换句话说,我们在目标函数和约束函数中具有相同数量的未知数。
我的问题是目标函数中有 1 个未知变量,约束函数中有 3 个未知变量。
问题是这样的
Objective function: min w1
subject to:
w1 + 0.1676x + 0.1692y >= 0.1666
w1 - 0.1676x - 0.1692y >= -0.1666
w1 + 0.3039x + 0.3058y >= 0.3
w1 - 0.3039x - 0.3058y >= -0.3
x + y = 1
x >= 0
y >= 0
可以看出,目标函数只有一个未知数,即 w1 ,约束函数有 3 个(或者说 2)个未知数,即 w1, x 和y。
有人可以指导我如何解决这个问题,特别是使用 R 或 MATLAB 线性编程工具箱。
This may be quite a basic question for someone who knows linear programming.
In most of the problems that I saw on LP has somewhat similar to following format
max 3x+4y
subject to 4x-5y = -34
3x-5y = 10 (and similar other constraints)
So in other words, we have same number of unknown in objective and constraint functions.
My problem is that I have one unknown variable in objective function and 3 unknowns in constraint functions.
The problem is like this
Objective function: min w1
subject to:
w1 + 0.1676x + 0.1692y >= 0.1666
w1 - 0.1676x - 0.1692y >= -0.1666
w1 + 0.3039x + 0.3058y >= 0.3
w1 - 0.3039x - 0.3058y >= -0.3
x + y = 1
x >= 0
y >= 0
As can be seen, the objective function has only one unknown i.e. w1 and constraint functions have 3 (or lets say 2) unknown i.e w1, x and y.
Can somebody please guide me how to solve this problem, especially using R or MATLAB linear programming toolbox.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的目标仅涉及
w1
,但您仍然可以将其视为w1,x,y
的函数,其中w1
的系数为 1,并且x,y
的系数为零:一旦您看到这一点,您就可以按照通常的方式将其表示为“标准”LP。
Your objective only involves
w1
but you can still view it as a function ofw1,x,y
, where the coefficient ofw1
is 1, and the coeffs ofx,y
are zero:Once you see this you can formulate it in the usual way as a "standard" LP.
普拉萨德是正确的。目标函数中未知数的数量并不重要。您可以将不存在的未知数视为具有零系数。
使用Matlab 的
linprog
函数可以轻松求解该LP。了解更多有关
linprog
的详细信息,请参阅此处的文档。Prasad is correct. The number of unknowns in the objective function does not matter. You can view unknowns that are not present as having a zero coefficient.
This LP is easily solved using Matlab's
linprog
function. For moredetails on
linprog
see the documentation here.