Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

221 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿงฎ Optimization Expert โ€” Pyomo & OR-Tools Notebook Library

A hands-on, open-source collection of solved optimization problems using Pyomo, OR-Tools (CP-SAT), and MILP โ€” from supply chain to puzzles, routing to scheduling.

Stars Forks License: MIT LinkedIn Newsletter Telegram


๐Ÿš€ What Is This Repository?

This repository is a living library of optimization models โ€” each one a fully solved, self-contained Jupyter notebook. Problems range from real-world supply chain challenges to classic combinatorial puzzles, all tackled using the power of mathematical programming.

Whether you're a student stepping into Operations Research, a practitioner solving real business problems, or a puzzle enthusiast who thinks in constraints โ€” there's something here for you.

Tools used across the notebooks:

  • ๐Ÿ Pyomo โ€” algebraic modeling in Python
  • โš™๏ธ Google OR-Tools CP-SAT โ€” constraint programming solver
  • ๐Ÿ”ข Solvers: Gurobi, CBC, GLPK, NEOS Server

๐Ÿ“‚ What's Inside

Each notebook includes:

  1. Problem Description โ€” a clear, intuitive explanation of the challenge
  2. Mathematical Formulation โ€” the model written out properly (sets, variables, constraints, objective)
  3. Python Implementation โ€” clean code in Pyomo or OR-Tools CP-SAT
  4. Solution & Visualization โ€” results displayed with charts, tables, and maps where relevant
  5. Analysis โ€” interpretation of the solution and key insights

๐Ÿ—‚๏ธ Solved Problems

๐Ÿš› Routing & Logistics

Problem Notebook
Capacitated VRP (CVRP) CVRP_CP.ipynb
CVRP with Time Windows CVRPTW_CP.ipynb
Clustered CVRP CCVRP_CP.ipynb
TSP with AddCircuit AddCircuit_Advanced_CP.ipynb
Large-scale TSP Large_TSP_CP.ipynb
TSP with Precedence Constraints precedence_AddCircuit_Advanced_CP.ipynb
VRP Wiring (no crossings) VRP_Circuit_CP_Wiring_nocross.ipynb
Boat Tour Optimization BoatTour.ipynb
Optimal Order Pickup from Inventory storage_routing.ipynb
Conquering All Metro Stations Metro map -V3-github.ipynb

๐Ÿ“… Scheduling

Problem Notebook
Job Shop Scheduling (with idle time) JobShop_CP_ORTools_Idle_time.ipynb
RCPSP with Cumulative Constraints RCPSP_Cummulative_CP.ipynb
Airline Crew Scheduling (Two-Stage) Airliner-twostage.ipynb
Movie Shooting Sequence Movie_shooting.ipynb
Team Meeting Scheduling TeamMeeting.ipynb
Hospital Staff Scheduling Hospital_CP.ipynb
Tourist Trip Scheduling (TTP) TTP_CP.ipynb
Project Scheduling (MOO) Project-Class-module-github-MOO.ipynb

๐Ÿ”— Graph Theory & Networks

Problem Notebook
Critical Node Detection CND-github.ipynb
Graph Island Detection Graph-Island.ipynb
Edge Coloring Edgecoloring.ipynb
Total Coloring Totalcoloring.ipynb
Routing & Wavelength Assignment Routin_Wavelength_Assignment_CP.ipynb
2D No-Overlap Placement 2d_no_overlap.ipynb
Max Independent Set April Fools day max independent set.ipynb

๐Ÿงฉ Puzzles & Combinatorics

Problem Notebook
N-Queens N-Queen.ipynb
Magic Square MagicSquare.ipynb
Knight's Tour (MILP) Knight tour MILP.ipynb
Hidato Puzzle Hidato-git.ipynb
Hashi (Bridges) Puzzle HAshi puzzle-git.ipynb
Hitori Puzzle Hitori_CP.ipynb
Bonairo Puzzle Bonairo puzzle .ipynb
Shikaku Puzzle Shikaku-puzzle-github.ipynb
Suguru Puzzle Suguru_CP.ipynb
Numberlink Numberlink-V3-Git.ipynb
Slitherlink slitherlink_puzzle.py
A Puzzle A Day A_Puzzle_A_Day_git.ipynb
LinkedIn Queens Puzzle Linkedin_CP_Puzzle.ipynb
LinkedIn Tango Puzzle TANGO_of_Linkedin_CP_Puzzle.ipynb
LinkedIn ZIP Puzzle ZIP_LInkedin_CP.ipynb
ROGO Puzzle ROGO_of_AddCircuit_Advanced_CP.ipynb
Master Mind Game game_Master_Mind_CP_Pyomo.ipynb
Social Golfer Problem Social golfer.ipynb
Secret Santa Assignment Secret_Santa_Circuit_Advanced_CP.ipynb
15-Puzzle IBM Challenge 15_Puzzle_IBM_Git.ipynb
Prime Sequence IBM Challenge Prime_IBM_sequence_March2024.ipynb
IBM Max Army Challenge IBM_max_Army.ipynb

๐Ÿญ Supply Chain & Operations

Problem Notebook
Cutting Stock Problem (CSP) CSP-git-V1.ipynb
Bilevel Optimization bilevel-github-single-bilevel-multi-EX2.ipynb
Gerrymandering (District Design) Final_Gerrymandering_CP.ipynb
Farmer Resource Allocation Farmer_CP_V1.ipynb
Stable Marriage Problem stable_marriage_CP.ipynb
Studentโ€“Professor Assignment StudenttoProf.ipynb
Christmas Gift Happiness Maximization Gift-Christmas.ipynb
Pairing Optimization Pairing CP.ipynb
7-Seen Modeling 7seenPyomo.ipynb
Pyomo with NEOS Server NEOS Pyomo.ipynb
Pyomo on Google Colab Pyomo_on_Google_Colab.ipynb

๐Ÿ“ Geometry & Machine Learning

Problem Notebook
Largest Box (CP) Largest_box_CP.ipynb
Biggest Circle with Equal Points blue-green-points-biggest_circle.ipynb
Max Distance Between Points MaxDistance-Github-V2.ipynb
Shape Placement (CP) shape_placement.ipynb
SVM Primal & Dual (Classification) EXample_SVM_Primal_Dual_Classification_.ipynb
SVM with Kernel Class_kernel_Dual_of_SVM_hard_constraint.ipynb
K-Means Clustering (Optimization) Clustering_Kmean_class.ipynb
Multi-Curve Regression regression-multiline-V4.ipynb
Longest Common Subsequence LCS-git.ipynb

โšก Quick Start

Run Locally

# Clone the repository
git clone https://github.com/OptimizationExpert/Pyomo.git
cd Pyomo

# Install dependencies
pip install pyomo ortools matplotlib pandas numpy

# Install a free solver (CBC)
conda install -c conda-forge coincbc

# Launch Jupyter
jupyter notebook

Run on Google Colab โ˜๏ธ

No local setup needed โ€” open any notebook directly in Colab using the badge at the top of each notebook, or start with the dedicated Colab setup notebook:

๐Ÿ‘‰ Pyomo_on_Google_Colab.ipynb


๐Ÿ› ๏ธ Tech Stack

Tool Purpose
Pyomo Algebraic modeling language for LP, MILP, NLP, Bilevel
OR-Tools CP-SAT Constraint programming for combinatorial problems
Gurobi High-performance commercial solver (free academic license)
CBC / GLPK Open-source solvers, zero setup required
NEOS Server Free cloud-based solver access
Jupyter Notebooks Interactive, documented problem-solving environment

๐Ÿ“ก Stay Connected

Platform Link
๐Ÿ“ฐ LinkedIn Newsletter Optimization in Open-Source
๐Ÿ’ฌ Telegram Channel t.me/PyomoChannel
๐ŸŽ“ Udemy Course Optimization in Python
๐Ÿ‘ค LinkedIn Profile Alireza Soroudi

๐Ÿค Contributing

Contributions are warmly welcome! To add a new notebook or improve an existing one:

  1. Fork the repository and create a new branch
  2. Write clean, well-documented code with problem description and formulation
  3. Test your notebook end-to-end
  4. Submit a pull request with a clear description of what you've added

Let's build the most comprehensive open-source optimization library together! ๐ŸŒ


๐Ÿ“– How to Cite

If this repository has been useful in your research or work, please cite it:

@misc{soroudi2024pyomo,
  author       = {Alireza Soroudi},
  title        = {Optimization Expert โ€” Pyomo \& OR-Tools Notebook Library},
  year         = {2024},
  publisher    = {GitHub},
  url          = {https://github.com/OptimizationExpert/Pyomo}
}

๐Ÿ“„ License

This project is licensed under the MIT License โ€” use it, fork it, build on it freely.


If this repo helped you solve a hard problem or learn something new โ€” consider giving it a โญ star. It helps others find it too!

Releases

Packages

Used by

Contributors

Languages