What is Linear Programming? Definition, Methods and Problems

avcontentteam 29 Aug, 2024
6 min read

Introduction

Tired of making guesses in your decisions? Want to get the most out of limited resources? Linear programming is the secret weapon businesses use worldwide to optimize everything from production to delivery routes.

In this article, we’ll discuss the simple logic behind linear programming. You’ll learn how to transform complex problems into easy-to-solve mathematical models. We’ll conquer real-world scenarios like:

  • Balancing production lines to meet demand while minimizing costs.
  • Optimizing marketing budgets to reach the most customers for your buck.
  • Designing efficient delivery routes to save time and fuel.

Linear programming is a fundamental skill for data scientists and analysts. But fear not; even beginners can grasp these powerful concepts. We’ll start with the basics and progress step-by-step, using clear explanations and practical examples.

Note: If you want to learn this in a course format, we have curated this free course for you- Linear Programming for Data Science Professionals

What is Linear Programming?

Linear programming is a simple technique that depicts complex relationships through linear functions and then finds the optimum points. The key term here is “depicts.” Real relationships might be much more complex, but we can simplify them to linear relationships.

Moreover, it’s important to note that linear programming is a special case of mathematical programming. It involves finding the optimal solution to a problem that involves linear relationships between the decision variables and the constraints. This method has applications in various industries and fields, from production planning to logistics optimization, and is a powerful tool in making data-driven decisions that can lead to improved efficiency and cost savings.

Applications of linear programming are everywhere around you. You use linear programming at personal and professional fronts. You are using linear programming when you are driving from home to work and want to take the shortest route. Or when you have a project delivery you make strategies to make your team work efficiently for on-time delivery.

Before exploring an example, let’s look at common terminologies used in LP!

Common Terminologies Used in Linear Programming

Let us define some terminologies used in Linear Programming using the above example.

  • Decision Variables: The decision variables are the variables that will decide my output. They represent my ultimate solution. To solve any problem, we first need to identify the decision variables. For the above example, the total number of units for A and B denoted by X & Y respectively are my decision variables.
  • Objective Function: It is defined as the objective of making decisions. In the above example, the company wishes to increase the total profit represented by Z. So, profit is my objective function.
  • Constraints: The constraints are the restrictions or limitations on the decision variables. They usually limit the value of the decision variables. In the above example, the limit on the availability of resources Milk and Choco are my constraints.
  • Non-negativity Restriction: For all linear programs, the decision variables should always take non-negative values. This means the values for decision variables should be greater than or equal to 0.

Example of a Linear Programming Problem (LPP)

Let’s say a FedEx delivery man has 6 packages to deliver in a day. The warehouse is located at point A. U, V, W, X, Y, and Z represents the 6 delivery destinations. The numbers on the lines indicate the distance between the cities. To save on fuel and time the delivery person wants to take the shortest route.

Example of Linear Programing Problem (LPP)

The delivery person calculates different routes to all six destinations and then chooses the shortest route. This technique of selecting the shortest route is linear programming.

In this case, the objective of the delivery person is to deliver parcels on time to all six destinations. The process of choosing the best route is operations research, which involves methods to operate a system efficiently. In the above example, the system is the delivery model.

Linear programming is used to obtain the most optimal solution for a problem with given constraints. It formulates real-life problems into a mathematical model involving an objective function and linear inequalities subject to constraints.

Is the linear representation of the six points above representative of the real world? Yes and no. It is an oversimplification since the real route would not be a straight line. It would likely have multiple turns, U-turns, signals, and traffic jams. However, this simple assumption reduces the complexity of the problem drastically and creates a solution that works in most scenarios.

Formulating a Problem

Let’s manufacture some chocolates…
Example: Consider a chocolate manufacturing company that produces only two types of chocolate – A and B. Both the chocolates require Milk and Choco only.  To manufacture each unit of A and B, the following quantities are required:

  • Each unit of A requires 1 unit of Milk and 3 units of Choco
  • Each unit of B requires 1 unit of Milk and 2 units of Choco

The company kitchen has a total of 5 units of Milk and 12 units of Choco. On each sale, the company makes a profit of

  • Rs 6 per unit A sold
  • Rs 5 per unit B sold.

Now, the company wishes to maximize its profit. How many units of A and B should it produce respectively?

Solution

The first thing I’m gonna do is represent the problem in a tabular form for better understanding.

<
MilkChocoProfit per unit
A13Rs 6
B12Rs 5
Total512

Let the total number of units produced by A be = X

Let the total number of units produced by B be = Y

Now, the total profit is represented by Z

The total profit the company makes is given by the total number of units of A and B produced multiplied by its per-unit profit of Rs 6 and Rs 5 respectively.

Profit: Max Z = 6X+5Y

