## Linear Programming

Linear programming is a process that is used to determine the best outcome of a linear function. It is the best method to perform linear optimization by making a few simple assumptions. The linear function is known as the objective function. Real-world relationships can be extremely complicated. However, linear programming can be used to depict such relationships, thus, making it easier to analyze them.

Linear programming is used in many industries such as energy, telecommunication, transportation, and manufacturing. This article sheds light on the various aspects of linear programming such as the definition, formula, methods to solve problems using this technique, and associated linear programming examples.

## What is Linear Programming?

## Linear Programming Definition

## Linear Programming Examples

## Linear Programming Formula

- Objective Function: Z = ax + by
- Constraints: cx + dy ≤ e, fx + gy ≤ h. The inequalities can also be "≥"
- Non-negative restrictions: x ≥ 0, y ≥ 0

## How to Solve Linear Programming Problems?

- Step 1: Identify the decision variables.
- Step 2: Formulate the objective function. Check whether the function needs to be minimized or maximized.
- Step 3: Write down the constraints.
- Step 4: Ensure that the decision variables are greater than or equal to 0. (Non-negative restraint)
- Step 5: Solve the linear programming problem using either the simplex or graphical method.

Let us study about these methods in detail in the following sections.

## Linear Programming Methods

## Linear Programming by Simplex Method

- 40\(x_{1}\) - 30\(x_{2}\) + Z = 0

\(x_{1}\) + \(x_{2}\) + \(y_{1}\) =12

2\(x_{1}\) + \(x_{2}\) + \(y_{2}\) =16

\(y_{1}\) and \(y_{2}\) are the slack variables.

Step 2: Construct the initial simplex matrix as follows:

Using the elementary operations divide row 2 by 2 (\(R_{2}\) / 2)

Now apply \(R_{1}\) = \(R_{1}\) - \(R_{2}\)

Finally \(R_{3}\) = \(R_{3}\) + 40\(R_{2}\) to get the required matrix.

Also, when \(x_{1}\) = 4 and \(x_{2}\) = 8 then value of Z = 400

## Linear Programming by Graphical Method

Suppose we have to maximize Z = 2x + 5y.

The constraints are x + 4y ≤ 24, 3x + y ≤ 21 and x + y ≤ 9

To solve this problem using the graphical method the steps are as follows.

Step 1: Write all inequality constraints in the form of equations.

Step 2: Plot these lines on a graph by identifying test points.

3x + y = 21 passes through (0, 21) and (7, 0).

x + y = 9 passes through (9, 0) and (0, 9).

Any point that lies on or below the line x + 4y = 24 will satisfy the constraint x + 4y ≤ 24.

Similarly, a point that lies on or below 3x + y = 21 satisfies 3x + y ≤ 21.

Also, a point lying on or below the line x + y = 9 satisfies x + y ≤ 9.

C = (4, 5) formed by the intersection of x + 4y = 24 and x + y = 9

33 is the maximum value of Z and it occurs at C. Thus, the solution is x = 4 and y = 5.

## Applications of Linear Programming

- Manufacturing companies make widespread use of linear programming to plan and schedule production.
- Delivery services use linear programming to decide the shortest route in order to minimize time and fuel consumption.
- Financial institutions use linear programming to determine the portfolio of financial products that can be offered to clients.

- Introduction to Graphing
- Linear Equations in Two Variables
- Solutions of a Linear Equation
- Mathematical Induction

Important Notes on Linear Programming

- Linear programming is a technique that is used to determine the optimal solution of a linear objective function.
- The simplex method in lpp and the graphical method can be used to solve a linear programming problem.
- In a linear programming problem, the variables will always be greater than or equal to 0.

go to slide go to slide go to slide

## Practice Questions on Linear Programming

## FAQs on Linear Programming

What is meant by linear programming.

## What is Linear Programming Formula?

The general formula for a linear programming problem is given as follows:

## What is the Objective Function in Linear Programming Problems?

## How to Formulate a Linear Programming Model?

The steps to formulate a linear programming model are given as follows:

- Identify the decision variables.
- Formulate the objective function.
- Identify the constraints.
- Solve the obtained model using the simplex or the graphical method.

## How to Find Optimal Solution in Linear Programming?

## How to Find Feasible Region in Linear Programming?

To find the feasible region in a linear programming problem the steps are as follows:

- Draw the straight lines of the linear inequalities of the constraints.
- Use the "≤" and "≥" signs to denote the feasible region of each constraint.
- The region common to all constraints will be the feasible region for the linear programming problem.

