Linear Programming Part 2 - Building Blocks
The core building blocks of an LP problem. Decision variables, objective, constraints, feasible solutions, feasible region
▶ Linear Programming Part 0- About This Series
▶ Linear Programming Part 1- Where LP Fits in AI Systems
▶ Linear Programming Part 2- Fundamental Building Blocks
▶ Linear Programming Part 3 - Solving LP Problems
▶ Linear Programming Part 4 - Practical Scenarios
▶ Linear Programming Part 5 - LP Algorithms
▶ Linear Programming Part 6- LP vs Integer Programming vs Mixed-Integer Programming
▶ Linear Programming Part 7- Limiations of LP
▶ Linear Programming Part 8- Sensitivity Anddalysis
▶ Linear Programming Part 9- Understanding Solver Output
▶ Linear Programming Part 10- End to End Case Study
1. Essential Blocks
A typical Linear Programming (LP) problem has a few key building blocks that are used to formulate an optimization problem.
The main building blocks are:
- Decision Variables: What can we choose or control?
- Objective Function: What are we trying to maximize or minimize?
- Constraints: What limitations or requirements must our decisions satisfy?
For example, a company may need to decide:
- How many units of each product to produce
- How to maximize its profit
- How to operate within available material and labor
These decisions, goals, and limitations can be expressed mathematically and combined into an LP problem.

The following sections introduce each building block step by step.
2. Decision Variables
A decision variable represents something that we can choose or control in an optimization problem.
For example, suppose a company produces a product.
Let:
Here, \(x\) is the decision variable because the company can decide how many units to produce.
The value of \(x\) is not known beforehand. The optimization process will determine the value that gives the best result while satisfying the constraints.
Example
Suppose the company can produce between 0 and 100 units:
The decision variable is still simply:
The numbers 0 and 100 are constraints on that variable.
Two Decision Variables
Many real problems involve more than one decision.
Suppose a company produces two products:
Now the optimization problem needs to determine two values:
For example:
would represent producing 3 units of A and 5 units of B.
So, the first question to ask when building an LP problem is:
What decisions do I need to make?
Those decisions become the decision variables.
3. Objective Function
The objective function defines what we want to maximize or minimize.
It represents the result we are trying to optimize based on the values of our decision variables.
For example, suppose a company produces two products:
If each unit of Product A gives $10 profit and each unit of Product B gives $15 profit, the total profit is:
If the goal is to maximize profit, the objective function is:
The optimization process will try to find values of \(x\) and \(y\) that produce the highest possible value of the objective function while still satisfying all constraints.
Maximization vs Minimization
An objective can be either maximized or minimized.
Examples of maximization:
- Maximize profit
- Maximize production
- Maximize revenue
Examples of minimization:
- Minimize cost
- Minimize delivery time
- Minimize resource usage
For example, if producing a product costs $8 for A and $12 for B, and the goal is to minimize production cost:
So, the second question to ask when building an LP problem is:
What do I want to maximize or minimize?
The answer becomes the objective function.
4. Constraints
Constraints define the limitations or requirements that our decisions must satisfy.
They determine which values of the decision variables are allowed.
Using our previous example:
Suppose producing the products requires material and labor.
If we have at most 20 units of material:
If we have at most 18 hours of labor:
These are constraints because they limit how much of each product we can produce.
Non-Negativity Constraints
We also normally cannot produce a negative number of products.
Therefore:
These are also constraints.
Types of Constraints
Constraints can represent different kinds of requirements:
Resource limits
Minimum requirements
Exact requirements
The important point is that constraints define the boundaries within which the decision variables can be chosen.
So, the third question to ask when building an LP problem is:
What limitations or requirements must my decisions satisfy?
The answers become the constraints of the LP problem.
5. Putting the Three Blocks Together
We now have the three main building blocks:
- Decision Variables: What can we choose?
- Objective Function: What do we want to maximize or minimize?
- Constraints: What limitations or requirements must we satisfy?
Let's combine them into one simple LP problem.
Example
Suppose a company produces two products:
Assume the following:
| Product A | Product B | |
|---|---|---|
| Profit per unit | $10 | $15 |
| Material required per unit | 2 units | 4 units |
| Labor required per unit | 3 hours | 2 hours |
The company has:
- 20 units of material available
- 18 hours of labor available
The company wants to determine how many units of each product to produce.
Step 1: Decision Variables
The decisions we need to make are the quantities of the two products:
Step 2: Objective Function
Each unit of Product A generates profit of $10, and each unit of Product B generates profit of $15.
Therefore, total profit is:
Since the company wants to maximize profit:
Step 3: Constraints
Each unit of Product A requires 2 units of material, while each unit of Product B requires 4 units.
Since only 20 units of material are available:
Each unit of Product A requires 3 hours of labor, while each unit of Product B requires 2 hours.
Since only 18 hours of labor are available:
We also cannot produce a negative number of products:
Complete LP Formulation
Putting everything together:
Subject to:
We have now formulated the LP problem.
The next step is to understand which combinations of \(x\) and \(y\) are feasible and which one gives the optimal result.
6. Feasible Solutions
Once an LP problem has been formulated, not every possible value of the decision variables is acceptable.
A feasible solution is a set of decision-variable values that satisfies all constraints.
Using our previous example:
Feasible Solution 1
Consider the solution (we'll show how to find solution later):
We can check each constraint.
Material:
Labor:
Non-negativity:
All constraints are satisfied, so:
is a feasible solution.
Feasible Solution 2
Now consider another valid solution :
Material:
Labor:
This solution also satisfies all constraints, so it is feasible.
A NOT Feasible solution
However, consider:
Material:
The material constraint is violated, so this is not a feasible solution.
7. Feasible Region
When there are two decision variables, we can visualize all feasible solutions on a graph.
The collection of all points that satisfy every constraint is called the feasible region.
In simple terms:
Feasible region = all possible decisions that are allowed by the constraints.
The optimization problem then looks for the best solution within this feasible region.
This gives us an important distinction:
- Feasible solution: One specific solution that satisfies all constraints.
- Feasible region: All solutions that satisfy all constraints.
- Optimal solution: The feasible solution that gives the best objective value.

8. Summary
An LP problem can be understood through three essential building blocks:
- Decision Variables: What decisions can we make?
- Objective Function: What do we want to maximize or minimize?
- Constraints: What limitations or requirements must our decisions satisfy?
Once these are defined, we can formulate the complete LP problem.
The constraints determine the feasible region, which contains all possible solutions that satisfy the requirements.
The optimization process then looks for the optimal solution, which is the feasible solution that gives the best value for the objective.
In simple terms:
These concepts form the foundation for understanding and solving Linear Programming problems.