Linear Programming Part 4 - Practical Scenarios
Production, resource allocation, budgeting, workforce, transportation, marketing, portfolio, and AI/ML examples
▶ Linear Programming Part 0- About This Series
▶ Linear Programming Part 2- Fundamental Building Blocks
▶ Linear Programming Part 3 - Solving LP Problems
▶ Linear Programming Part 4 - Practical Scenarios
▶ Linear Programming Part 5 - LP Algorithms
▶ Linear Programming Part 6- LP vs Integer Programming vs Mixed-Integer Programming
▶ Linear Programming Part 7- Limiations of LP
▶ Linear Programming Part 8- Sensitivity Anddalysis
▶ Linear Programming Part 9- Understanding Solver Output
▶ Linear Programming Part 10- End to End Case Study
1. Introduction
In the previous parts, we learned how to:
- Identify decision variables
- Define an objective function
- Define constraints
- Formulate an LP problem
- Find an optimal solution
Now we will look at how these ideas appear in different real-world situations.
The purpose of these examples is not to learn a new LP technique for every problem.
Instead, we want to recognize the same basic pattern:
The scenario may change, but the underlying structure remains largely the same.
We will look at several simple examples from areas such as:
- Production
- Resource allocation
- Budget allocation
- Workforce planning
- Transportation
- Marketing
- Portfolio allocation
- AI/ML systems
For each scenario, we will focus mainly on how the real-world problem is translated into an LP formulation.
2. Production Planning
A common use of LP is deciding how much of each product to produce when resources are limited.
Scenario
A factory produces two products:
- Product A
- Product B
Each product requires material and labor.
| Product A | Product B | |
|---|---|---|
| Profit per unit | $30 | $20 |
| Material per unit | 2 kg | 1 kg |
| Labor per unit | 3 hours | 2 hours |
The factory has:
- 100 kg of material
- 120 hours of labor
The goal is to determine how many units of each product should be produced to maximize profit.
Decision Variables
Let:
Objective Function
Product A generates $30 profit per unit and Product B generates $20.
Therefore:
Constraints
Material:
Each A uses 2 kg and each B uses 1 kg. With 100 kg available:
Labor:
Each A uses 3 hours and each B uses 2 hours. With 120 hours available:
Non-negativity:
Complete LP Formulation
Subject to:
The same three building blocks appear again:
What to produce? → Decision variables
What to optimize? → Profit
What limits production? → Material and labor
3. Resource Allocation
LP can also be used when a limited resource needs to be distributed among different activities.
Scenario
A company has 100 hours of engineering time available.
The company can use this time for two activities:
- Model development
- Data preparation
Each hour allocated to model development contributes 8 units of value.
Each hour allocated to data preparation contributes 5 units of value.
The company wants to decide how to allocate its available engineering time to maximize total value.
Decision Variables
Let:
Objective Function
Each hour of model development contributes 8 units of value, while each hour of data preparation contributes 5.
Therefore:
Constraint
Only 100 engineering hours are available:
We also cannot allocate a negative number of hours:
Complete LP Formulation
Subject to:
The structure is the same as the production example.
The difference is the meaning of the decision variables and resource.
In this case:
- Decision variables → Where to allocate the engineering hours
- Objective → Maximize total value
- Constraint → Only 100 hours are available
This is the general idea of resource allocation: deciding how to distribute limited resources across competing uses.
4. Budget Allocation
LP can be used to decide how to distribute a limited budget across different activities.
Scenario
A company has a marketing budget of $100,000.
It can spend the budget on two channels:
- Online advertising
- TV advertising
Suppose:
- Each $1,000 spent on online advertising generates 8 units of expected value.
- Each $1,000 spent on TV advertising generates 5 units of expected value.
The company wants to allocate its budget to maximize the expected value.
Decision Variables
Let:
Objective Function
Online advertising generates 8 units of value per $1,000, while TV advertising generates 5.
Therefore:
Constraint
The total budget is $100,000, which is 100 units of $1,000:
We also cannot spend a negative amount:
Complete LP Formulation
Subject to:
Again, the LP structure remains the same:
- Decision variables → How much to spend on each channel
- Objective → Maximize expected value
- Constraint → Stay within the available budget
5. Workforce Scheduling
LP can be used to decide how many workers should be assigned to different shifts while satisfying staffing requirements.
Scenario
A company needs workers for two shifts:
- Morning shift
- Evening shift
Each worker can be assigned to one shift.
The company needs at least:
- 20 workers in the morning
- 15 workers in the evening
Each worker costs:
- $100 for the morning shift
- $120 for the evening shift
The company wants to minimize total staffing cost.
Decision Variables
Let:
Objective Function
The morning shift costs $100 per worker, while the evening shift costs $120.
Therefore:
Constraints
At least 20 workers are required for the morning shift:
At least 15 workers are required for the evening shift:
Workers cannot be negative:
Complete LP Formulation
Subject to:
The LP structure is:
- Decision variables → Number of workers assigned to each shift
- Objective → Minimize staffing cost
- Constraints → Meet the required staffing levels
This is a simple example of workforce scheduling. More realistic scheduling problems may include additional constraints such as worker availability, maximum working hours, and shift coverage.
6. Transportation and Delivery
LP can be used to decide how much to transport from different locations while minimizing delivery costs.
Scenario
A company has two warehouses:
- Warehouse A
- Warehouse B
It needs to deliver products to two stores:
- Store 1
- Store 2
The available supply and store requirements are:
| Location | Amount |
|---|---|
| Warehouse A supply | 60 units |
| Warehouse B supply | 40 units |
| Store 1 demand | 50 units |
| Store 2 demand | 50 units |
The transportation cost per unit is:
| Route | Cost per unit |
|---|---|
| A → Store 1 | $4 |
| A → Store 2 | $6 |
| B → Store 1 | $5 |
| B → Store 2 | $3 |
The company wants to minimize total transportation cost.
Decision Variables
Let:
Objective Function
The total transportation cost is:
Constraints
Warehouse A has at most 60 units:
Warehouse B has at most 40 units:
Store 1 needs 50 units:
Store 2 needs 50 units:
All shipment quantities must be non-negative:
Complete LP Formulation
Subject to:
The structure is:
- Decision variables → How much to ship along each route
- Objective → Minimize transportation cost
- Constraints → Respect warehouse supply and store demand
This type of problem is commonly called a transportation problem, which is a specific class of optimization problem that can be formulated as an LP.
7. Marketing Allocation
LP can be used to decide how to distribute a limited marketing budget across different channels.
Scenario
A company has a marketing budget of $50,000.
It can spend the budget on:
- Social media advertising
- Search advertising
Suppose:
- Each $1,000 spent on social media generates 12 units of expected reach.
- Each $1,000 spent on search advertising generates 8 units of expected reach.
The company wants to maximize expected reach.
However, the company wants to spend at least $10,000 on search advertising.
Decision Variables
Let:
Objective Function
The expected reach is:
Constraints
The total marketing budget is $50,000:
At least $10,000 must be spent on search advertising:
Spending cannot be negative:
Complete LP Formulation
Subject to:
The structure is:
- Decision variables → How much to spend on each marketing channel
- Objective → Maximize expected reach
- Constraints → Stay within the budget and satisfy minimum spending requirements
The same LP pattern can therefore be applied to marketing decisions involving multiple channels, budgets, and business requirements.
8. Portfolio Allocation
LP can be used to decide how to distribute a limited amount of money across different investments.
Scenario
An investor has $100,000 to allocate between two investment options:
- Investment A
- Investment B
Suppose:
- Investment A generates 6 units of expected return per $1,000 invested.
- Investment B generates 4 units of expected return per $1,000 invested.
The investor wants to maximize expected return.
However, the investor wants to keep at least $30,000 in Investment B.
Decision Variables
Let:
Objective Function
The expected return is:
Constraints
The total available investment is $100,000:
At least $30,000 must be invested in Investment B:
Investment amounts cannot be negative:
Complete LP Formulation
Subject to:
The structure is:
- Decision variables → How much money to allocate to each investment
- Objective → Maximize expected return
- Constraints → Stay within the available money and satisfy allocation requirements
In real portfolio optimization, additional constraints may represent risk limits, diversification requirements, or investment restrictions.
9. AI/ML-Related Optimization Examples
LP can also appear in AI/ML systems, usually as a supporting optimization component rather than the machine learning model itself.
The ML model may produce predictions, scores, or probabilities.
An optimization method can then use those outputs to make the final decision while satisfying business constraints.
Scenario 1: Recommendation Selection
Suppose an ML model gives each movie a recommendation score.
We want to select movies for a user's recommendation list.
Let:
If movie \(i\) has recommendation score \(s_i\), the objective could be:
Suppose we want to recommend exactly 5 movies:
We could also add constraints such as:
This prevents more than two Action movies from appearing in the list.
Scenario 2: Resource Allocation for ML Systems
Suppose an AI system has limited computing resources.
We need to decide how much computing capacity to allocate to different ML workloads.
Let:
If the expected value produced by each resource unit is 8 and 5:
With a total resource limit:
And:
Key Idea
In these examples:
The ML model produces information that can be used by an optimization problem.
Therefore, LP is not replacing the ML model.
Instead, it can help turn model outputs into decisions while respecting constraints.
10. Summary
Across all these scenarios, the same basic pattern appears:
The application changes, but the underlying LP structure remains similar.
We covered examples involving:
- Production planning
- Resource allocation
- Budget allocation
- Workforce scheduling
- Transportation
- Marketing allocation
- Portfolio allocation
- AI/ML systems
The main skill to develop is recognizing what decisions need to be made, what should be optimized, and what limitations must be satisfied.