单纯形法/线性规划帮助
在编写实现单纯形方法的算法之前,我认为我应该在实际编程工作开始之前解决一个问题。
由于某种原因,我永远无法得到正确的答案。我已经理解了该方法,但问题在于行操作 - 您尝试让一列的值全部为 0,但主元元素的值为“1”。
为此,我通过执行 R1-R2、R2+5R1 等操作来处理行。我总是设法使枢轴列为 1,其余为 0,但是我的答案永远不会与正确的答案匹配。我已将其范围缩小到行操作的问题 - 是否有与此相关的规则,或者我可以随心所欲地处理行吗?另外,我可以将旧的画面和当前的画面混合起来吗?
谢谢
Before programming an algorithm which implements the simplex method, I thought I'd solve an issue before the actual programming work begins.
For some reason, I can NEVER get the correct answer. I've understood the method, but the problem is with the row operations - where you try to get a column to have all 0 values except for the pivot element which has a value of '1'.
To do this, I play around with the rows by doing R1-R2, R2+5R1, etc. I always manage to get the pivot column to be 1 and the rest 0's, however my answers never match the correct ones. I've narrowed it down to a problem with the row operations - are there any rules related to this, or can I just play around with the rows as much as I like? Also, can I mix between older tableaux and the current one?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
听起来您正在通过添加和减去行的任意组合来获得零,就像将矩阵转换为行缩减梯形形式一样。在 Simplex 算法中,您仅被允许从其他行添加数据透视行的倍数。
您绝对不应该在解决方案中使用旧的画面。每次迭代应该只涉及当前的画面。
您是否正在为教育项目实施此方法?如果没有,有许多高度优化的库用于求解线性程序。
It sounds like you are adding and subtracting arbitrary combinations of rows to get zeros, like you would if you were transforming a matrix to row-reduced echelon form. In the Simplex algorithm, you are only allowed to add a multiple of the pivot row from the other rows.
You should definitely not be using older tableaus in your solution. Each iteration should only involve the current tableau.
Are you implementing this for an educational project? If not, there are many highly tuned libraries for solving linear programs.