简体   繁体   English

为PuLP安装COIN-OR

[英]Installing COIN-OR for PuLP

I have solved simple MILP problems with PuLP and I believe 'model.solve()' without any parameters refers to the default solver. 我已经用PuLP解决了简单的MILP问题,并且我相信没有任何参数的'model.solve()'是指默认的求解器。 But for harder problems, it keeps running and and I can't get a result. 但是对于更棘手的问题,它可以继续运行,但我无法获得结果。 I'm wondering how I can install and add free solvers (ie not CPLEX or Gurobi) as a solver. 我想知道如何安装和添加免费的求解器(即不是CPLEX或Gurobi)作为求解器。 I found COIN-OR but I couldn't find the right structure and documentation to use it. 我找到了COIN-OR,但找不到合适的结构和文档来使用它。 Any help would be greatly appreciated. 任何帮助将不胜感激。 Regards, Behrouz 此致Behrouz

  1. Install the solver. 安装求解器。 This will depend on solver and your operating system, but should be fairly googleable. 这将取决于求解器和您的操作系统,但是应该相当可谷歌搜索。

  2. Check its installed and pulp can access it by running: 检查其安装情况,并通过运行以下命令访问纸浆:

    import pulp

    pulp.pulpTestAll()

This will try all solvers and confirm which available. 这将尝试所有求解器并确认可用的求解器。

  1. Solve your model using model.solve(solver) . 使用model.solve(solver)解决模型。 For example model.solve(pulp.COIN_CMD()) 例如model.solve(pulp.COIN_CMD())

More here: https://scaron.info/blog/linear-programming-in-python-with-pulp.html 此处更多内容: https//scaron.info/blog/linear-programming-in-python-with-pulp.html

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

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