mp#

A Party Scheduling Problem with FICO Xpress#

party1.ipynb Open In Colab Open In Deepnote Open In Kaggle Open In Gradient Open In SageMaker Studio Lab
Description: A scheduling problem for visitor-host assignments. Feasibility version (no objective function). Demonstrates high-level modeling in AMPL MP, AMPL Python API, and tuning in FICO Xpress

Big-M constants come from declared bounds#

declared_bounds_bigm.ipynb Open In Colab Open In Deepnote Open In Kaggle Open In Gradient Open In SageMaker Studio Lab
Description: How MP sizes the big-M constants of logical constraints from declared variable bounds, why naming an expression and declaring its bound tightens the LP relaxation, and how to check this with the root bound and the exported solver model

CP-style scheduling model with the numberof operator, solved by a MIP solver#

sched_numberof.ipynb Open In Colab Open In Deepnote Open In Kaggle Open In Gradient Open In SageMaker Studio Lab
Description: Scheduling model with the Constraint Programming numberof operator, solved with a MIP solver. New MIP solver drivers based on the [MP library](https://amplmp.readthedocs.io/) enable CP-style modeling.

Containers scheduling#

containers_scheduling.ipynb Open In Colab Open In Deepnote Open In Kaggle Open In Gradient Open In SageMaker Studio Lab
Description: Scheduling model for harbor operations. It is a problem with dependences between containers, which should be dispatch the fastest possible. We are using the MP solver interfaces to model a complex system using techniques from Constraint Programming, such as indicator constraints, and logical or and forall operators. After the model is written, a couple instances are presented and Highs/Gurobi MIP solvers are used to tackle the problem.

Diagnose infeasibility#

diagnose_infeasibility.ipynb Open In Colab Open In Deepnote Open In Kaggle Open In Gradient Open In SageMaker Studio Lab
Description: This notebook demonstrates how to deal with infeasible models.

Diverse alternatives: beyond the solution pool#

diverse_alternatives_mga.ipynb Open In Colab Open In Deepnote Open In Kaggle Open In Gradient Open In SageMaker Studio Lab
Description: Generate near-optimal alternatives that really differ: a solution pool against max-min Modelling to Generate Alternatives (MGA) on a unit commitment model, with the budget as a constraint or as an objective hierarchy

Formula 1 Scheduling and Routing Optimization#

f1_scheduling_routing.ipynb Open In Colab Open In Deepnote Open In Kaggle Open In Gradient Open In SageMaker Studio Lab
Description: A notebook that tackles the Formula 1 Calendar as a routing and a scheduling problem, minimizing total distance between races whilst also assigning a spot in the calendar respecting scheduling constraints using MP

Hierarchies with tolerances: the Pareto front and pass statistics#

hierarchy_tolerances_pareto.ipynb Open In Colab Open In Deepnote Open In Kaggle Open In Gradient Open In SageMaker Studio Lab
Description: Cost, emissions and starts in a unit commitment model: objective priorities and tolerances as AMPL suffixes, per-pass statistics, native against emulated hierarchies, and the Pareto front traced by a tolerance sweep

Hydrogen Facility Operations Introduction#

hydrogen_operations.ipynb Open In Colab Open In Deepnote Open In Kaggle Open In Gradient Open In SageMaker Studio Lab
Description: A notebook that demonstrates the optimization of a green hydrogen production facility that must navigate the complex interplay between variable renewable energy supply, fluctuating electricity prices, multiple market segments, and operational constraints.

Infeasible? Ask the solver for an IIS#

iis_unit_commitment.ipynb Open In Colab Open In Deepnote Open In Kaggle Open In Gradient Open In SageMaker Studio Lab
Description: Find out why a unit commitment model is infeasible: ask an MP solver for an irreducible infeasible subsystem (IIS) and read it through AMPL suffixes in amplpy

Labs scheduling#

labs_scheduling.ipynb Open In Colab Open In Deepnote Open In Kaggle Open In Gradient Open In SageMaker Studio Lab
Description: Model for laboratories scheduling. Some labs are needed to handle requests from researchers, and departments have to assign labs and locations to the requests.

MP2NL: logical and complementarity constraints with any NL solver#

mp2nl_logic_and_complementarity.ipynb Open In Colab Open In Deepnote Open In Kaggle Open In Gradient Open In SageMaker Studio Lab
Description: Using the MP2NL meta-driver from amplpy: which options go where, what the subsolver receives, why the subsolver must handle the problem class MP produces, how to choose a complementarity reformulation, and how to check the returned solution

Magic sequences#

magic_sequences.ipynb Open In Colab Open In Deepnote Open In Kaggle Open In Gradient Open In SageMaker Studio Lab
Description: Solving magic sequences through reinforced formulations and constrained programming. Some comparison between models and solvers is done, and we look into the “Another solution” problem for these sequences.

N-Queens#

nqueens.ipynb Open In Colab Open In Deepnote Open In Kaggle Open In Gradient Open In SageMaker Studio Lab
Description: How can N queens be placed on an NxN chessboard so that no two of them attack each other?

Paintshop Color Change Scheduling with FICO Xpress#

color_change_scheduling.ipynb Open In Colab Open In Deepnote Open In Kaggle Open In Gradient Open In SageMaker Studio Lab
Description: A scheduling problem demonstrating high-level modeling and manual solver tuning in FICO Xpress

Perspective reformulation of a convex cost on a semicontinuous variable#

perspective_unit_commitment.ipynb Open In Colab Open In Deepnote Open In Kaggle Open In Gradient Open In SageMaker Studio Lab
Description: Unit commitment with a convex piecewise-linear fuel cost: the perspective reformulation, its linear form for piecewise-linear costs, its form for MP’s semicontinuous declarations, and checking its value with the root bound before benchmarking

Portfolio Optimization: Factor Model#

portfolio_factor_model.ipynb Open In Colab Open In Deepnote Open In Kaggle Open In Gradient Open In SageMaker Studio Lab
Description: Mean-Variance Portfolio Optimization model where the risk estimator is not given explicitly but is instead represented by a factor model, as is common in US equity models [1]. The original notebook is [3].

Price what you would relax: feasibility relaxation and priced slacks#

priced_relaxation.ipynb Open In Colab Open In Deepnote Open In Kaggle Open In Gradient Open In SageMaker Studio Lab
Description: After an infeasible unit commitment: a priced feasibility relaxation through AMPL suffixes (.rhspen, .lbpen, .ubpen) against a slack priced in the model, which runs on any solver and sweeps into an operating reserve demand curve

Retrieve Solution pool with AMPL and Gurobi#

solution_pool.ipynb Open In Colab Open In Deepnote Open In Kaggle Open In Gradient Open In SageMaker Studio Lab
Description: This notebook describes how to retrieve multiple solutions from the solver’s solution pool. Optimization problems usually have several optimal solutions, one is returned by the solver but the others are discarded. These alternative solutions can also be retrieved by AMPL.

Solution check: discontinuous objective function#

sol-check.ipynb Open In Colab Open In Deepnote Open In Kaggle Open In Gradient Open In SageMaker Studio Lab
Description: Pathological examples to illustrate MP solution checker and settings

Unit Commitment MINLP with Knitro#

unit_commitment_minlp_mp2nl.ipynb Open In Colab Open In Deepnote Open In Kaggle Open In Gradient Open In SageMaker Studio Lab
Description: Solving a nonlinear Unit Commitment problem with Knitro using MP features for logic and multi-objective optimization. The goal of this notebook is to show a straightforward and clear way of using nonlinear solvers for complex models with logical expressions and also hierarchical multi-objective optimization.

Using multiple objectives in your model#

emulate_multiobjective.ipynb Open In Colab Open In Deepnote Open In Kaggle Open In Gradient Open In SageMaker Studio Lab
Description: We show how to use multiple objectives with Amplpy using a nonlinear Unit Commitment problem. We won’t be using native or emulated features from the solver interface, but emulating manually a lexicographic multiobjective problem.

Vehicle Routing Problem with Fair Profits and Time Windows (VRP-FPTW)#

vrp_fptw.ipynb Open In Colab Open In Deepnote Open In Kaggle Open In Gradient Open In SageMaker Studio Lab
Description: This notebook implements and solves the Vehicle Routing Problem with Fair Profits and Time Windows (VRP-FPTW), a realistic and recent extension of the classical VRP problem.

Warehouse location and transport#

warehouse_location.ipynb Open In Colab Open In Deepnote Open In Kaggle Open In Gradient Open In SageMaker Studio Lab
Description: Model for warehouse allocation. Farms (suppliers) send feedstock to warehouses, and later on, those warehouses send it to a production plant. The problem involves modeling a storage facility location problem with a transportation component to the final plant.

Warm start solvers with snapshot#

snapshot.ipynb Open In Colab Open In Deepnote Open In Kaggle Open In Gradient Open In SageMaker Studio Lab
Description: We show how to warm start a solver with a previous solution. A nonlinear Unit Commitment problem is being used as example. We will use the “snapshot” feature for this matter.