0% found this document useful (0 votes)
1K views7 pages

Pyomo & HiGHS for MIP in Python

This document discusses using mixed-integer programming in Python to model problems that require integer values. It presents a simple example model with two integer variables and two constraints that is solved using Pyomo and the HiGHS solver. The example maximizes a linear objective function subject to the constraints. Instructions are provided on installing Pyomo and HiGHS to try running the example model.

Uploaded by

Sukhpal Rajpoot
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views7 pages

Pyomo & HiGHS for MIP in Python

This document discusses using mixed-integer programming in Python to model problems that require integer values. It presents a simple example model with two integer variables and two constraints that is solved using Pyomo and the HiGHS solver. The example maximizes a linear objective function subject to the constraints. Instructions are provided on installing Pyomo and HiGHS to try running the example model.

Uploaded by

Sukhpal Rajpoot
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Mixed-Integer

Programming in Python
A simple example with Pyomo and HiGHS
Why integer?

• Some decisions
only make sense
when
considering
integer values
• Ex: the number
of trips a delivery
truck does
A simple example
Its linear relaxation
And the discrete domain
Pyomo + HiGHS
import [Link] as pyo
from [Link] import Highs

model = [Link]()
model.x = [Link]([1, 2], within=[Link])

model.c1 = [Link](expr=2 * model.x[1] + 3 * model.x[2] <= 12)


model.c2 = [Link](expr=2 * model.x[1] + model.x[2] <= 6)

[Link] = [Link](expr=5 * model.x[1] + 4 * model.x[2],


sense=[Link])

solver = Highs()
solver.highs_options = {"time_limit": 10}
res = [Link](model)
Give it a try!

pip install pyomo>=6.6.0


pip install highspy

Keep an eye out 👁️ more optimization content

Like 👍, share, comment 💬 (it’s free)

You might also like