diet |
Builds and solves the classic diet problem. Demonstrates model construction and simple model modification – after the initial model is solved, a constraint is added to limit the number of dairy servings. |
C, C++, C#, Java, MATLAB, Python, VB |
diet2, diet3, diet4, dietmodel |
Python-only variants of the diet example that illustrate model-data separation. |
diet2.py, diet3.py, diet4.py, dietmodel.py |
facility |
Simple facility location model: given a set of plants and a set of warehouses, with transportation costs between them, this example finds the least expensive set of plants to open in order to satisfy product demand. This example demonstrates the use of MIP starts — the example computes an initial, heuristic solution and passes that solution to the MIP solver. |
C, C++, C#, Java, Python, VB |
netflow |
A Python-only example that solves a multi-commodity network flow model. It demonstrates the use of several Python modeling constructs, including dictionaries, tuples, and tuplelist objects. |
Python |
portfolio |
A Python-only example that solves a financial portfolio optimization model, where the historical return data is stored using the pandas package and the result is plotted using the matplotlib package. It demonstrates the use of pandas, NumPy, and Matplotlib in conjunction with Gurobi. |
Python |
sudoku |
Reads a Sudoku puzzle dataset from a file, builds a MIP model to solve that model, solves it, and prints the solution. |
C, C++, C#, Java, Python, VB |
workforce1 |
Formulates and solves a workforce scheduling model. If the model is infeasible, the example computes and prints an Irreducible Inconsistent Subsystem (IIS). |
C, C++, C#, Java, Python, VB |
workforce2 |
An enhancement of workforce1 . This example solves the same workforce scheduling model, but if the model is infeasible, it computes an IIS, removes one of the associated constraints from the model, and re-solves. This process is repeated until the model becomes feasible. Demonstrates constraint removal. |
C, C++, C#, Java, Python, VB |
workforce3 |
A different enhancement of workforce1 . This example solves the same workforce scheduling model, but if the model is infeasible, it adds artificial variables to each constraint and minimizes the sum of the artificial variables. This corresponds to finding the minimum total change in the right-hand side vector required in order to make the model feasible. Demonstrates variable addition. |
C, C++, C#, Java, Python, VB |
workforce4 |
An enhancement of workforce3. This example solves the same workforce scheduling model, but it starts with artificial variables in each constraint. It first minimizes the sum of the artificial variables. Then, it introduces a new quadratic objective to balance the workload among the workers. Demonstrates optimization with multiple objective functions. |
C, C++, C#, Java, Python, VB |
workforce5 |
An alternative enhancement of workforce3. This example solves the same workforce scheduling model, but it starts with artificial variables in each constraint. It formulates a multi-objective model where the primary objective is to minimize the sum of the artificial variables (uncovered shifts), and the secondary objective is to minimize the maximum difference in the number of shifts worked between any pair of workers. Demonstrates multi-objective optimization. |
C, C++, C#, Java, Python, VB |