↓ Skip to main content
AI & Data

Linear Programming (LP)

·2 mins

What is Linear Programming?
#

Linear programming is a mathematical technique used to find the best possible outcome (maximum profit or minimum cost) in a situation where the relationships between the factors involved are linear. It’s like finding the sweet spot where you get the most out of what you have, given certain limitations.

Example: A Furniture Company
#

Let’s say a furniture company makes chairs and tables. Each chair takes 2 hours to assemble and 1 hour to finish. Each table takes 3 hours to assemble and 2 hours to finish. The company has a total of 40 hours available for assembly and 30 hours for finishing each week. If each chair sells for $50 and each table sells for $75, how many chairs and tables should the company make each week to maximize its revenue?

Components of Linear Programming
#

  1. Decision Variables: These are the things you’re trying to decide. In our example:
    • x = number of chairs to make
    • y = number of tables to make
  2. Objective Function: This is what you’re trying to maximize or minimize. Here, it’s the revenue:
    • Revenue = 50x + 75y (We want to make this as big as possible)
  3. Constraints: These are the limitations you have. In our case:
    • Assembly time: 2x + 3y ≤ 40 (Can’t use more than 40 hours of assembly time)
    • Finishing time: 1x + 2y ≤ 30 (Can’t use more than 30 hours of finishing time)
    • Non-negativity: x ≥ 0, y ≥ 0 (Can’t make a negative number of chairs or tables)
Author
Samarthya
Engineer, learner, tinkerer. This is my trophy shelf of everyday work and leisure.

Related

Monte Carlo Optimisation

·3 mins
Imagine you’re trying to find the best solution to a problem, but the problem is really complex and has a lot of randomness involved. Maybe you’re trying to design a new drug, or optimize a financial portfolio, or figure out the best route for a delivery truck.

Business Analytics: The bigger picture

Imagine you’re a business owner trying to figure out why your sales are down. You could guess, or you could use business analytics. In simple terms, business analytics is like a detective for your business. It uses data to uncover clues and insights that help you make better decisions. Instead of relying on gut feelings, you use facts and figures to understand what’s happening and what you can do about it.

Comparison of Competing Forecasting Models

·4 mins
Performance Measure Description Interpretation Advantages Disadvantages Mean Absolute Error (MAE) Average absolute difference between forecast and actual values. Lower MAE indicates better accuracy. Easy to understand and interpret. Robust to outliers. Doesn’t penalize large errors more than small ones. Mean Squared Error (MSE) Average squared difference between forecast and actual values. Lower MSE indicates better accuracy. Penalizes larger errors more heavily. Mathematically convenient. Sensitive to outliers. Units are squared. Root Mean Squared Error (RMSE) Square root of MSE. Lower RMSE indicates better accuracy. Same units as the original data. Penalizes larger errors more heavily. Sensitive to outliers. Mean Absolute Percentage Error (MAPE) Average absolute percentage difference between forecast and actual values. Lower MAPE indicates better accuracy. Easy to understand and interpret. Scale-independent. Undefined if actual values are zero. Can be biased if actual values are close to zero. Symmetric Mean Absolute Percentage Error (sMAPE) A variation of MAPE that handles zero or near-zero actual values better. Lower sMAPE indicates better accuracy. Handles zero or near-zero actual values better than MAPE. Scale-independent. Can still be biased if forecasts are consistently over or under the actual values. Mean Error (ME) or Bias Average difference between forecast and actual values. Closer to zero indicates less bias. Positive ME suggests over-forecasting. Negative ME suggests under-forecasting. Detects systematic over or under-forecasting. Doesn’t measure the magnitude of errors, only the direction. Theil’s U Compares the forecasting accuracy of the model to a naive forecast (e.g., assuming no change). U < 1 indicates better performance than the naive forecast. U = 1 means equal performance. U > 1 means worse performance. Useful for assessing the value added by the model compared to a simple benchmark. Can be sensitive to outliers. Imagine you’re predicting how many ice cream cones you’ll sell each day. You have a model that makes these predictions, and you want to see how good it is. These measures help you do that.