## What are Linear Programming Uses?

- Data Science | All Courses
- PGP in Data Science and Business Analytics Program from Maryland
- M.Sc in Data Science – University of Arizona
- M.Sc in Data Science – LJMU & IIIT Bangalore
- Executive PGP in Data Science – IIIT Bangalore
- Learn Python Programming – Coding Bootcamp Online
- ACP in Data Science – IIIT Bangalore
- PCP in Data Science – IIM Kozhikode
- Advanced Program in Data Science Certification Training from IIIT-B
- PMP Certification Training | PMP Online Course
- CSM Course | Scrum Master Certification Training
- PCP in HRM and Analytics – IIM Kozhikode
- Product Management Certification – Duke CE
- PGP in Management – IMT Ghaziabad
- Software Engineering | All Courses
- M.Sc in CS – LJMU & IIIT Bangalore
- Executive PGP in Software Development
- Full Stack Development Certificate Program from Purdue University
- Blockchain Certification Program from Purdue University
- Cloud Native Backend Development Program from Purdue University
- Cybersecurity Certificate Program from Purdue University
- MBA & DBA | All Courses
- Master of Business Administration – IMT & LBS
- Executive MBA SSBM
- Global Doctor of Business Administration
- Global MBA from Deakin Business School
- Machine Learning | All Courses
- M.Sc in Machine Learning & AI – LJMU & IIITB
- Certificate in ML and Cloud – IIT Madras
- Executive PGP in Machine Learning & AI – IIITB
- ACP in ML & Deep Learning – IIIT Bangalore
- ACP in Machine Learning & NLP – IIIT Bangalore
- M.Sc in Machine Learning & AI – LJMU & IIT M
- Digital Marketing | All Courses
- ACP in Customer Centricity
- Digital Marketing & Communication – MICA
- Business Analytics | All Courses
- Business Analytics Certification Program
- Artificial Intelligences US
- Blockchain Technology US
- Business Analytics US
- Data Science US
- Digital Marketing US
- Management US
- Product Management US
- Software Development US
- Executive Programme in Data Science – IIITB
- Master Degree in Data Science – IIITB & IU Germany
- ACP in Cloud Computing
- ACP in DevOp
- ACP in Cyber Security
- ACP in Big Data
- ACP in Blockchain Technology
- Master in Cyber Security – IIITB & IU Germany

## Linear Programming Problems, Solutions & Applications [With Example]

## What is Linear Programming?

Check out our data science online courses to upskill yourself

## Basics of Linear Programming

Here are some fundamental terms of linear programming:

## Decision Variable

## Non-negativity Restriction

## Objective Function

## Formulating Linear Programming Problems

- One unit of toy A requires you one unit of resource X and three units of resource Y
- One unit of toy B requires one unit of resource X and two units of resource Y

How many units of each toy would you produce to get the maximum profit?

## The Solution

Let’s represent our linear programming problem in an equation:

Read: Linear Programming Project Ideas & Topics

upGrad’s Exclusive Data Science Webinar for you –

ODE Thought Leadership Presentation

## Explore our Popular Data Science Online Courses

Steps of formulating linear programming problems.

To formulate a linear programming problem, follow these steps:

- Find the decision variables
- Find the objective function
- Identify the constraints
- Remember the non-negativity restriction

## Solving Linear Programming Problems with R

We’ll start solving this problem by defining its objective function:

max(Sales) = max( 25 y 1 + 20 y 2 )

## Top Data Science Skills to Learn to upskill

We’ll now set the constraints for our problem:

We aim to find the correct number of products we have to manufacture to get the maximum profit.

We’ll use lpsolve to solve this LP problem and start with setting the objective function:

Loading required package: lpSolve

Then we’ll build a matrix for the constraints:

> const <- matrix(c(20, 12, 4, 4), nrow=2, byrow=TRUE)

> resource_constraints <- 1800

Let’s now create the already-defined equations:

> rhs <- c(resource_constraints, time_constraints)

lp( direction, objective, const.mat, const.dir, const.rhs )

> optimum <- lp(direction=”max”, objective.in, const, direction, rhs)

Success: the objective function is 2625

num.bin.solns 1 -none- numeric

sens.coef.from 1 -none- numeric

dense.const.nrow 1 -none- numeric

After running the code above, you can get the desired solutions for our problem.

The optimum values for y1 and y2:

Remember that y1 and y2 were the units of product A and product B we had to produce:

The maximum profit we can generate with the obtained values of y1 and y2 is:

