简体   繁体   English

如何指定你在 PuLP python 中使用的方法?

[英]How to specify which method you use in PuLP python?

I'm new to optimisation and python so sorry if answer to my question is obvious.我是优化和 python 的新手,如果我的问题的答案很明显,我很抱歉。

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.我想在 PuLP 中使用修订的单纯形法,我在文档中读到有一个选项可以指定求解器使用哪种方法,但我找不到如何去做。

link to the documentation : https://pythonhosted.org/PuLP/main/optimisation_concepts.html文档链接: https : //pythonhosted.org/PuLP/main/optimisation_concepts.html

Using the solver COIN-CBC, you can do:使用求解器 COIN-CBC,您可以:

 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").我假设您所说的“修订单纯形”是指原始单纯形方法(CBC 没有全表单纯形,因此从这个意义上说,CBC 中的所有单纯形方法都是“修订”的)。
  • The interior point method can be selected with options=['barrier'] .可以使用options=['barrier']选择内点方法。
  • For large LPs it may make sense to try out these three methods.对于大型 LP,尝试这三种方法可能是有意义的。 I am not sure what these options do for MIP models (it is probably better to trust LP defaults in this case)我不确定这些选项对 MIP 模型有什么作用(在这种情况下最好信任 LP 默认值)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM