MPSolver 接口
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
用于优化的 Google 开源软件套件,
OR-Tools,提供 MPSolver 封装容器
用于求解线性规划和
混合整数编程问题。
要解决纯整数编程问题,您还可以使用
CP-SAT 求解器。
示例
以下页面举例说明了 MPSolver 的用法:
常见任务
以下部分介绍了与求解相关的常见任务
LP 和 MIP。
时间限制
以下示例展示了如何将搜索时间限制设置为 15 毫秒,
(使用 Glop 实现)。
Python
solver.set_time_limit(15)
C++
solver->set_time_limit(15);
Java
solver.setTimeLimit(15)
C#
solver.SetTimeLimit(15);
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-08-29。
[null,null,["最后更新时间 (UTC):2024-08-29。"],[],["OR-Tools offers MPSolver for linear and mixed integer programming, and CP-SAT for pure integer programming. It provides examples for solving problems like the Stigler diet, LP and MIP problems, bin packing, and assignment. Common tasks include setting search time limits, demonstrated with `set_time_limit` methods in Python, C++, Java, and C#; the example shows how to set the limit to 15 milliseconds. MPSolver can be used with Glop or SCIP.\n"]]