which means we have to maximize Z.

The company will try to produce as many units of A and B to maximize the profit. But the resources Milk and Choco are available in a limited amount.

As per the above table, each unit of A and B requires 1 unit of Milk. The total amount of Milk available is 5 units. To represent this mathematically,

X+Y ≤ 5

Also, each unit of A and B requires 3 units & 2 units of Choco respectively. The total amount of Choco available is 12 units. To represent this mathematically,

3X+2Y ≤ 12

Also, the values for units of A can only be integers.

So we have two more constraints, X ≥ 0  &  Y ≥ 0

For the company to make maximum profit, the above inequalities have to be satisfied.

This is called formulating a real-world problem into a mathematical model.

Types of Linear Programming Problems

  • Manufacturing Problems: Manufacturing problems aim to optimize production decisions for maximum profits or minimal costs, considering resource availability (labor, materials), production rates, fees, and product selling prices.
  • Diet Problems: Diet problems seek the least costly diet meeting nutritional requirements, factoring in nutritional content, food costs, and dietary constraints (allergies, preferences). A nutritionist may minimize costs while meeting nutritional needs.
  • Transportation Problems: Transportation problems minimize moving goods costs from sources to destinations. Factors include supply at sources, demand at destinations, and transportation costs. Companies optimize shipping from factories to warehouses under constraints.
  • Optimal Assignment Problems: Optimal assignment problems efficiently allocate tasks or resources. Factors include individual or machine skills and costs or time for different assignments. Managers may assign employees to projects for time optimization.

How to Solve Linear Programming Problems?

Let us look at the steps of defining a Linear Programming problem generically:

  • Step 1: Identify the decision variables in the problem.
  • Step 2: Construct the objective function and determine whether it needs to be maximized or minimized.
  • Step 3: List all the constraints associated with the linear problem.
  • Step 4: Ensure the decision variables meet non-negativity restrictions.
  • Step 5: Solve the linear programming problem using a suitable method, typically the simplex method or the graphical method.

For a problem to be a linear programming problem, the decision variables, objective function and constraints all have to be linear functions.

If all the three conditions are satisfied, it is called a Linear Programming Problem.

Linear Programming Methods

  1. Graphical Method
  2. Simplex Method

Solve Linear Programs by Graphical Method

A linear program can be solved by multiple methods. In this section, we are going to look at the Graphical method for solving a linear program. This method is used to solve a two-variable linear program. If you have only two decision variables, you should use the graphical method to find the optimal solution.

A graphical method involves formulating a set of linear inequalities subject to the constraints. Then the inequalities are plotted on an X-Y plane. Once we have plotted all the inequalities on a graph the intersecting region gives us a feasible region. The feasible region explains what all values our model can take. And it also gives us the best solution.

How to Solve LP by Graphical Method?

  • Step 1: Plot the constraints on a graph, identifying the feasible region where all constraints overlap.
  • Step 2: Identify the corner points (vertices) of the feasible region.
  • Step 3: Evaluate the objective function at each corner point.
  • Step 4: Determine the corner point that gives the optimal value (maximum or minimum) of the objective function.
  • Step 5: Verify that the optimal solution satisfies all constraints and non-negativity restrictions.

Let’s understand this with the help of an example.

Example

A farmer has recently acquired a 110 hectares piece of land. He has decided to grow Wheat and barley on that land. Due to the quality of the sun and the region’s excellent climate, the entire production of Wheat and Barley can be sold. He wants to know how to plant each variety in the 110 hectares, given the costs, net profits and labor requirements according to the data shown below:

Variety Cost (Price/Hec)  Net Profit (Price/Hec)  Man-days/Hec
Wheat 100  50  10
Barley 200  120  30

The farmer has a budget of US$10,000 and availability of 1,200 man-days during the planning horizon. Find the optimal solution and the optimal value.

Solution

To solve this problem, first we gonna formulate our linear program.

Formulation of a Linear Problem

Step 1: Identify the decision variables

The total area for growing Wheat = X (in hectares)

The total area for growing Barley  = Y (in hectares)

X and Y are my decision variables.

Step 2: Write the objective function

Since the production from the entire land can be sold in the market. The farmer would want to maximize the profit for his total produce. We are given net profit for both Wheat and Barley. The farmer earns a net profit of US$50 for each hectare of Wheat and US$120 for each Barley.

Our objective function (given by Z) is, Max Z = 50X + 120Y

Step 3: Writing the constraints 

1. It is given that the farmer has a total budget of US$10,000. The cost of producing Wheat and Barley per hectare is also given to us. We have an upper cap on the total cost spent by the farmer. So our equation becomes:

100X + 200Y â‰¤ 10,000 

