Skip to content
Projects

About

The Pyomo repository provides a comprehensive library of solved models in supply chain management.

Developer Tools

How these counts are measured

Measured star growth

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

README.md

Original

🧮 Optimization Expert — Pyomo & OR-Tools Model Library

A hands-on, open-source library of 129+ solved optimization models in Pyomo and Google OR-Tools CP-SAT — routing, scheduling, supply chain, graphs, machine learning and puzzles.

Stars Forks License: MIT LinkedIn Newsletter Telegram Website


🚀 What Is This Repository?

A living library of optimization models. Each notebook or script is fully solved and self-contained: problem, mathematical formulation, Python code, solution and visualization.

It is written for:

  • Students learning operations research and mathematical programming
  • Practitioners looking for working templates for real problems
  • Puzzle lovers who like to think in constraints

Modeling tools: Pyomo (LP, MILP, NLP, bilevel, DAE) and Google OR-Tools (CP-SAT and the routing library). Solvers: CP-SAT, CBC, GLPK, HiGHS, Ipopt, Gurobi and the free NEOS Server.

Most notebooks open directly in Google Colab through the badge at the top of the notebook — no installation needed.


🗂️ Contents


📚 Solved Problems

🚛 Routing & Logistics

Problem File Tool
Capacitated VRP (CVRP) CVRP_CP.ipynb CP-SAT
CVRP with OR-Tools routing library CVRP_log.ipynb OR-Tools Routing
CVRP with distance limits — comparison Comparison_Distance_Exceed_of_CVRP_CP.ipynb CP-SAT
CVRP with Time Windows (CVRPTW) CVRPTW_CP.ipynb CP-SAT
Clustered CVRP CCVRP_CP.ipynb CP-SAT
VRP with constraint programming CP_VRP.ipynb CP-SAT
TDCPVRP TDCPVRP_V2.ipynb CP-SAT
TSP with AddCircuit AddCircuit_Advanced_CP.ipynb CP-SAT
TSP with precedence constraints precedence_AddCircuit_Advanced_CP.ipynb CP-SAT
Large-scale TSP Large_TSP_CP.ipynb CP-SAT
Shortest path with waiting times routing_shortest_path_waiting_CP_V3.ipynb CP-SAT
VRP wiring VRP_Circuit_CP_Wiring.ipynb CP-SAT
VRP wiring without crossings VRP_Circuit_CP_Wiring_nocross.ipynb CP-SAT
Tourist trip planning (TTP) TTP_CP.ipynb CP-SAT
Boat tour optimization BoatTour.ipynb Pyomo
Order pickup from inventory storage_routing.ipynb CP-SAT
Conquering all metro stations Metro map -V3-github.ipynb Pyomo

📅 Scheduling

Problem File Tool
Job shop scheduling with idle time JobShop_CP_ORTools_Idle_time.ipynb CP-SAT
Job shop with flexible preventive maintenance (6 jobs × 5 machines) maintenance_CP.py CP-SAT
↳ data for the maintenance example data_maintenance_CP.py Python
RCPSP with cumulative constraints RCPSP_Cummulative_CP.ipynb CP-SAT
Multi-mode RCPSP (MRCPSP) mrcpsp.ipynb Pyomo
Project scheduling Project-Class-module-github.ipynb Pyomo
Project scheduling — multi-objective Project-Class-module-github-MOO.ipynb Pyomo
Shift scheduling shift_scheduling_CP.ipynb CP-SAT
Nurse scheduling automation.py CP-SAT
Hospital staff scheduling Hospital_CP.ipynb CP-SAT
Airline scheduling (two-stage) Airliner-twostage.ipynb Pyomo
Movie shooting sequence Movie_shooting.ipynb CP-SAT
Team meeting scheduling TeamMeeting.ipynb CP-SAT

🏭 Supply Chain & Resource Allocation

Problem File Tool
Cutting stock problem CSP-git-V1.ipynb Pyomo
Farmer resource allocation Farmer_CP_V1.ipynb CP-SAT
Bilevel optimization (single and multi follower) bilevel-github-single-bilevel-multi-EX2.ipynb Pyomo
Gerrymandering (district design) Final_Gerrymandering_CP.ipynb CP-SAT
Yield yield.ipynb Pyomo

🤝 Assignment & Matching