Also Read: Linear Algebra For Machine Learning

## Read our popular Data Science Articles

- With the rising popularity of delivery services, linear programming has become one of the most favoured methods of finding the optimum routes. When you take an Ola or Uber, the software would use linear programming to find the best route. Delivery companies like Amazon and FedEx also use it to determine the best routes for their delivery men. They focus on reducing the delivery time and cost.
- Machine learning’s supervised learning works on the fundamental concepts of linear programming. In supervised learning, you have to find the optimal mathematical model to predict the output according to the provided input data.
- The retail sector uses linear programming for optimizing shelf space. With so many brands and products available, determining where to place them in the store is a very rigorous task. The placement of a product in the store can affect its sales greatly. Major retail chains such as Big Bazaar, Reliance, Walmart, etc. use linear programming for determining product placement. They have to keep the consumers’ interest in mind while ensuring the best product placement to yield maximum profit.
- Companies use linear programming to improve their supply chains. The efficiency of a supply chain depends on many factors such as the chosen routes, timings, etc. By using linear programming, they can find the best routes, timings, and other allocations of resources to optimize their efficiency.

## Learn More about Linear Programming and Data Science

- Top Reasons to become a Data Scientist
- The Algorithms Every Data Scientist Should Know
- How to Become a Data Scientist

## How does linear programming help in optimization?

## How is linear programming useful in data science and machine learning?

## Where is linear programming used?

## Prepare for a Career of the Future

Leave a comment, cancel reply.

Your email address will not be published. Required fields are marked *

## Our Trending Data Science Courses

- Data Science for Managers from IIM Kozhikode - Duration 8 Months
- Executive PG Program in Data Science from IIIT-B - Duration 12 Months
- Master of Science in Data Science from LJMU - Duration 18 Months
- Executive Post Graduate Program in Data Science and Machine LEarning - Duration 12 Months
- Master of Science in Data Science from University of Arizona - Duration 24 Months

## Our Popular Data Science Course

## Get Free Consultation

Data science skills to master.

- Data Analysis Courses
- Inferential Statistics Courses
- Hypothesis Testing Courses
- Logistic Regression Courses
- Linear Regression Courses
- Linear Algebra for Analysis Courses

## Related Articles

## How to Build a Collaborative Data Science Environment?

## Top 30 Tableau Interview Questions & Answers in 2023

## What is Data warehousing? Type, Definition & Examples

Start your upskilling journey now, get a free personalised counselling session..

## Explore Free Courses

Data Science & Machine Learning

## IMAGES

## VIDEO

## COMMENTS

The assignment problem can be solved by presenting it as a linear program. For convenience we will present the maximization problem. Each edge (i,j), where i is in A and j is in T, has a weight . For each edge we have a variable . The variable is 1 if the edge is contained in the matching and 0 otherwise, so we set the domain constraints:

If a linear programming problem represents a company’s profits, then a maximum amount of profit is desired. In most of the examples in this section, both the maximum and minimum will be found. Fundamental Theorem of Linear Programming To solve a linear programming problem, we first need to know the Fundamental Theorem of Linear Programming:

Consultant project assignment (minimization) 65. College admissions (maximization) 66. Product flow/scheduling (minimization) PROBLEM SOLUTIONS 1. Since the profit values would change, the shadow prices would no longer be effective. Also, the sensitivity analysis provided in the computer output does not provide ranges for constraint parameter ...

The most important part of solving linear programming problem is to first formulate the problem using the given data. The steps to solve linear programming problems are given below: Step 1: Identify the decision variables. Step 2: Formulate the objective function. Check whether the function needs to be minimized or maximized.

Writing of an assignment problem as a Linear programming problem Example 1. Three men are to to be given 3 jobs and it is assumed that a person is fully capable of doing a job independently. The following table gives an idea of that cost incurred to complete each job by each person: Jobs → Men ↓ J1 J2 J3 Supply M1 M2 M3 Demand 20 15 8 1 28 ...

For additional formulation examples, browse Section 3.4 of the text. We now briefly discuss how to use the LINDO software. Suppose you wish to solve the product-mix problem. Launch the LINDO package. We will use XR and XE to denote the decision variables. In the current window, enter: MAX 5 XR + 7 XE ST 3 XR + 4 XE < 650 2 XR + 3 XE < 500 END ...

Let’s represent our linear programming problem in an equation: Z = 6a + 5b Here, z stands for the total profit, a stands for the total number of toy A units and b stands for total number to B units. Our aim is to maximize the value of Z (the profit).