2. The next constraint is the upper cap on the availability of the total number of man-days for the planning horizon. The total number of man-days available is 1200. As per the table, we are given the man-days per hectare for Wheat and Barley.

10X + 30Y â‰¤ 1200

3. The third constraint is the total area present for plantation. The total available area is 110 hectares. So the equation becomes,

X + Y â‰¤ 110
Step 4: The non-negativity restriction

The values of X and Y will be greater than or equal to 0. This goes without saying.

X â‰¥ 0, Y â‰¥ 0

We have formulated our linear program. It’s time to solve it.

Solving an LP Through the Graphical Method

Since we know that X, Y ≥ 0. We will consider only the first quadrant.

To plot for the graph for the above equations, first I will simplify all the equations.

100X + 200Y â‰¤ 10,000 can be simplified to X + 2Y â‰¤ 100 by dividing by 100.

10X + 30Y â‰¤ 1200 can be simplified to X + 3Y â‰¤ 120 by dividing by 10.

The third equation is in its simplified form, X + Y â‰¤ 110.

Plot the first 2 lines on a graph in the first quadrant (like shown below)

The optimal feasible solution is achieved at the point of intersection where the budget & man-days constraints are active. This means the point at which the equations X + 2Y â‰¤ 100 and X + 3Y â‰¤ 120 intersect gives us the optimal solution.

The values for X and Y which gives the optimal solution is at (60,20).

To maximize profit the farmer should produce Wheat and Barley in 60 hectares and 20 hectares of land respectively.

The maximum profit the company will gain is,

Max Z = 50 * (60) + 120 * (20)

=  US$5400

Linear programming,Graphical Method

Note: Everything taught here has also been taught in a course format in this free course- Linear Programming for Data Science Professionals

Solve Linear Program Using R

R is an open-source tool that is very popular among the data scientists for essential data science tasks. Performing linear programming is very easy and we can attain an optimum solution in very few steps. Come let’s learn.

Example

A toy manufacturing organization manufactures two types of toys A and B. Both the toys are sold at Rs.25 and Rs.20 respectively. There are 2000 resource units available every day from which the toy A requires 20 units while toy B requires 12 units. Both of these toys require a production time of 5 minutes. Total working hours are 9 hours a day. What should be the manufacturing quantity for each of the pipes to maximize the profits?

Here:

The objective function is:
Max.Z=25x+20y

where x are the units of pipe A

y are the units of pipe B

Constraints:
20x+12y<=2000

5x+5y<=540

Let’s See the Code Part Now

Output

summary(opt)

Length Class Mode 
direction 1 -none- numeric 
x.count 1 -none- numeric 
objective 2 -none- numeric 
const.count 1 -none- numeric 
constraints 8 -none- numeric 
int.count 1 -none- numeric 
int.vec 1 -none- numeric 
bin.count 1 -none- numeric 
binary.vec 1 -none- numeric 
num.bin.solns 1 -none- numeric 
objval 1 -none- numeric 
solution 2 -none- numeric 
presolve 1 -none- numeric 
compute.sens 1 -none- numeric 
sens.coef.from 1 -none- numeric 
sens.coef.to 1 -none- numeric 
duals 1 -none- numeric 
duals.from 1 -none- numeric 
duals.to 1 -none- numeric 
scale 1 -none- numeric 
use.dense 1 -none- numeric 
dense.col 1 -none- numeric 
dense.val 1 -none- numeric 
dense.const.nrow 1 -none- numeric 
dense.ctr 1 -none- numeric 
use.rw 1 -none- numeric 
tmp 1 -none- character
status 1 -none- numeric 

> opt$solution
[1] 88 20

> opt$objval
[1] 2600

Therefore from the output, we see that the organization should produce 88 units of toy A and 20 units of toy B and the maximum profit for the organization will be Rs.2600.

Solve Linear Program Using OpenSolver

In reality, a linear program can contain 30 to 1000 variables and solving it either Graphically or Algebraically is next to impossible. Companies generally use OpenSolver to tackle these real-world problems. Here I am gonna take you through steps to solve a linear program using OpenSolver.

OpenSolver is an open-source linear and optimizer for Microsoft Excel. It is an advanced version of a built-in Excel Solver. You can download OpenSolver here and follow the installation manual.

I want you to get hands-on knowledge of using OpenSolver. So, for a clear understanding, I will explain it using an example.

Example

Below there is a diet chart that gives me calories, protein, carbohydrate and fat content for 4 food items. Sara wants a diet with minimum cost. The diet chart is as follows:

Food Item 1  Food Item 2  Food Item 3  Food Item 4
Calories 400  200  150  500
Protien (in grams) 3  2  0  0
Carbohydrates ( in grams) 2  2  4  4
Fat (in grams) 2  4  1  5
Cost $0.50  $0.20  $0.30 $0.80

