Linear Programming
Introduction:
Linear Programming is the technique of portraying complicated relationships between elements by using linear functions to find optimum points. Linear Programming begins by taking the real-world data and translating it into a series of mathematical formulas.To find the optimum result, real-life problems are translated into mathematical models to better conceptualize linear inequalities and their constraints. 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.
This is an important part of Artificial Intelligence course and this lab report is done by myself under the supervision of Nuruzzaman Faruqui, lecturer of City University, Bangladesh. From this course we get to explore the real applicable approaches through AI and also acquires better knowledge of the functionality of AI and how AI is making our daily life easier. That's why this is the best Artificial Intelligence course in Bangladesh.
Problem Statement:
Applying the linear programming we can minimize a cost function i.e., c₁x₁ + c₂x₂ + … + cₙxₙ. Here, x is a variable, and c_ is similar to co-efficient. In linear programming a constraint for sum of a variable can be shown as follows:
(a₁x₁ + a₂x₂ + … + aₙxₙ ≤ b) or (a₁x₁ + a₂x₂ + … + aₙxₙ = b). Here, x_ is a variable with a1_co-efficient and b is resources.
From the above example we can illustrate the problem as like-
- Two machines, X₁ and X₂.
- X₁ costs $50/hour to run, X₂ costs $80/hour to run. The goal is to minimize cost.
- This can be formalized as a cost function: 50x₁ + 80x₂.
- X₁ requires 5 units of labor per hour.
- X₂ requires 2 units of labor per hour.
- Total of 20 units of labor to spend.
- This can be formalized as a constraint: 5x₁ + 2x₂ ≤ 20.
- X₁ produces 10 units of output per hour.
- X₂ produces 12 units of output per hour.
- The company needs 90 units of output.
- This is another constraint.
- Literally, it can be rewritten as 10x₁ + 12x₂ ≥ 90.
- However, constraints need to be of the form (a₁x₁ + a₂x₂ + … + aₙxₙ ≤ b) or (a₁x₁ + a₂x₂ + … + aₙxₙ = b).
Therefore, we multiply by (-1) to get to an equivalent equation of the desired form: (-10x₁) + (-12x₂) ≤ -90
Code Commentary:
Result:
After implementing the code in python language we get the below result
Conclusion:
As Linear Programming is a valuable way of displaying real-world data in a mathematical way, it is commonly used in manufacturing and the service industry. For example, many large distribution companies will use linear programming in the analysis of their supply chain operations, similar to the toy example above. Additionally, linear programming can be used outside the warehouse in the optimization of delivery routes. Companies like Amazon and FedEx use linear programming to find the shortest and most efficient delivery routes. Linear programming is also used in machine learning applications where a neural network is trained to fit model of a function in order to label input data and predict unknown future values. There is lot more in Machine Learning than linear programming or regression modeling. Linear programming is a method to achieve the best outcome (such as maximum profit or lowest cost) in a mathematical model whose requirements are represented by linear relationships. Linear programming is a special case of mathematical programming (mathematical optimization).