ממשק MPSolver
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
חבילת תוכנות הקוד הפתוח של Google לאופטימיזציה,
OR-Tools – מספק את ה-wrapper של MPSolver
לפתרון של תכנות לינארי
בעיות שקשורות לתכנות של מספרים שלמים מעורבים.
כדי לפתור בעיות תכנות של מספרים שלמים בלבד אפשר להשתמש
פותר CP-SAT.
דוגמאות
בדפים הבאים יש דוגמאות שממחישות את השימוש ב-MPSolver:
משימות נפוצות
בקטע הבא מוצגות משימות נפוצות שקשורות לפתרון
דפי נחיתה וקובצי MIP.
מגבלות זמן
הדוגמה הבאה מראה איך להגדיר מגבלת זמן חיפוש של 15 אלפיות השנייה כאשר:
באמצעות Glop.
Python
solver.set_time_limit(15)
C++
solver->set_time_limit(15);
Java
solver.setTimeLimit(15)
C#
solver.SetTimeLimit(15);
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2024-08-29 (שעון UTC).
[null,null,["עדכון אחרון: 2024-08-29 (שעון UTC)."],[[["\u003cp\u003eGoogle's OR-Tools provides the MPSolver for solving linear programming (LP) and mixed integer programming (MIP) problems.\u003c/p\u003e\n"],["\u003cp\u003eThe CP-SAT solver can be used for pure integer programming problems.\u003c/p\u003e\n"],["\u003cp\u003eOR-Tools offers various examples demonstrating MPSolver usage with different solvers like Glop and SCIP for LP, MIP, bin packing, and assignment problems.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can control the search time limit for solvers using the \u003ccode\u003eset_time_limit\u003c/code\u003e function across different programming languages like Python, C++, Java, and C#.\u003c/p\u003e\n"]]],["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"],null,["# MPSolver Interface\n\nGoogle's open source software suite for optimization,\n[OR-Tools](https://github.com/google/or-tools), provides the MPSolver wrapper\nfor solving [linear programming](/optimization/lp) and\n[mixed integer programming](/optimization/mip) problems.\n\nTo solve pure integer programming problems you can also use the\n[CP-SAT](/optimization/cp/cp_solver) solver.\n\nExamples\n--------\n\nThe following pages provide examples that illustrate MPSolver usage:\n\n- [Solving the Stigler diet problem](/optimization/lp/stigler_diet) using Glop\n- [Solving an LP problem](/optimization/lp/lp_example) using Glop\n- [Solving a MIP problem](/optimization/mip/mip_example) using SCIP\n- [Solving a bin packing problem](/optimization/pack/bin_packing) using SCIP\n- [Solving an assignment problem](/optimization/assignment/assignment_example) using CP-SAT\n- [Using arrays to define a model](/optimization/mip/mip_var_array)\n\nCommon tasks\n------------\n\nThe following section demonstrates common tasks related to solving\nand .\n\n### Time limits\n\nThe example below shows how to set a search time limit of 15 milliseconds when\nusing . \n\n### Python\n\n```python\nsolver.set_time_limit(15)\n```\n\n### C++\n\n```c++\nsolver-\u003eset_time_limit(15);\n```\n\n### Java\n\n```java\nsolver.setTimeLimit(15)\n```\n\n### C#\n\n```c#\nsolver.SetTimeLimit(15);\n```\n\n*[Glop]: Google Linear Optimization\n*[MIPs]: Mixed Integer Programming\n*[LPs]: Linear Programming"]]