The chart gives the nutrient content as well as the per-unit cost of each food item. The diet has to be planned in such a way that it should contain at least 500 calories, 6 grams of protein, 10 grams of carbohydrates and 8 grams of fat.

Solution

First, I’m gonna formulate my linear program in a spreadsheet.

Step 1: Identify the decision variables

Here my decision variables are the food items. Add the headers. For trial purposes, we are entering arbitrary values. Let’s say, Sara consumes 3 units of Food Item 1, 0 unit of Food Item 2, 1  unit of Food Item 3 and 0 unit of Food Item 4. These are called variable cells.

Identifying decision variables in OpenSolver [Linear programming problem]

Step 2: Now we will write our objective function

For the diet to be optimal we must have minimum cost along with required calories, protein, carbohydrate, and fat.

Objective function in OpenSolver [Linear programming problem]

In cell B7:E7  we take the reference to the number of units. And in cell B8:E8 we put the per-unit cost of each food item.

In cell B10, we want the total cost of the diet. The total cost is given by the sumproduct of the number of units eaten and per-unit cost. Sumproduct is given by = B7*B8+C7*C8+D7*D8+E7*E8. Let’s see this in a spreadsheet.

Solving LP with OpenSolver (Step 2) [Linear programming problem]

Step 3: Now, we will enter the constraints

Column F contains a total of calories, protein, carbohydrate, and fat. The total number of calorie intake in given by sumproduct the number of food items eaten and the calorie consumed per food item. For cell F13= Sumprodcut($B$7:$F$7, B13:F13). Similarly for others. Column G gives the inequality since the problem demands Calories, Protein, Carbohydrate and Fat to be at least 500, 6, 10 and 8 respectively. Column H gives the required nutrient content.

Constraints in OpenSolver [Linear programming problem]

Step 4: Now, we will enter the Linear program into the solver

Once you have installed OpenSolver. When you click on the Data tab, on the right you will see Model. Click on the model, then enter the values one by one. First, we will enter the objective function,$B10 i.e in the objective cell. Select minimize because we want to minimize the diet cost.

LP on OpenSolver [Linear programming problem]

Step 5: Now enter the decision variables in the variable cells

Solving LP using OpenSolver [Linear programming problem]

Step 6: Now, we will add the constraints.

The first constraint is the F13 ≥  H13. Add all the constraints one by one.

Step 7: Now, you have to enter one important constraint.

The non-negativity restriction. All the decision variables will be greater than 0.

OpenSolver Model [Linear programming problem]

Step 8: Click on Save Model to finish the modeling process

Once you save the model, it will look something like this.

Model [Linear programming problem]

Step 9: Click on the Data tab then click solve.

The optimal solution and values are displayed in the corresponding cells. The optimal minimum cost is US$0.90. Sara should consume 3 units of Food Item 2 and 1 unit of Food Item 3 for the required nutrient content at the minimum cost. This solves our linear program.

Datatab OpenSolver [Linear programming problem]

Simplex Method

Simplex Method is one of the most powerful & popular methods for linear programming. The simplex method is an iterative procedure for getting the most feasible solution. In this method, we keep transforming the value of basic variables to get maximum value for the objective function.

A linear programming function is in its standard form if it seeks to maximize the objective function. subject to constraints,

till

where, xi >=0 and bi >=0. 

After adding slack variables, the corresponding system of constraint equation is,

.                                    .                                       .                    .

where, 

The variables,S1 , S2 ……. Sm are called slack variables. They are non-negative numbers that are added to remove the inequalities from an equation.

The above explanation gives the theoretical explanation of the simplex method. Now, I am gonna explain how to use the simplex method in real life using Excel. But before that, let’s look that the steps of solving LP using simplex method!

How to Solve LP using Simplex Method?

The Simplex Method is a systematic way for testing the vertices of the feasible region to find the optimal value of the objective function. Here are the steps:

  • Step 1: Convert the linear programming problem into standard form, including introducing slack variables to turn inequalities into equalities.
  • Step 2: Set up the initial simplex tableau.
  • Step 3: Identify the pivot element (the most negative value in the bottom row for maximization problems).
  • Step 4: Perform pivot operations to make the pivot element equal to 1 and other elements in the pivot column equal to 0.
  • Step 5: Repeat Steps 3 and 4 until there are no negative values in the bottom row (for maximization problems), indicating the optimal solution has been reached.
  • Step 6: Read off the solution from the final tableau.

Example

The advertising alternatives for a company include television, newspaper and radio advertisements. The cost for each medium with its audience coverage is given below.

Television  Newspaper  Radio
Cost per advertisement ($) 2000  600  300
Audience per advertisement 100,000  40,000  18,000

