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

huangapple go评论78阅读模式
英文:

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)

huangapple
  • 本文由 发表于 2020年1月3日 19:08:20
  • 转载请务必保留本文链接:https://go.coder-hub.com/59577518.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定