Problem File Tool
Stable marriage stable_marriage_CP.ipynb CP-SAT
Student–professor assignment StudenttoProf.ipynb Pyomo
Pairing Pairing CP.ipynb CP-SAT
Christmas gift happiness maximization Gift-Christmas.ipynb Pyomo
Secret Santa Secret_Santa_Circuit_Advanced_CP.ipynb CP-SAT
Social golfer problem Social golfer.ipynb Pyomo

🔗 Graphs & Networks

Problem File Tool
Critical node detection CND-github.ipynb Pyomo
Graph island detection Graph-Island.ipynb Pyomo
Earthquake network earthquake.ipynb Pyomo
Max distance on a graph max distance.ipynb Pyomo
Max independent set April Fools day max independent set.ipynb Pyomo
Vertex coloring vertexcoloring.ipynb Pyomo
Edge coloring Edgecoloring.ipynb Pyomo
Total coloring Totalcoloring.ipynb Pyomo
Routing & wavelength assignment Routin_Wavelength_Assignment_CP.ipynb CP-SAT
PCB routing PCB.py CP-SAT

🧩 Logic Puzzles

Problem File Tool
Zebra puzzle zebra_CP.py CP-SAT
Zebra puzzle — v2 zebra_CP_v2.py CP-SAT
Hidato Hidato-git.ipynb Pyomo
Hashi (bridges) HAshi puzzle-git.ipynb Pyomo
Hitori Hitori_CP.ipynb CP-SAT
Bonairo Bonairo puzzle .ipynb Pyomo
Shikaku Shikaku-puzzle-github.ipynb Pyomo
Suguru Suguru_CP.ipynb CP-SAT
Numberlink Numberlink-V3-Git.ipynb Pyomo
Slitherlink slitherlink_puzzle.py CP-SAT
Slitherlink — drone variant slitherlink_puzzle_Drone.py CP-SAT
Slitherlink — drone variant v2 slitherlink_puzzle_Drone-V2.py CP-SAT
Tower (Skyscraper) puzzle tower_puzzle.py CP-SAT
Tower puzzle — all solutions tower_puzzle_allsolutions.py CP-SAT
Snake Snake_CP.ipynb CP-SAT
Snake with eggs snake_egg.py CP-SAT
Snake with eggs — modular snake_egg_modular.py CP-SAT
Magic square MagicSquare.ipynb CP-SAT
Mean square MeanSquare.ipynb CP-SAT
ROGO ROGO_of_AddCircuit_Advanced_CP.ipynb CP-SAT
A puzzle a day A_Puzzle_A_Day_git.ipynb CP-SAT
Tiling puzzle Tiling.py CP-SAT
Domino placement domino.ipynb CP-SAT
Maze maze.ipynb Pyomo
Clock puzzle Clock_CP.ipynb CP-SAT
Calculator with two buttons calculator_cp.py CP-SAT
1 Euro coin 1EuroCoin.ipynb CP-SAT
Pennies Pennies.py Pyomo
Empty bucket Empty-Bucket-Github.ipynb Pyomo
Family puzzle Project_Family_Advanced_CP.ipynb CP-SAT
Master Mind game game_Master_Mind_CP_Pyomo.ipynb CP-SAT / Pyomo
Longest common subsequence LCS-git.ipynb Pyomo
Maximum path sum (Project Euler 18 & 67) maxpasssum.py CP-SAT
Maximum path sum — visual maxpasssum_visual.py CP-SAT
Maximum path sum — visual, multiple paths maxpasssum_visual_multi.py CP-SAT
Pizza Pizza.ipynb CP-SAT
Easter photo Easter Photo.ipynb Pyomo

♟️ Chess & Board Puzzles

Problem File Tool
N-Queens N-Queen.ipynb Pyomo
Knight's tour (MILP) Knight tour MILP.ipynb Pyomo
One knight stands One_Knight_Stansd_.ipynb CP-SAT
Half chessboard half_chess_board.ipynb CP-SAT
Fill the chessboard fill_chess-Github.ipynb Pyomo
Snake on a chessboard snake_chess_board.ipynb CP-SAT
Board puzzle board-git.ipynb Pyomo
Vertex rectangle vertex_rectangle.ipynb CP-SAT

💼 LinkedIn Puzzles

Problem File Tool
Queens Linkedin_CP_Puzzle.ipynb CP-SAT
Queens on a multi-color board Queen_Linkedin_of_multi_color_chess_board_CP.ipynb CP-SAT
Tango TANGO_of_Linkedin_CP_Puzzle.ipynb CP-SAT
ZIP ZIP_LInkedin_CP.ipynb CP-SAT
Patches patches_puzzle_CP_final.py CP-SAT
Patches — first version patches_puzzle_CP.py CP-SAT

🧠 IBM Ponder This Challenges

Problem File Tool
Prime sequence (March 2024) Prime_IBM_sequence_March2024.ipynb CP-SAT
Solution callback (January 2024) callback_CP_IBM_Ponder_this_Challenge_Jan_2024.ipynb CP-SAT
Max army IBM_max_Army.ipynb CP-SAT

📐 Geometry & Packing

Problem File Tool
2D no-overlap placement 2d_no_overlap.ipynb CP-SAT
Shape placement shape_placement.ipynb CP-SAT
Largest box Largest_box_CP.ipynb CP-SAT
Biggest circle with equal blue/green points blue-green-points-biggest_circle.ipynb Pyomo
Max points maxpoints-V2.ipynb Pyomo
Max distance between points MaxDistance-Github-V2.ipynb Pyomo

🤖 Machine Learning & Data Fitting

Problem File Tool
SVM — primal & dual classification EXample_SVM_Primal_Dual_Classification_.ipynb Pyomo
SVM — primal & dual on corn seed data EXample_SVM_Primal_Dual_Classification_Corn_.ipynb Pyomo
SVM — why kernels are needed EX_final_SVM_Primal_Class_Kernel_Necessity_.ipynb Pyomo
SVM — kernel dual, hard constraints Class_kernel_Dual_of_SVM_hard_constraint.ipynb Pyomo
K-means clustering Clustering_Kmean_class.ipynb Pyomo
K-means (class) Kmeans_Class.ipynb Pyomo
Multi-curve regression regression-multiline-V4.ipynb Pyomo
Projectile fitting from an image projectile- GitHub-V2.ipynb Pyomo

🛠️ Pyomo & OR-Tools Techniques

Problem File Tool
Pyomo on Google Colab — setup Pyomo_on_Google_Colab.ipynb Pyomo
Pyomo on Google Colab — example Pyomo_example_on_Google_Colab.ipynb Pyomo
Solving with the NEOS server NEOS Pyomo.ipynb Pyomo
Mutable parameters mutable prarameter.ipynb Pyomo
Indexed variables X[i,j] in Pyomo Xij_Pyomo.ipynb Pyomo
Indexed variables X[i,j] in CP-SAT Xij_cp.ipynb CP-SAT
Pyomo.DAE — transient heat transfer Pyomo_dae.ipynb Pyomo.DAE
Solving several instances in parallel (mpi4py) multiple_instances.py Pyomo
A simple CP model simple_CP.py CP-SAT
Modeling with 7 cases 7seenPyomo.ipynb Pyomo

⚡ Quick Start

Run locally

git clone https://github.com/OptimizationExpert/Pyomo.git
cd Pyomo

pip install pyomo ortools matplotlib pandas numpy networkx
pip install highspy            # free LP/MILP solver usable from Pyomo
conda install -c conda-forge coincbc ipopt   # optional: CBC and Ipopt

jupyter notebook

Run on Google Colab ☁️

Open any notebook with its Open in Colab badge, or start from Pyomo_on_Google_Colab.ipynb.

Pick a tool

Your problem has… Start with
continuous variables, LP / MILP / NLP structure Pyomo + HiGHS, CBC, Gurobi or Ipopt
sequencing, scheduling, logic, all-different, circuits OR-Tools CP-SAT
vehicle routing with standard side constraints OR-Tools routing library

📡 Stay Connected

Platform Link
🌐 Website optexpert.org
📰 LinkedIn newsletter Optimization in Open Source
💬 Telegram t.me/PyomoChannel
🎓 Udemy course Pyomo Bootcamp: Python Optimization from Beginner to Advanced
🎓 Udemy course Power System Optimization in GAMS
🎓 Udemy course Power System Optimization in Pyomo
🎓 Udemy course Google OR-Tools in Python
👤 LinkedIn Alireza Soroudi

🤝 Contributing

Contributions are welcome:

  1. Fork the repository and create a branch.
  2. Add a notebook with a problem description, the mathematical formulation, clean code and a visualization.
  3. Run it end to end.
  4. Open a pull request and say which section of this README it belongs to.

📖 How to Cite

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

A CITATION.cff file is also included, so GitHub's "Cite this repository" button works.


📄 License

MIT — use it, fork it, build on it.

If this library helped you, a ⭐ helps others find it.

Explore related projects

Loading…