The local newspaper limits the number of advertisements from a single company to ten. Moreover, in order to balance the advertising among the three types of media, no more than half of the total number of advertisements should occur on the radio. And at least 10% should occur on television. The weekly advertising budget is $18,200. How many advertisements should be run in each of the three types of media to maximize the total audience?

Solution

First I am going to formulate my problem for a clear understanding.

Step 1: Identify Decision Variables

Let x1 , x2 , x3 represent the total number of ads for television, newspaper, and radio respectively.

Step 2: Objective Function

The objective of the company is to maximize the audience. The objective function is given by:

linear programming problems

Step 3: Write down the constraints

Now, I will mention each constraint one by one.

It is clearly given that we have a budget constraint. The total budget which can be allocated is $18,200. And the individual costs per television, newspaper and radio advertisement is $2000, $600 and $300 respectively. This can be represented by the equation,

linear programming problems

For a newspaper advertisement, there is an upper cap on the number of advertisements to 10. My first constraints are,

The next constraint is the number of advertisements on television. The company wants at least 10% of the total advertisements to be on television. So, it can be represented as:

The last constraint is the number of advertisements on the radio cannot be more than half of the total number of advertisements. It can be represented as

Now, I have formulated my linear programming problem. We are using the simplex method to solve this. I will take you through the simplex method one by one.

To reiterate all the constraints are as follows. I have simplified the last two equations to bring them in standard form.

linear programming problems

We have a total of 4 equations. To balance out each equation, I am introducing 4 slack variables,S1 , S2 , S3 , S4

So our equations are as follows:

Linear Programming

I hope now you are available to make sense of the entire advertising problem. All the above equations are only for your better understanding. Now if you solve these equations, you will get the values for X1= 4, X2= 10 and X3= 14.

On solving the objective function you will get the maximum weekly audience as 1,052,000. You can follow the tutorial here to solve the equation. To solve a linear program in excel, follow this tutorial.

Northwest Corner Method and Least Cost Method

Northwest Corner Method

The northwest corner method is a special type of method used for transportation problems in linear programming. It is used to calculate the feasible solution for transporting commodities from one place to another. Whenever you are given a real-world problem, which involves supply and demand from one source or a different source. The data model includes the following:

  • The level of supply and demand at each source is given
  • The unit transportation of a commodity from each source to each destination

The model assumes that there is only one commodity. The demand for this can come from different sources. The objective is to fulfill the total demand with minimum transportation costs. The model is based on the hypothesis that the total demand is equal to the total supply, i.e the model is balanced. Let’s understand this with the help of an example.

Example

Consider there are 3 silos which are required to satisfy the demand from 4 mills. (A silo is a storage area of the farm used to store grain and Mill is a grinding factory for grains).

LP problem for Northwest Corner Method [Linear programming problem]

Solution

Let’s understand what the above table explains.

The cost of transportation from Silo i to Mill j is given by the cost in each cell corresponding to the supply from each silo 1 and the demand at each Mill. For example, The cost of transporting from Silo 1 to Mill 1 is $10, from Silo 3 to Mill 5 is $18. It is also given the total demand & supply for mill and silos. The objective is to find the minimal transportation cost such that the demand for all the mills is satisfied.

As the name suggests Northwest corner method is a method of allocating the units starting from the top-left cell.

The demand for Mill 1 is 5 and Silo 1 has a total supply of 15. So, 5 units can be allocated to Mill1 at a cost of $10 per unit. The demand for Mill1 is met. then we move to the top-left cell of Mill 2.

The demand for Mill 2 is 15 units, which it can get 10 units from Silo 1 at a cost of $2 per unit and 5  units from Silo 2 at a cost of $7 per unit.

Then we move onto Mill 3, the northwest cell is S2M3. The demand for Mill 3 is 15 units, which it can get from Silo 2 at a cost of $9 per unit.

Moving on to the last Mill, Mill  4 has a demand of 15 units. It will get 5 units from a Silo 2 at a cost of $20 per unit and 10 units from Silo 3 at a cost of $18 per unit.

The total cost of transportation is = 5*10+(2*10+7*5)+9*15+(20*5+18*10) = $520

LP solution by Northwest Corner Method [Linear programming problem]

Least Cost Method

Least Cost method is another method to calculate the most feasible solution for a linear programming problem. This method derives more accurate results than the Northwest Corner method. It is used for transportation and manufacturing problems.

Example

To keep it simple I am explaining the above transportation problem.

Transportation LP problem [Linear programming problem]

Solution

Step 1: Understanding the Least Cost Method

