What is Linear Programming in Data Science: Overview
By Rohit Sharma
Updated on Nov 25, 2022 | 7 min read | 899.9k views
Share:
For working professionals
For fresh graduates
More
By Rohit Sharma
Updated on Nov 25, 2022 | 7 min read | 899.9k views
Share:
Table of Contents
Data Science has grown as a truly interdisciplinary field that borrows from computer science, mathematics, data analysis, statistics, etc. Its advancements have helped businesses around the globe make much more informed, data-backed decisions. As a result, today, companies realise the importance of the data they have acquired through the years.
Data scientists use advanced tools to assess current business scenarios using existing data, derive relationships and find insightful patterns. This method is known as Descriptive Analytics. Further, data scientists also study the effects and their causes, keeping various dependent and independent variables in mind, known as Predictive Analytics.
Since Predictive Analytics works by identifying cause and effect relationships, it is beneficial for making insightful decisions for the future. However, this is not as straightforward as it might seem. Any business has a lot of variables to deal with – including current insights, constraints, and more.
Check out our data science certifications to upskill yourself.
To predict accurately, you must consider these variables and arrive at the optimum solution. This is where Linear Programming comes into the picture. Linear Programming is an important technique that works algorithmically and helps data scientists to find the most optimal solution for various problems. Linear Programming considers all the essential variables, equalities, and inequalities to come to the final solution, which ensures that the prediction is foolproof.
In this article, let’s look at what is Linear Programming, the different methods of Linear Programming and a sample Linear Programming problem!
Before beginning with the technicalities, it is crucial to note that programming in the context of Linear Programming does not refer to computer or software programming. On the other hand, Linear Programming is essentially an optimisation technique (Linear Optimization) helpful in finding the best outcomes from mathematical models. To formulate a linear program, it is important to have an understanding of the basic elements of Linear Programming, which include:
With the basic terms settled, let’s now look at what approaches can one take while solving a Linear Programming problem.
We can follow these four steps to solve a Linear Programming problem successfully:
We will dive deeper into these steps later when we look at a solved example of Linear Programming. But before that, let’s look at the various ways you can approach a Linear Programming problem. There are broadly four approaches to choose from:
During yearly festive seasons, a company takes two factors into account – X and Y – to create a user pack. The weight of the total package must be 5kg – and there must not be more than 4kg of Y, and at least 2kg of X. X and Y contribute to the entire profit as follows – Rs. 5 / kg for X and 6 / kg for Y.
Let’s try to solve this Linear Programming problem to arrive at the best mix which results in the highest profits for the company.
Our problem’s optimisation goal is profit maximisation. The profit contribution of X and Y is given to us in the problem statement. Now,
We have a, b as decision variables, whereas c is our required function.
We are given the following constraints in the problem:
The quantities for X and Y should be positive => a, b>0
Now, let us quickly summarise the whole problem as we have laid it out so far:
We need to optimise c = 5a+6b under the following two conditions:
We’re using the graphical method to solve this problem, so let us consider a 2-dimension graph with the X-Y axis and try to plot the equations and inequations. We will have the following things with us:
If you have plotted these lines and constraints on a graph sheet, you will have the final region that satisfies all the required conditions. The two points that lie on the most extreme of this line are possible considerations for profit maximisation. These are points (2,3) and (5,0). To find which out of these two gives better profits, we can simply put the points in our objective function and see which yields the best output:
As you can see, we get a higher profit value for option A. So, our solution that gives the best profits is as follows => 2kg of factor X and 3kg of factor Y!
There is no end to optimisation problems – especially when we talk in a business context. Businesses face optimisation challenges more frequently than they would like to. As a result, just the graphical method is not enough to solve more technical optimisation problems.
You need to understand important tools or programming languages to perform linear optimisation on multivariable problems successfully. But the good news is that it is not that difficult to get the hang of working on relevant tools or programming languages. The entire field of data science is highly welcoming, which makes it easier for people from any background to build a data science career, if they have an interest.
At upGrad, we have guided students from around the globe with diverse backgrounds and helped them develop the relevant theoretical knowledge and practical expertise required to succeed in data science. Check out our Executive Post Graduate Programme in Data Science for more information on our course structure, syllabus, and the upGrad advantage!
Get Free Consultation
By submitting, I accept the T&C and
Privacy Policy
Start Your Career in Data Science Today
Top Resources