User Documentation Index
1. Python Setup (Google Colab & Jupyter Notebook)
1.1 Download Binaries & Install Pyomo
For Google Colab (Nightly Build):
!wget -q https://www.ieor.iitb.ac.in/files/faculty/amahajan/minotaur/nightly/origin/minotaur-nightly.tar.gz
!tar -zxf minotaur-nightly.tar.gz
!rm -f mbin
!ln -s minotaur-nightly mbin
!pip install -q pyomo
For Jupyter Notebook (Stable 0.4.1 Release):
!wget -nc https://www.ieor.iitb.ac.in/files/faculty/amahajan/minotaur/bin/minotaur-0.4.1-linux-x86_64.tar.gz
!tar -zxf minotaur-0.4.1-linux-x86_64.tar.gz
!ln -s minotaur-0.4.1-linux-x86_64/bin mbin
!pip install -q pyomo
1.2 Create Optimization Model in Pyomo
Define your mixed-integer optimization model using Pyomo environment:
from pyomo.environ import *
model = ConcreteModel()
model.x1 = Var(within=Integers)
model.x2 = Var(within=Integers)
model.obj = Objective(expr=5.5*model.x1 + 2.1*model.x2, sense=maximize)
model.con1 = Constraint(expr=-model.x1 + model.x2 <= 2)
model.con2 = Constraint(expr=8*model.x1 + 2*model.x2 <= 17)
1.3 Solve Model using Minotaur Solver
Use one of Minotaur's solvers (mbnb, mqg, mglob, mmultistart) to solve the model. Here, we use the mglob solver:
# In Colab use '/content/mbin/mglob', in local Jupyter use './mbin/mglob'
mntr = SolverFactory("mglob", executable='./mbin/mglob')
mntr.options['--log_level'] = 2
mntr.options['--time_limit'] = 60
# mntr.options['--qp_engine'] = 'None'
# mntr.options['--nlp_engine'] = 'IPOPT'
# Set tee to True if you want to see verbose solver log output
result = mntr.solve(model, tee=True)
1.4 View Solution & Solver Results
After solving the model, view termination status, optimal objective value, bounds, and runtime:
print("Solver termination status:", result.solver.status)
print("Solver termination condition:", result.solver.termination_condition)
print("Best solution value:", model.obj())
print("Best bound: ", result.problem.lower_bound)
print("Solver time:", result.solver.time)
2. Set up for AMPL
To use Minotaur with AMPL, follow the steps below:
- Ensure you have Minotaur and AMPL installed on your system. If Minotaur is not installed, download the precompiled binaries from the Installation page.
- Extract the downloaded
.tar.gzarchive, open the extracted folder, and navigate to thebin/subfolder. - Copy the four binaries/executables (
mbnb,mqg,mglob,mmultistart) from thebin/folder to your main AMPL directory that contains theamplexecutable.
Create AMPL Model (example.mod)
# AMPL Model (example.mod)
var x1 integer;
var x2 integer;
maximize obj: 5.5*x1 + 2.1*x2;
subject to con1: -x1 + x2 <= 2;
subject to con2: 8*x1 + 2*x2 <= 17;
display x1, x2, obj;
AMPL Commands to Set Up & Solve
Use the following AMPL commands to set up and solve the model with Minotaur's mglob solver:
# Load model file
model example.mod;
# If Minotaur is built/installed in a specific directory:
option solver "/path/to/minotaur/build/bin/mglob";
# If binaries/executables are in main AMPL directory:
option solver mglob;
# Solve the optimization problem
solve;
# Display output solution
display x1, x2, obj;
Replace /path/to/minotaur/build/bin/mglob with the actual path to your Minotaur executable.