英文:
How to specify which method you use in PuLP python?
问题
抱歉,我只翻译文本,不回答关于翻译的问题。
我是新手优化和Python,所以如果我的问题的答案很明显,我很抱歉。
我想在PuLP中使用修订型单纯形法,并且在文档中看到有一种方法可以指定求解器使用的方法,但我找不到如何做的方法。
文档链接:https://pythonhosted.org/PuLP/main/optimisation_concepts.html
英文:
I'm new to optimisation and python so sorry if answer to my question is obvious.
I wanted to use Revised Simplex Method in PuLP and i read in the documentation that there is an option to specify which method the solver uses but i could not find how to do it.
link to the documentation : https://pythonhosted.org/PuLP/main/optimisation_concepts.html
答案1
得分: 3
使用求解器COIN-CBC,您可以执行以下操作:
prob.solve(pulp.COIN_CMD(msg=1, options=['primalSimplex']))
或者
prob.solve(pulp.COIN_CMD(msg=1, options=['dualSimplex']))
备注:
- 您应该观察到不同的迭代次数。
- 双重单纯形法是默认选项。
- 我假设您所说的“修正单纯形法”是指原始单纯形法(CBC没有完全表单单纯形法,所以从这个角度来看,CBC中的所有单纯形法都是“修正”的)。
- 内点法可以通过
options=['barrier']
来选择。 - 对于大型线性规划问题,尝试这三种方法可能是有意义的。我不确定这些选项对于混合整数线性规划模型有什么作用(在这种情况下,最好信任线性规划的默认选项)。
英文:
Using the solver COIN-CBC, you can do:
prob.solve(pulp.COIN_CMD(msg=1, options=['primalSimplex']))
or
prob.solve(pulp.COIN_CMD(msg=1, options=['dualSimplex']))
Notes:
- You should observe somewhat different iteration counts.
- Dual simplex is the default.
- I assume you mean by "revised simplex" the primal simplex method (CBC has no full-tableau simplex so in that sense all Simplex methods in CBC are "revised").
- The interior point method can be selected with
options=['barrier']
. - For large LPs it may make sense to try out these three methods. I am not sure what these options do for MIP models (it is probably better to trust LP defaults in this case)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论