Skip to content

jerinsam/linear-programming-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Linear Programming

Linear Programming (LP) is a core mathematical optimization technique, used to determine the best possible outcome (maximum profit, minimum cost, optimal allocation) under a set of constraints.

Example

In this example, we will try to find the maximum profit that can be earned by manufacturing two products, A and B.

Below are the facts about the given problem:

Item Product A Product B
Profit per unit $40 $30
Labor hours needed 2 1
Material units needed 1 1

Constraints:

  • Labor = 100 hours
  • Material = 80 units

Solution Steps

  1. Define the problem: We want to maximize the profit by manufacturing two products, A and B.
  2. Define the variables: x = number of units of product A, y = number of units of product B.
  3. Define the objective function: profit = 40x + 30y.
  4. Define the constraints: 2x + y <= 100, x + y <= 80, x >= 0, y >= 0.
  5. Solve the problem using a linear programming solver.

Refer main.py for the code implementation.

Next Steps

About

Optimization using Liner Programming

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages