Resource Allocation Linear Programming Model: How It Can Be Solved in Excel and Python
📌 Full technical details and complete code examples are available on Medium: https://medium.com/@natacherchum/resource-allocation-linear-programming-model-01337b658653
Resource allocation problems arise whenever limited resources must be distributed in the most efficient way. Typical objectives include maximizing profit or minimizing cost, subject to technological, financial, or capacity constraints.
When both the objective function and all constraints are linear, such problems can be formulated as a linear programming (LP) problem.
Problem Description
Consider a manufacturing enterprise that produces three products using three limited resources.
For each product:
The objective is to determine an optimal production plan that maximizes total profit without exceeding the available amounts of resources.
Mathematical Model
Let x₁, x₂, x₃ denote the production levels of Products 1, 2, and 3, respectively.
Objective function
Maximize
F = 5x₁ + 4x₂ + 3x₃
Constraints
6x₁ + 4x₂ + 2x₃ ≤ 24 (Resource 1)
x₁ + 2x₂ + x₃ ≤ 6 (Resource 2)
x₁ + x₂ + x₃ ≤ 10 (Resource 3)
x₁, x₂, x₃ ≥ 0
This formulation represents a standard LP structure with decision variables, an objective function, and resource constraints.
Beyond the Optimal Solution: Sensitivity Analysis
Obtaining an optimal solution is only the first step. In practice, decision-makers are often more interested in how robust this solution is with respect to parameter changes.
Sensitivity (post-optimality) analysis allows us to examine:
Since the choice of software directly affects the depth of analysis, the table below summarizes how Excel and Python-based tools differ in their support for sensitivity analysis in linear programming.
Solving the Model in Excel
Microsoft Excel Solver provides a user-friendly environment for solving LP problems.
After defining:
Solver finds the optimal solution and generates:
Excel Solver is particularly useful when automatic and complete sensitivity analysis is required without additional programming.
Solving the Model in Python
SciPy (scipy.optimize.linprog)
The LP model can be solved using the linprog function from scipy.optimize.
The result object provides:
However, automatic sensitivity ranges are not available and must be analyzed manually.
PuLP
PuLP is a high-level Python library for modeling LP problems in a readable, algebraic form.
Using PuLP:
PuLP allows access to:
As with SciPy, ranges of optimality and feasibility are not computed automatically.
Pyomo
Pyomo is a powerful modeling framework that separates model formulation from solution.
Pyomo provides great flexibility and is widely used in research and industry. Nevertheless, automatic sensitivity analysis is not available, and post-optimality analysis must be carried out manually or via solver-specific reports.
Key Remarks
📌 Full technical details and complete code examples are available on Medium: https://medium.com/@natacherchum/resource-allocation-linear-programming-model-01337b658653
#Optimization #LinearProgramming #DataAnalytics #BusinessIntelligence #OperationsResearch #ExcelTips #PythonForDataScience #DecisionSupport #ProcessImprovement #ResourceManagement