Type: LP (Linear Programming)
Welcome to LP Black Box! This handbook will teach you the fundamentals of Linear Programming (LP) and guide you through solving your first optimization problem using our web interface.
No prior knowledge of Linear Programming is required. By the end of this tutorial, you'll understand what LP is and how to use our platform to solve optimization problems.
Linear Programming (LP) is a mathematical method for finding the best outcome (like maximum profit or minimum cost) given a set of constraints.
Think of it like this: You have limited resources, and you want to maximize or minimize something. LP helps you find the optimal combination.
| Problem | What to Maximize | What to Minimize | Constraints |
|---|---|---|---|
| Production planning | Profit | - | Machine time, materials |
| Delivery routes | Delivery speed | Fuel cost | Time windows, truck capacity |
| Diet planning | Nutrition | Cost | Calorie limits, food preferences |
| Portfolio investment | Return | Risk | Budget, number of investments |
You want to make the best decision possible.
↓
There are rules (constraints) you must follow.
↓
There's something you want to optimize (maximize or minimize).
↓
LP finds the optimal solution that satisfies all rules.
Before we proceed, let's understand the basic building blocks of an LP problem:
Decision variables represent the choices you can control. These are the "unknowns" that the solver determines.
Example: How many cups of Latte and Mocha to make?
Variable types in the form:
In the form, you set lower_bound to define the minimum value (usually 0).
This is what you want to optimize (either maximize or minimize).
Example: Maximize 3x + 4y (profit equation)
In the form, you enter each variable's coefficient in the objective function section.
Constraints are the rules or limitations that your solution must satisfy.
Types of constraints in the form:
Example: The budget cannot exceed $1000
In the form, you specify:
Note:
rhsstands for "Right Hand Side" - it's the number on the right side of the inequality.
Let's walk through a practical example together.
You own a coffee shop and sell two drinks:
latte): $3 profit per cupmocha): $4 profit per cupTime constraint: You can only make 40 drinks total per day.
latte + mocha ≤ 40
Milk constraint: Each latte needs 1 unit of milk, each mocha needs 2 units. You have 50 units of milk available.
latte + 2 × mocha ≤ 50
Demand constraint: You must make at least 10 lattes due to a standing order.
latte ≥ 10
Non-negativity: You can't make negative drinks!
latte ≥ 0, mocha ≥ 0
Maximize profit: 3 × latte + 4 × mocha
Here's how to input our coffee shop problem into the web form:
http://localhost:3070admin@test.com / password123Click + Add Variable twice to create two variables:
| Variable | Type | Lower Bound |
|---|---|---|
| latte | Continuous | 0 |
| mocha | Continuous | 0 |
The form automatically adds objective terms for each variable. Set the coefficients:
34This creates the objective: 3 × latte + 4 × mocha
Click + Add Constraint three times to create three constraints:
Constraint 1: Time Limit
time_limitlatte = 1, mocha = 140Constraint 2: Milk Limit
milk_limitlatte = 1, mocha = 250Constraint 3: Minimum Lattes
min_lattelatte = 110Click the Solve LP button.
The results will appear on the right side of the screen. Look for:
Now it's your turn! Try modifying the problem:
What if you want to minimize cost instead? Let's say:
2, mocha = 3Add a constraint that you can only make at most 25 mochas:
max_mochamocha = 125Click Solve again and see how the result changes.
What if you can only make whole drinks (no half lattes)?
Here are some common LP patterns you can adapt:
Maximize: profit per unit × quantity
Subject to:
- Total resource used ≤ available
- Quantity ≥ 0
Minimize: production cost
Subject to:
- Meet demand requirements
- Respect capacity limits
- Quantity ≥ 0
Maximize: benefit score
Subject to:
- Total cost ≤ budget
- Each item selected = 0 or 1 (use Binary type)
Minimize: shipping cost × quantity
Subject to:
- Supply at each source = available
- Demand at each destination = required
Congratulations! You've completed the Simple LP Tutorial. You now understand:
Try Other Samples: Use the "Load Sample Problem" dropdown to try different problem types like:
Experiment: Modify the sample problems to learn how changes affect the solution
Learn More: Once you're comfortable, explore:
| Field | Description | Example |
|---|---|---|
| Problem Name | A descriptive name for your problem | "Coffee Shop Optimization" |
| Objective Type | Maximize or Minimize | Maximize |
| Variables | The decisions you're optimizing | latte, mocha |
| Objective Coefficients | How much each variable contributes | 3 for latte, 4 for mocha |
| Constraints | The rules/limitations | time limit, milk limit |
| RHS | The right-hand side value | 40, 50 |
| Type | Description | Use Case |
|---|---|---|
| Continuous | Any number | Production quantities, amounts |
| Integer | Whole numbers | Number of items, people |
| Binary | 0 or 1 | Yes/no decisions, selections |
| Type | Symbol | Example |
|---|---|---|
| LessThanOrEqual | ≤ | Budget ≤ $1000 |
| GreaterThanOrEqual | ≥ | Production ≥ 100 units |
| Equal | = | Exactly 50% mix |
Happy Optimizing! 🚀