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);
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-08-29 (世界標準時間)。
[null,null,["上次更新時間:2024-08-29 (世界標準時間)。"],[[["Google's OR-Tools provides the MPSolver for solving linear programming (LP) and mixed integer programming (MIP) problems."],["The CP-SAT solver can be used for pure integer programming problems."],["OR-Tools offers various examples demonstrating MPSolver usage with different solvers like Glop and SCIP for LP, MIP, bin packing, and assignment problems."],["Developers can control the search time limit for solvers using the `set_time_limit` function across different programming languages like Python, C++, Java, and C#."]]],["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"]]