According to the least cost method, you start from the cell containing the least unit cost for transportation. So, for the above problem, I supply 5 units from Silo 3 at a per-unit cost of $4. The demand for Mill1 is met. For Mill 2, we supply 15 units from Silo 1 at a per-unit cost of $2. Then For Mill 3 we supply 15 units from Silo 2 at a per-unit cost of $9. Then for Mill 4 we supply 10 units from Silo 2 at a per unit cost of $20 and 5 units from Silo 3 an $18 per unit. The total transportation costs are $475.

Step 2: Optimizing Costs with Excel Solver

Well, the above method explains we can optimize our costs further with the best method. Let’s check this using Excel Solver. Solver is an in-built add-on in Microsoft Excel. It’s an add-in plug available in Excel. Go to file->options->add-ins->select solver->click on manage->select solver->click Ok. Your solver is now added in excel. You can check it under the Data tab.

Step 3: Entering Data in Excel

The first thing I am gonna do is enter my data in excel. After entering the data in excel, I have calculated the total of C3:F3. Similarly for others. This is done to take the total demand from Silo 1 and others.

Transportation LP problem [Linear programming problem]

Step 4: Creating the Model in Excel

After this, I am gonna break my model into two. The first table gives me the units supplied and the second table gives me the unit cost.

Cost table for LP problem [Linear programming problem]

Step 5: Calculating Total Cost

Now, I am calculating my total cost which will be given by Sumproduct of unit cost and units supplied.

Calculation of total cost for LP problem [Linear programming problem]

Step 6: Using Solver to Optimize the Model

Now I am gonna use Solver to compute my model. Similar to the above method. Add the objective function, variable cells, constraints.

Variable cells, objective function, and constraints of the LPP [Linear programming problem]

Step 7: Reviewing Results

Now your model is ready to be solved. Click on solve and you will get your optimal cost. The minimum transportation cost is $435.

Using LP to find minimum cost [Linear programming problem]

Applications of Linear Programming

Linear programming and optimization are utilized across various industries to enhance efficiency and reduce costs. Below are some common applications, each explained in detail:

Supply Chain Operations

Manufacturing Industries: Linear programming analyzes supply chain operations to maximize efficiency with minimum operation cost. By reconfiguring storage layouts, adjusting the workforce, and reducing bottlenecks based on recommendations from linear programming models, manufacturers can significantly improve their operations. For instance, Cequent, a US-based company, uses these techniques to optimize their warehouse operations.

Shelf Space Optimization

Retail Stores: Organized retail chains like Walmart, Hypercity, Reliance, and Big Bazaar use linear programming for shelf space optimization. With an increasing number of products, it is crucial to understand customer preferences. Products are strategically placed in stores considering shopping patterns, limited shelf space, and a variety of products, to make it easier for customers to locate and select items.

Optimizing Delivery Routes

Service Industry: Companies like FedEx and Amazon use optimization to determine the best delivery routes. This involves solving the traveling salesman problem using clustering and greedy algorithms. The objective is to minimize operation costs and delivery times by finding the most efficient routes for multiple salesmen traveling to multiple cities.

Optimizing Machine Learning Models

Machine Learning: Supervised learning in machine learning relies on optimization principles. Training systems fit mathematical models to labeled input data, enabling them to predict values from unknown test data. Linear programming fine-tunes these models for accurate predictions.

Resource Allocation

Industries: Linear programming is applied to allocate limited resources such as labor, raw materials, and machine hours efficiently. It helps determine the optimal mix of resources to maximize production output while minimizing costs.

Telecommunications

  • Network Design: Linear programming optimizes the design of telecommunications networks by determining the best locations for network elements and data routing to minimize costs and improve service quality.
  • Bandwidth Allocation: It ensures efficient allocation of bandwidth resources, meeting user demands while maintaining service quality.

Environmental Management

  • Waste Management: Linear programming optimizes waste collection routes, recycling processes, and disposal strategies to reduce environmental impact and operational costs.
  • Resource Conservation: It aids in planning the use of natural resources like water, forests, and minerals, ensuring sustainable practices and minimal environmental degradation.

Military and Defense

  • Logistics and Supply Chain: Linear programming optimizes military logistics and supply chain operations, ensuring efficient distribution of supplies and equipment.
  • Strategic Deployment: It helps in the optimal deployment of military units and resources, considering constraints like terrain, enemy positions, and logistics.

Healthcare

  • Hospital Management: Linear programming assists in optimizing the allocation of hospital resources, including staff, equipment, and beds, to enhance patient care and operational efficiency.
  • Disease Control: It aids in planning the distribution of vaccines and other medical supplies, ensuring effective disease control and prevention measures.

Retail and Inventory Management

  • Stock Management: Linear programming helps retailers optimize their inventory levels, ensuring adequate stock while minimizing holding costs and reducing stockouts.
  • Pricing Strategy: Develop optimal pricing strategies that maximize profits while considering competition and customer demand.

