|
| The travelling salesman problem: Using Xpress callbacks
|
| |
|
| Type: |
Programming |
| Rating: |
2 (easy-medium) |
| Description: |
The file tsp.py retrieves a problem instance from
https://www.math.uwaterloo.ca/tsp/world/countries.html and creates a corresponding TSP instance,
then solves it using the Xpress Optimizer library with the appropriate callback.
In tsp_numpy.py, a randomly generated TSP problem is modeled using NumPy vectors and matrices
and solved using the Optimizer's libraries and callback functions.
|
| File(s): |
tsp.py, tsp_numpy.py |
|
|
| The feasiblity pump:
|
| |
|
| Type: |
Programming |
| Rating: |
2 (easy-medium) |
| Description: |
Feasibility pump (prototype) using the Xpress Python interface. |
| File(s): |
feas_pump.py |
|
|
| The n-queens problem: Puzzle modeling
|
| |
|
| Type: |
Programming |
| Rating: |
2 (easy-medium) |
| Description: |
The n queens: place n queens on an nxn chessboard so that none of them can be eaten in one move. |
| File(s): |
n_queens.py |
|
|
| Min-cost-flow problem : Modeling a graph problem
|
| |
|
| Type: |
Programming |
| Rating: |
2 (easy-medium) |
| Description: |
Solving a min-cost-flow problem using the Xpress Python interface. |
| File(s): |
netflow.py |
|
|
| Solving Sudoku: Puzzle modeling
|
| |
|
| Type: |
Programming |
| Rating: |
4 (medium-difficult) |
| Description: |
Place numbers from 1 to 9 into a 9x9 grid such that no number repeats in any row, in any column, and in any 3x3 sub-grid. |
| File(s): |
sudoku.py |
|
|
| Multicommodity flow problem: Solve a multicommodity flow minimum cost optimization problem on a randomly created graph
|
| |
|
| Type: |
Programming |
| Rating: |
2 (easy-medium) |
| Description: |
Create a random directed graph using NumPy's random functions and then model and solve a minimum-cost multicommodity flow
problem constructed on that graph.
|
| File(s): |
multicommodity_flow.py |
|
|
| Find largest-area inscribed polygon: Nonlinear programming, trigonometric functions
|
| |
|
| Type: |
Programming |
| Rating: |
2 (easy-medium) |
| Description: |
Given n, find the n-sided polygon of largest area inscribed in the unit circle. |
| File(s): |
polygon.py |
|
|
| Solve a simple MIP using Benders decomposition: Benders decomposition, callbacks
|
| |
|
| Type: |
Programming |
| Rating: |
4 (medium-difficult) |
| Description: |
Solve a simple MIP using Benders decomposition. Courtesy of Georgios Patsakis (UC Berkeley, Amazon) and Richard L.-Y. Chen
(Amazon).
|
| File(s): |
benders_decomp.py |
|
|
| Create an iterative algorithm cutting stock problem:
|
| |
|
| Type: |
Programming |
| Rating: |
3 (intermediate) |
| Description: |
Use the modeling features to create an iterative solver for a cutting stock problem. |
| File(s): |
cuttingstock.py |
|
|
| Maximize the sum of logistic curves subject to linear and piecewise linear constraints:
|
| |
|
| Type: |
Programming |
| Rating: |
2 (easy-medium) |
| Description: |
Approximate the logistic curves using piecewise linear functions. |
| File(s): |
maxSumLogistic.py |
|
|
| Transportation problem with piecewise-linear costs:
|
| |
|
| Type: |
Programming |
| Rating: |
2 (easy-medium) |
| Description: |
Model a transportation problem where the cost are modeled using the xpress.problem.addpwlcons function.
|
| File(s): |
pwl_transp.py |
|
|
| Modeling Satisfiability and PseudoBoolean problems with MIP:
|
| |
|
| Type: |
Programming |
| Rating: |
4 (medium-difficult) |
| Description: |
The file gencons_sat.py provides a rudimentary SAT solver that translates a Satisfiability (SAT)
problem into a MIP and solves it, and gencons_pbo.py includes a basic solver of PseudoBoolean optimization
problems (PBO) that translates a problem into a MIP before solving it.
|
| File(s): |
gencons_sat.py, gencons_pbo.py |
|
|
| Multi-objective knapsack problem: Multi-objective MIP problem with binary variables
|
| |
|
| Type: |
Production planning |
| Rating: |
2 (easy-medium) |
| Description: |
Example of a multi-objective knapsack problem formulated with the Xpress Python interface. |
| File(s): |
multiobjknapsack.py |
|
|
| Goal programming: Lexicographic goal programming using the Xpress multi-objective API
|
| |
|
| Type: |
Production planning |
| Rating: |
3 (intermediate) |
| Description: |
This example tries to construct a production plan which meets four different
goals in order of priority.
|
| File(s): |
goalprog.py |
|
|
| Markowitz portfolio optimization: Multi-objective quadratic optimization
|
| |
|
| Type: |
Portfolio optimization |
| Rating: |
3 (intermediate) |
| Description: |
In Markowitz portfolio optimization there are two objectives: to maximize reward
while minimizing risk (i.e. variance). This example plots several points on the
optimal frontier using a blended multi-objective approach, and shows that a point
computed using a lexicographic approach also lies on this frontier.
|
| File(s): |
markowitz.py |
|
|
| Basic LP tasks: problem statement and solving; solution analysis: LP solving, modeling variables and constraints, printing the solution
|
| |
|
| Type: |
Production planning |
| Rating: |
1 (simple) |
| Description: |
Small, introductory problems to modeling with Python. |
| File(s): |
chess.py, chess2.py |
|
|
| Network problem: transport from depots to customers: LP solving, modeling variables and constraints
|
| |
|
| Type: |
Transportation |
| Rating: |
1 (simple) |
| Description: |
Network problem: transport from depots to customers. |
| File(s): |
trans.py |
| Data file(s): |
trans_data.py |
|
|
| Blend: A model for mineral blending: simple LP problem, formulation of blending constraints
|
| |
|
| Type: |
Blending |
| Rating: |
1 (simple) |
| Description: |
Several ores are blended to a final product that must
have a certain quality ('grade'). We wish to determine
the quantity of every ore to be used in the blend with
the objective to maximize the total profit (calculated
as sales revenues - raw material cost).
|
| File(s): |
blend.py, blend2.py |
| Data file(s): |
blend_data.py |
|
|
| Basic MIP tasks: binary variables; logic constraints: MIP solving, binary variables, index set types, logic constraints
|
| |
|
| Coco: The Coco productional planning problem: LP problem, formulation of resource constraints and
material balance constraints, formatted solution printing
|
| |
|
| Type: |
Production planning |
| Rating: |
2 (easy-medium) |
| Description: |
The company Coco has two plants that can produce two types
of cocoa powder. The plant capacities are limited.
It is possible to store raw materials and finished product
from one time period to the next. Raw material prices,
sales revenues, and the maximum amount that may be sold
depend on the time period. Raw material storage capacity
is limited.
Storing product between time periods incurs storage costs.
Some product is held in stock at the beginning of the
planning period.
The objective function of maximizing the total profit is
to maximize the sales revenues, minus the cost of production,
buying raw material, and storing finished products and raw
material.
|
| File(s): |
coco.py |
|
|
| Catenary: Determine chain shape: QCQP problem
|
| |
|
| Type: |
Nonlinear |
| Rating: |
2 (easy-medium) |
| Description: |
Find the shape of a hanging chain by minimising its potential energy.
The problem is formulated as a QCQP problem (linear objective, convex quadratic constraints).
|
| File(s): |
catenary.py |
|
|
| Pplan: A project planning problem: Formulation of resource use profiles
|
| |
|
| Type: |
Project planning |
| Rating: |
3 (intermediate) |
| Description: |
Over the next 6 months we have three projects which can
be done. Each of these projects has a profile of manpower
requirements over its lifetime, and a benefit which accrues
each month when the project has been completed.
Our problem is to determine when each project is to start,
subject to the constraint that in no month can we try to
use more manpower than is available.
|
| File(s): |
pplan.py |
|
|
| Firestns: A set-covering model for emergency service provision: Solve a MIP problem
|
| |
|
| Type: |
Set covering |
| Rating: |
1 (simple) |
| Description: |
Minimize the total number of firestations that are required to service a set of towns within a specified permissible travel
time.
|
| File(s): |
fstns.py |
|
|
| Solve a nonconvex nonlinear problem from MINLPlib with a local or global solver: Solving with local or global solvers
|
| |
|
| Type: |
Programming |
| Rating: |
2 (easy-medium) |
| Description: |
Shows how to model a general nonlinear problem and solve it with a local or global solver. |
| File(s): |
inscribedsquare.py |
|
|
| Pooling example for nonlinear solving: Nonlinear solving
|
| |
|
| Type: |
Programming |
| Rating: |
2 (easy-medium) |
| Description: |
Models a problem of pooling crude oil from different sources to produce final products with specific
properties considering flow and material balance constraints.
|
| File(s): |
crudeoil_pooling.py |
|
|
| Firestation location problem using SciPy sparse arrays: Sparse arrays, Dot product
|
| |
|
| Type: |
Programming |
| Rating: |
2 (easy-medium) |
| Description: |
Shows how to use the xp.Dot operator with a sparse SciPy matrix for a location problem. |
| File(s): |
firestation_scipy.py |
|
|
| Facility location problem using Pandas data frames: Pandas data frames
|
| |
|
| Type: |
Programming |
| Rating: |
2 (easy-medium) |
| Description: |
Shows how to use Pandas data frames to store model data and decision variables. |
| File(s): |
facility_location_pandas.py |
|
|