Interfaccia MPSolver
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
la suite di software open source di Google per l'ottimizzazione,
OR-Tools, fornisce il wrapper MPSolver
per risolvere la programmazione lineare e
problemi di programmazione di numeri interi misti.
Per risolvere problemi di programmazione di numeri interi puri puoi utilizzare anche
Risolutore CP-SAT.
Esempi
Le pagine seguenti forniscono esempi che illustrano l'utilizzo di MPSolver:
Attività comuni
La seguente sezione illustra attività comuni correlate alla risoluzione
LP e MIP.
Limiti di tempo
L'esempio seguente mostra come impostare un limite di tempo di ricerca di 15 millisecondi quando
utilizzando Glop.
Python
solver.set_time_limit(15)
C++
solver->set_time_limit(15);
Java
solver.setTimeLimit(15)
C#
solver.SetTimeLimit(15);
Salvo quando diversamente specificato, i contenuti di questa pagina sono concessi in base alla licenza Creative Commons Attribution 4.0, mentre gli esempi di codice sono concessi in base alla licenza Apache 2.0. Per ulteriori dettagli, consulta le norme del sito di Google Developers. Java è un marchio registrato di Oracle e/o delle sue consociate.
Ultimo aggiornamento 2024-08-29 UTC.
[null,null,["Ultimo aggiornamento 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"]]