Education

  • Resource Allocation in Schools: Linear programming assists in the optimal allocation of resources such as teachers, classrooms, and equipment in schools and universities.
  • Curriculum Planning: It helps in planning course schedules and faculty assignments to maximize educational outcomes and resource utilization.

Sports and Recreation

  • Team Selection: Linear programming can optimize team selection and player assignments in sports, ensuring the best combination of skills and performance.
  • Tournament Scheduling: It aids in scheduling tournaments and matches, optimizing time and resource utilization.

Television and Media

  • Broadcast Scheduling: Linear programming helps plan broadcast schedules for television and radio stations, optimizing viewer ratings and advertising revenue.
  • Content Allocation: It assists in allocating resources for content production and distribution, ensuring optimal use of available assets.

Construction and Engineering

  • Project Planning: Linear programming aids in planning and scheduling construction projects, optimizing resource allocation, and minimizing costs and delays.
  • Material Procurement: It helps in planning the procurement of construction materials, ensuring timely delivery and cost-effective purchasing.

Conclusion

I hope you enjoyed reading this article. I have tried to explain all the basic concepts under linear programming. If you have any doubts or questions feel free to post them in the comments section. For easy understanding, we have broken this long article into a shorter course format – Linear Programming for Data Science Professionals

I have explained each concept with a real-life example. I want you to try them at your end and get hands-on experience. Let me know what you think!

Frequently Asked Questions

Q1. What is linear programming and why is it important?

A. Linear programming is an optimization technique that optimizes a linear objective function, subject to linear equations or constraints. This mathematical method finds the best possible solution to a problem with multiple objectives and limited resources.

Q2. What is a linear programming problem in simple words?

A. Linear programming problem is an optimization problem where the goal is to find the maximum or the minimum value within a number of constraints(such as available resources or limitations) depending upon the type of problem we are solving.

Q3. What is an objective function in LPP (linear programming problem)?

A. An objective function in LPP is a linear equation optimized to achieve the best outcome within given constraints.

avcontentteam 29 Aug, 2024

Frequently Asked Questions

Lorem ipsum dolor sit amet, consectetur adipiscing elit,

Responses From Readers

Clear

kumar
kumar 28 Feb, 2017

EXCELLENT NARRATION.I LIKE IT.

Arun
Arun 28 Feb, 2017

Nice Article. Well written !!!

Dima
Dima 28 Feb, 2017

Can you elaborate more on applications in Machine Learning? I was looking for uses of LP in ML, but all I found are rarely used applications - such as L1 norm-distance classifications and clustering.

Bipul
Bipul 28 Feb, 2017

Nice and simple explanation. And much needed for budding data scientist like me. Thanks!

JB
JB 28 Feb, 2017

Hi Swati, Thank you for your articles, they always teach useful stuff. Could you please provide printer versions of the article as I would like to collect them for later reference. Thank you

Geeta Shah
Geeta Shah 28 Feb, 2017

Thank you ma'am. it was really helpful :-)

Abhishek Kulkarni
Abhishek Kulkarni 28 Feb, 2017

Thank You for the insightful article. Always knew of the existence of optimization methods, but never of the applications.

Anil Muduli
Anil Muduli 02 Mar, 2017

Very Good article with explanations. Appreciate it. Thanks.

Abhinandan Nuli
Abhinandan Nuli 02 Mar, 2017

Amazing article!! Simple, yet effective one.. Thanks for sharing the info.

Anantha Sreenivas
Anantha Sreenivas 03 Mar, 2017

Hi Swati, Very informative and useful article, esp. with the real life examples. Thank you,

Rahul Ravipati
Rahul Ravipati 08 Mar, 2017

Hi Swati, Great read. I studied Linear programming in my master's degree in industrial and systems engineering. I ahave know idea about data science.My doubt is how is linear programming used in data science? What is the relation between LP and data science?

Noor Mohamed M
Noor Mohamed M 25 Jul, 2017

it helped me to revise and quick wrap up the important concepts in operation research subject. Good work swati, Have you written anymore article.

mohammad bello
mohammad bello 11 Aug, 2017

thanks for sharing with us, nice

Gangai selvi
Gangai selvi 04 Sep, 2017

Excellent.?☺☺☺☺

Siddu
Siddu 13 Oct, 2017

Hi Swati, Nice explanation of LP with different examples. Thanks a lot this. but it would be very thankful where i can find a best example of LP with SAS code.

bhargav
bhargav 21 Oct, 2017

Excellent,Can you please provide the document for application of linear programming in production scheduling.

Mit
Mit 22 Nov, 2017

Hi, It's a very informative article, thanks for this. I use Apache Spark's MLlib for my machine learning usecases. How to do the same linear optimization using spark MLlib?

