Explore six hands-on cases that show how to model real-world problems as linear programs (LP) and solve them with Optimization Solver. Each case includes Python source code hosted in MindOpt Studio — open any case directly in the online Notebook to run and modify it.
The cases progress from introductory concepts to applied machine learning. If you are new to LP, start with Case 1 before moving to the domain-specific cases.
LP cases overview
| Case | Business problem | What you learn | Difficulty |
|---|---|---|---|
| 1. Concept of LP | Understand where LP applies in everyday decisions | Core LP concepts and their role in Operations Research | Introductory |
| 2. Nutrition allocation | Design a daily diet that meets nutrition requirements at minimum cost | Model dietary constraints with LP; 12 code examples in C, C++, or Python | Beginner |
| 3. Production scheduling | Schedule workpieces across machines to finish as early as possible | Flow shop scheduling with LP; minimize makespan | Beginner |
| 4. Ad traffic distribution | Maximize total video views while hitting per-video view targets | LP-based traffic allocation for ads, notifications, and promotions | Intermediate |
| 5. Robust linear regression | Build a prediction model that is resilient to outliers | Formulate linear regression as an LP optimization problem | Intermediate |
| 6. SVM multi-classification | Classify inputs into multiple categories using support vector machines (SVMs) | LP formulation of SVMs with L1 regularization | Advanced |
1. Concept of LP
LP is the most widely used technique in Operations Research. This introductory case explains the core concepts and the types of problems that LP can solve.
Prerequisites: No prior LP knowledge required. Basic familiarity with Python is helpful.
2. Nutrition allocation: lower costs and rich nutrition
Feeding a household or institution on a budget requires balancing dozens of nutritional constraints at once — exactly the kind of problem LP handles well. This case builds a daily diet planning model that meets specified nutrition requirements at the lowest possible cost. Twelve code examples are included, covering C, C++, or Python.
Prerequisites: Basic Python programming. No prior LP knowledge required.
3. Production scheduling: minimize makespan in a flow shop
In a flow shop, every workpiece passes through the same sequence of machines. The challenge is to find the order of workpieces that finishes all jobs as early as possible. This case models the classic flow shop scheduling problem as an LP and uses Optimization Solver to minimize the makespan.
Prerequisites: Basic Python programming. Familiarity with LP fundamentals (Case 1 recommended).
4. Ad traffic distribution: balanced exposure and traffic conversion
Online video platforms need each piece of content — ads, notifications, and promotions — to reach the expected number of views, while also maximizing total views across all content. This case formulates that trade-off as an LP and solves it with Optimization Solver.
Prerequisites: Basic Python programming. Familiarity with LP fundamentals (Case 1 recommended).
5. Robust linear regression
This case recasts linear regression as an LP, estimating the relationship between an independent variable vector x and a scalar output y using the linear function y = ⟨a, x⟩ + b. The LP formulation estimates the values of a and b.
Prerequisites: Python programming. Basic knowledge of linear regression concepts.
6. SVM multi-classification with L1 regularization
Classification maps an input vector x to a categorical label y — for example, identifying whether an image contains an animal or a plant. This case formulates multi-class classification using SVMs with an L1 regularization term as an LP, then solves it with Optimization Solver.
Prerequisites: Python programming. Familiarity with LP and basic machine learning concepts.