Linear Programming Calculator

Solve optimization problems with constraints using the simplex method

Linear Programming

Linear programming (LP) is a method to achieve the best outcome in a mathematical model whose requirements are represented by linear relationships. It's widely used in business and economics to solve optimization problems.

Maximize (or Minimize): Z = c₁x₁ + c₂x₂ + ... + cₙxₙ
Subject to:
a₁₁x₁ + a₁₂x₂ + ... + a₁ₙxₙ ≤ b₁
a₂₁x₁ + a₂₂x₂ + ... + a₂ₙxₙ ≤ b₂
...
x₁, x₂, ..., xₙ ≥ 0

Where:

  • Z is the objective function to maximize or minimize
  • x₁, x₂, ..., xₙ are the decision variables
  • c₁, c₂, ..., cₙ are the coefficients of the objective function
  • aᵢⱼ are the coefficients of the constraints
  • bᵢ are the right-hand side values of the constraints

Decision Variables

Objective Function Coefficients

Constraints

Solution

Optimal Value:

Optimal Solution

Sensitivity Analysis

Slack/Surplus Variables

Practical Examples

Example 1: Production Planning

Objective: Maximize profit

Variables: x₁ = Product A, x₂ = Product B

Objective Function: Z = 40x₁ + 30x₂

Constraints:

  • 2x₁ + x₂ ≤ 100 (Labor hours)
  • x₁ + x₂ ≤ 80 (Machine hours)
  • x₁ ≤ 40 (Demand for A)
  • x₂ ≤ 60 (Demand for B)

Solution: x₁ = 20, x₂ = 60, Z = 2600

Example 2: Diet Problem

Objective: Minimize cost

Variables: x₁ = Food A, x₂ = Food B

Objective Function: Z = 0.6x₁ + x₂

Constraints:

  • 10x₁ + 4x₂ ≥ 20 (Protein)
  • 5x₁ + 5x₂ ≥ 20 (Carbohydrates)
  • 2x₁ + 6x₂ ≥ 12 (Fat)

Solution: x₁ = 3, x₂ = 1, Z = 2.8

Example 3: Transportation Problem

Objective: Minimize shipping costs

Variables: x₁ = Warehouse A to Store 1, x₂ = Warehouse A to Store 2, etc.

Objective Function: Z = 2x₁ + 4x₂ + 5x₃ + 3x₄

Constraints:

  • x₁ + x₂ ≤ 100 (Supply from A)
  • x₃ + x₄ ≤ 150 (Supply from B)
  • x₁ + x₃ = 80 (Demand at Store 1)
  • x₂ + x₄ = 120 (Demand at Store 2)

Solution: x₁ = 80, x₂ = 20, x₃ = 0, x₄ = 120, Z = 520

LP Applications in Industrial Engineering

Application Area Typical Use Case
Production Planning Optimal product mix to maximize profit
Inventory Management Minimizing holding and ordering costs
Transportation Minimizing shipping costs between locations
Scheduling Optimal workforce or machine scheduling
Blending Problems Optimal mix of raw materials