Mit
Mit 27 Nov, 2017

Hi Swati, This is very informative. Thanks for this article. I use Apache Spark MLlib for my machine learning use cases. Is there a way to do this linear optimization in apache spark? I have seen certain methods which talk about linear classification or regression but not optimization. Please make an article solving these kinds of problems using spark if possible. Thank you.

Deepak
Deepak 30 Nov, 2017

Hi Swati, You explained LP flawlessly. Reading your article have made me to understand the concept clearly and have cleared all my doubts I had earlier. Thanks & regards

Rajkumar K
Rajkumar K 11 Dec, 2017

Great summary of optimization problems & linear programming. This is a great starting point for a newbie and unlike other content on the web, this is very precise and focused.

Avaneeesh Kumar
Avaneeesh Kumar 21 Dec, 2017

Really loved your article.

avinash
avinash 28 Dec, 2017

hi, can we have real-time data-sets so that we could implement with this optimization technique and can you please provide it with real time case study...

mahendra ramphul
mahendra ramphul 07 Jan, 2018

Excellent and making LP interesting for novice like me. Actually, i am learning for a DBA and need to understand and use IBM Cplex sofware during the data analysis. The thesis investigates Empty Containing Policies of Shipping Lines Operating in Mauritius and most of the literature review and studies have used optimisation solution for their data analysis. Unfortunately, i have contacted the local IBM representative but he is unable to help. Can you put me in contact with persons well versed with IBM Cplex and / or anyone who can help. Thank you M.Ramphul

J
J 19 Jan, 2018

Hey! Thank you so much for your hard work on this!

Azher
Azher 11 Feb, 2018

Very nice article and very easy to understand especially for the beginners.

Aviroop
Aviroop 30 Mar, 2018

Great article Swati! AMPL and WinQSB are also great tools for solving LP problems.

Satnam
Satnam 01 Apr, 2018

@Swati - Good effort. A suggestion - Use python-based libraries so that it can be integrated into the product as well. Also, venture into the BIP and MIP problems.

beni castro
beni castro 12 Apr, 2018

Thank you for help. what about maximization, minimization, and dual problems

bhupender singh janmejai
bhupender singh janmejai 18 Apr, 2018

A great and a must read article for everyone aspiring to learn optimisation and business decisions.All examples provide real business challenges and prompts the reader to solve them. I have been solving all the examples above , but I am unsure about the solutions I have been deriving !! Can u please share with us the solutions to all the problems mentioned above, like the logistics and the chocolate manufacturing case? .It would be great if you can share the details of those problems. Regards !

SHUBHAM KSHIRSAGAR
SHUBHAM KSHIRSAGAR 03 May, 2018

BEST EXPLANATION!!! THANK YOU SO MUCH...

Thrishul
Thrishul 17 May, 2018

Nice Article. Thanks

Dai Software
Dai Software 10 Sep, 2021

Cliff Richard Kikawa
Cliff Richard Kikawa 14 Dec, 2021

The best introductory part to LP that I have seen in recent times. I have actually made class notes from it to share with my students.

KIDIST ADUGNA
KIDIST ADUGNA 26 May, 2022

7. A farmer is attempting to decide which of three crops he should plant on his 100 acre farm. The profit from each crop is strongly dependent on the rainfall during the growing season. He has categorized the amount of the rainfall as substantial, moderate or light. He estimates his profit for each crop as shown in the table below: Rainfall Estimated Profit (Br) Crop A Crop B Crop C Substantial Moderate Light 7,000 3,500 1,000 2,500 3,500 4,000 4,000 4,000 3,000 Based on the weather in previous seasons and the current projection for the coming season, he estimates the probability of substantial rainfall as 0.2, that of moderate rainfall as 0.3 and that of light rainfall as 0.5. Furthermore, services of forecasters could be employed to provide a detailed survey of current rainfall prospects as shown in the table. Rainfall Estimated Profit (Br) Crop B Crop C Substantial Moderate Light 0.70 0.30 0.10 0.25 0.60 0.20 0.05 0.10 0.70 (a) From the available data, determine the optimal decision as to which crop to plant under condition of uncertainty (b) From the available data, determine the optimal decision as to which crop to plant under condition of risk EMV and EOL

Aman
Aman 06 Oct, 2022

For the first time a worthy blog I found with all the necessary information and the required data. the explanation is in simple understandable language. keep up the good work!!!

Neba Brenda Asoh
Neba Brenda Asoh 13 Oct, 2022

I learnt a lot thanks it was great working with you

Angel
Angel 12 May, 2023

Thanks Swati for the content

Aiza Danayal
Aiza Danayal 07 Mar, 2024

Well written article

wily_atoosa1089
wily_atoosa1089 26 Aug, 2024

thank you!