mp#
A Party Scheduling Problem with FICO Xpress#
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
Author: Gleb Belov (21 notebooks) <gleb@ampl.com>
Big-M constants come from declared bounds#
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
Tags: modeling-tips, mp, big-m, reinforced-formulations, formulation-comparison, facility-location, milp, amplpy, highs
Author: Gleb Belov (21 notebooks) <gleb@ampl.com>
CP-style scheduling model with the numberof operator, solved by a MIP solver#
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.
Author: Gleb Belov (21 notebooks) <gleb@ampl.com>
Containers scheduling#
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#
Description: This notebook demonstrates how to deal with infeasible models.
Diverse alternatives: beyond the solution pool#
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
Tags: mp, mga, alternative-solutions, solution-pool, multi-objective, suffixes, unit-commitment, energy, milp, amplpy, highs, gurobi
Author: Gleb Belov (21 notebooks) <gleb@ampl.com>
Formula 1 Scheduling and Routing Optimization#
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#
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
Tags: mp, multi-objective, pareto-front, suffixes, unit-commitment, energy, milp, amplpy, highs, gurobi
Author: Gleb Belov (21 notebooks) <gleb@ampl.com>
Hydrogen Facility Operations Introduction#
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#
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
Tags: mp, iis, infeasibility, suffixes, unit-commitment, energy, milp, amplpy, highs, gurobi, xpress
Author: Gleb Belov (21 notebooks) <gleb@ampl.com>
Labs scheduling#
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#
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
Author: Gleb Belov (21 notebooks) <gleb@ampl.com>
Magic sequences#
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.
Tags: constraint-programming, educational, mp, sequences, arithmetic, reinforced-formulations, highs, gecode, cbc, mip
N-Queens#
Description: How can N queens be placed on an NxN chessboard so that no two of them attack each other?
Author: Gleb Belov (21 notebooks) <gleb@ampl.com>
Paintshop Color Change Scheduling with FICO Xpress#
Description: A scheduling problem demonstrating high-level modeling and manual solver tuning in FICO Xpress
Author: Gleb Belov (21 notebooks) <gleb@ampl.com>
Perspective reformulation of a convex cost on a semicontinuous variable#
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
Tags: modeling-tips, mp, perspective, semi-continuous, unit-commitment, piecewise-linear, reinforced-formulations, formulation-comparison, milp, amplpy
Author: Gleb Belov (21 notebooks) <gleb@ampl.com>
Portfolio Optimization: Factor Model#
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].
Tags: finance, portfolio-optimization, mean-variance, factor-model, ampl-conditonal-instantiation, mp, cardinality-constraint
Author: Gleb Belov (21 notebooks) <gleb@ampl.com>
Price what you would relax: feasibility relaxation and priced slacks#
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
Tags: mp, feasibility-relaxation, infeasibility, suffixes, unit-commitment, energy, milp, amplpy, highs, gurobi
Author: Gleb Belov (21 notebooks) <gleb@ampl.com>
Retrieve Solution pool with AMPL and Gurobi#
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#
Description: Pathological examples to illustrate MP solution checker and settings
Author: Gleb Belov (21 notebooks) <gleb@ampl.com>
Unit Commitment MINLP with Knitro#
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.
Tags: mp, knitro, mp2nl, nonlinear, quadratic, minlp, unit-commitment, electric-power-industry, energy, multi-objective, gurobi, xpress, mp2nl
Using multiple objectives in your model#
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.
Tags: warm-start, mp, multi-objective, gurobi, xpress, knitro, mp2nl, electric-power-industry, unit-commitment
Vehicle Routing Problem with Fair Profits and Time Windows (VRP-FPTW)#
Warehouse location and transport#
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#
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.