OR Algo Part 1
OR Algo Part 1
Introduction
The Simplex method is an approach to solving linear programming models by hand using
slack variables, tableaus, and pivot variables as a means to finding the optimal solution of
an optimization problem. A linear program is a method of achieving the best outcome
given a maximum or minimum equation with linear constraints. Most linear programs can
be solved using an online solver such as MatLab, but the Simplex method is a technique for
solving linear programs by hand. To solve a linear programming model using the Simplex
method the following steps are necessary:
● Standard form
● Introducing slack variables
● Creating the tableau
● Pivot variables
● Creating a new tableau
● Checking for optimality
● Identify optimal values
This document breaks down the Simplex method into the above steps and follows the
example linear programming model shown below throughout the entire document to find
the optimal solution.
Step 1: Standard Form
Standard form is the baseline format for all linear programs before solving for the optimal
solution and has three requirements: (1) must be a maximization problem, (2) all linear
constraints must be in a less-than-or-equal-to inequality, (3) all variables are non-negative.
These requirements can always be satisfied by transforming any given linear program
using basic algebra and substitution. Standard form is necessary because it creates an ideal
starting point for solving the Simplex method as efficiently as possible as well as other
methods of solving optimization problems.
Once the model is in standard form, the slack variables can be added as shown in Step 2 of
the Simplex method.
Step 2: Determine Slack Variables
Slack variables are additional variables that are introduced into the linear constraints of a
linear program to transform them from inequality constraints to equality constraints. If
the model is in standard form, the slack variables will always have a +1 coefficient. Slack
variables are needed in the constraints to transform them into solvable equalities with one
definite answer.
After the slack variables are introduced, the tableau can be set up to check for optimality as
described in Step 3.
Once the tableau has been completed, the model can be checked for an optimal solution as
shown in Step 4.
Step 4: Check Optimality
The optimal solution of a maximization linear programming model are the values assigned
to the variables in the objective function to give the largest zeta value. The optimal solution
would exist on the corner points of the graph of the entire model. To check optimality
using the tableau, all values in the last row must contain values greater than or equal to
zero. If a value is less than zero, it means that variable has not reached its optimal value. As
seen in the previous tableau, three negative values exists in the bottom row indicating that
this solution is not optimal. If a tableau is not optimal, the next step is to identify the pivot
variable to base a new tableau on, as described in Step 5.
In the example shown below, -10 is the smallest negative in the last row. This will designate
the x2 column to contain the pivot variable. Solving for the indicator gives us a value of
10 8 8
for the first constraint, and a value of 5for the second constraint. Due to 5 being the
3
smallest non-negative indicator, the pivot value will be in the second row and have a value
of 5.
Now that the new pivot variable has been identified, the new tableau can be created in Step
6 to optimize the variable and find the new possible optimal solution.
Step 6: Create the New Tableau
The new tableau will be used to identify a new possible optimal solution. Now that the
pivot variable has been identified in Step 5, row operations can be performed to optimize
the pivot variable while keeping the rest of the tableau equivalent.
I. To optimize the pivot variable, it will need to be transformed into a unit value (value
of 1). To transform the value, multiply the row containing the pivot variable by the
reciprocal of the pivot value. In the example below, the pivot variable is originally 5,
1
so multiply the entire row by 5.
II. After the unit value has been determined, the other values in the column containing
the unit value will become zero. This is because the x2 in the second constraint is
being optimized, which requires x2 in the other equations to be zero.
III. In order to keep the tableau equivalent, the other variables not contained in the
pivot column or pivot row must be calculated by using the new pivot values. For
each new value, multiply the negative of the value in the old pivot column by the
value in the new pivot row that corresponds to the value being calculated. Then add
this to the old value from the old tableau to produce the new value for the new
tableau. This step can be condensed into the equation on the next page:
New tableau value = (Negative value in old tableau pivot column) x (value in new tableau
pivot row) + (Old tableau value)
Old Tableau:
New Tableau:
Numerical examples are provided below to help explain this concept a little better.
Numerical examples:
I. To find the s2 value in row 1:
New tableau value = (Negative value in old tableau pivot column) * (value in new
tableau pivot row) + (Old tableau value)
1 3
New tableau value = (-3) * (5) + 0 = -5
1
New value = (10) * (5) + -8 = -6
Once the new tableau has been completed, the model can be checked for an optimal
solution.
Step 7: Check Optimality
As explained in Step 4, the optimal solution of a maximization linear programming model
are the values assigned to the variables in the objective function to give the largest zeta
value. Optimality will need to be checked after each new tableau to see if a new pivot
variable needs to be identified. A solution is considered optimal if all values in the bottom
row are greater than or equal to zero. If all values are greater than or equal to zero, the
solution is considered optimal and Steps 8 through 11 can be ignored. If negative values
exist, the solution is still not optimal and a new pivot point will need to be determined
which is demonstrated in Step 8.
With the new pivot variable identified, the new tableau can be created in Step 9.
Step 9: Create New Tableau
After the new pivot variable has been identified, a new tableau will need to be created.
Introduced in Step 6, the tableau is used to optimize the pivot variable while keeping the
rest of the tableau equivalent.
I. Make the pivot variable 1 by multiplying the row containing the pivot variable by
1
the reciprocal of the pivot value. In the tableau below, the pivot value was 5, so
everything is multiplied by 5.
II. Next, make the other values in the column of the pivot variable zero. This is done by
taking the negative of the old value in the pivot column and multiplying it by the
new value in the pivot row. That value is then added to the old value that is being
replaced.
For the variable x1, the 1 is found in the second row. This shows that the optimal x1 value is
found in the second row of the beta values, which is 8.
Variable s1 has a 1 value in the first row, showing the optimal value to be 2 from the beta
column. Due to s1 being a slack variable, it is not actually included in the optimal solution
since the variable is not contained in the objective function.
The zeta variable has a 1 in the last row. This shows that the maximum objective value will
be 64 from the beta column.
The final solution shows each of the variables having values of:
x1 = 8 s1 = 2
x2 = 0 s2 = 0
x3 = 0 z = 64
The maximum optimal value is 64 and found at (8, 0, 0) of the objective function.
Conclusion
The Simplex method is an approach for determining the optimal value of a linear program
by hand. The method produces an optimal solution to satisfy the given constraints and
produce a maximum zeta value. To use the Simplex method, a given linear programming
model needs to be in standard form, where slack variables can then be introduced. Using
the tableau and pivot variables, an optimal solution can be reached. From the example
worked throughout this document, it can be determined that the optimal objective value is
64 and can be found when x1=8, x2=0, and x3=0.
Glossary
Basic variables are variables that are non-negative in terms of the optimal solution.
Constraints are a series of equalities and inequalities that are a set of criteria necessary to
satisfy when finding the optimal solution.
Inequality is an expression that does not have one definite solution and is distinguishable
by its ‘greater than’ or ‘less than’ symbols in the place of a traditional equal sign.
Linear program is a model used to achieve the best outcome given a maximum or
minimum equation with linear constraints.
Non-basic variables are variables that are zero in terms of the optimal solution.
Optimal solution of a maximization linear programming model are the values assigned to
the variables in the objective function to give the largest zeta value. The optimal solution
would exist on the corner points of the graph of the entire model.
Pivot variable is used in row operations to identify which variable will become the unit
value and is a key factor in the conversion of the unit value.
Simplex tableau is used to perform row operations on the linear programming model as
well as for checking optimality.
Slack variables are additional variables that are introduced into the linear constraints of a
linear program to transform them from inequality constraints to equality constraints.
Standard form is the baseline format for all linear programs before solving for the
optimal solution.
Unit 4: Queuing Theory
Queuing theory is a mathematical study of waiting lines or queues. It helps analyze and
predict the behavior of systems where customers (people, jobs, or requests) arrive, wait for
service, and leave after being served. Queuing theory is commonly used in areas such as
telecommunications, traffic engineering, manufacturing, and service industries (like banks,
hospitals, or airports).
The goal of queuing theory is to optimize the system, such as reducing waiting time for
customers or ensuring service efficiency. It uses mathematical models to predict
performance metrics like the average time spent waiting in line, the average length of the
queue, or how often the system is busy.
Example:
Imagine a bank with one teller. Customers arrive randomly and either wait if the teller is
busy or get served immediately if no one is in line. Queuing theory helps in predicting:
- How long a customer might have to wait.
- How many customers will be in the queue on average.
- How much time the teller will be busy.
- Arrival Process: Describes how customers arrive. This could be at regular intervals or
randomly. A random arrival process is usually modeled using the Poisson distribution,
where the average number of arrivals per time period is denoted by λ (arrival rate).
- Service Process: Describes how customers are served. The time to serve a customer may
vary, often modeled using the exponential distribution, and the average number of
customers served per unit time is denoted by μ (service rate).
- Queue Discipline: Defines the order in which customers are served. The most common
discipline is First-In-First-Out (FIFO), where the first person to arrive is the first to be
served. Other disciplines include Last-In-First-Out (LIFO) and priority-based serving.
- System Capacity: Refers to the maximum number of customers the system can hold,
including both waiting and being served. Some systems have limited capacity (e.g., parking
lots), while others have infinite capacity (e.g., online services).
- Number of Servers (Channels): Represents how many servers are available to serve
customers. It could be one or multiple servers.
Example:
In a fast food restaurant:
- Arrival Process: Customers arrive randomly, perhaps 10 customers per hour (λ = 10).
- Service Process: The service time depends on how fast the worker is, but on average they
can serve 12 customers per hour (μ = 12).
- Queue Discipline: Customers are served in the order they arrive (FIFO).
- System Capacity: The restaurant can serve any number of customers (infinite capacity).
- Number of Servers: 1 worker behind the counter.
3. Kendall's Notation
Kendall’s Notation is used to describe queuing systems using a shorthand notation A/B/c,
where:
Common notations:
- M/M/1: Single server system, with Poisson arrivals and exponential service times.
- M/M/c: Multiple server system, with Poisson arrivals and exponential service times.
- λ (Lambda): Average arrival rate (number of customers arriving per unit time).
- μ (Mu): Average service rate (number of customers served per unit time).
- ρ (Rho): Utilization factor or traffic intensity, calculated as ρ = λ / μ. It indicates the
proportion of time the server is busy.
Unit 5: Inventory Control
Inventory control refers to the management of inventory to ensure that the right amount of
stock is maintained to meet customer demands while minimizing costs. Let’s break down
the key concepts with examples.
---
1. Inventory Classification
Inventory can be classified into various categories based on its usage in production, sales,
or maintenance.
- Work-In-Progress (WIP): Partially finished goods that are still in the production process.
- Example: An assembled chair that hasn’t been painted yet.
- Finished Goods: Products that are completed and ready for sale.
- Example: A packaged chair ready for delivery.
- Maintenance, Repair, and Operations (MRO): Items used in production but not part of the
final product.
- Example: Lubricants used in machines, tools for maintenance.
---
- Holding Costs: Costs of storing and maintaining inventory over time. This includes
warehousing, insurance, and obsolescence.
- Example: If it costs $2 per unit per year to store a chair, this is the holding cost.
- Shortage Costs: Costs incurred when the inventory level is too low to meet demand,
leading to lost sales or delayed production.
- Example: If running out of stock causes a lost sale worth $200, that is the shortage cost.
- Setup Costs: Costs incurred to set up equipment or processes for production, often
associated with producing different items.
- Example: If setting up a machine to produce a new batch of chairs costs $100, that is the
setup cost.
---
EOQ is the optimal order quantity that minimizes the total costs associated with ordering
and holding inventory. It balances ordering costs with holding costs.
Where:
- D: Annual demand for the product.
- S: Ordering cost per order.
- H: Holding cost per unit per year.
---
These models assume that demand is known and constant over time. The primary goal is to
determine the optimal order quantity and timing.
- EOQ Model: This model calculates the optimal order quantity (as seen in the EOQ section)
and assumes steady demand.
Example: A store sells 2,000 units of a product each month. To avoid stockouts, they
reorder when their stock falls to 500 units (this is the reorder point).
- EOQ with Reorder Point: This model introduces a reorder level to ensure that new stock
arrives just in time before the inventory runs out.
---
5. ABC Analysis
ABC Analysis is a method of categorizing inventory items based on their importance,
typically in terms of value or usage rate.
- A-items: High-value items but low in quantity. They require tight control and frequent
monitoring.
- Example: Expensive machinery parts that make up 70% of the inventory value but only
10% of the quantity.
- C-items: Low-value items but high in quantity. These require simpler controls and less
frequent monitoring.
- Example: Nuts and bolts, which represent 10% of the inventory value but 70% of the
quantity.
Example in Practice: A company may keep a close eye on A-items with regular stock checks,
while C-items may only be reviewed periodically.
---
---
1. Introduction
Assets such as machinery, vehicles, or equipment wear out over time or become obsolete
due to technological advancements. Replacement theory provides guidelines for deciding
when to replace an asset based on factors like maintenance costs, efficiency, and
technological progress.
---
Example:
- Year 1: A machine costs $10,000 and has an annual maintenance cost of $1,000.
- Year 2: Maintenance increases to $2,000.
- Year 3: Maintenance increases to $3,000.
- New Machine Cost: A new machine costs $12,000 with a maintenance cost of $500 per
year.
Decision Process:
- In Year 3, the maintenance cost of the old machine is $3,000. The total cost of operating
the old machine (including its initial purchase price) is now higher than the cost of buying
and maintaining the new machine.
- Therefore, replacing the old machine with the new one in Year 3 is a better financial
decision.
---
When newer, more advanced equipment becomes available, the decision must be made
whether to continue using the existing equipment or replace it with the newer option.
Example:
A factory uses a conveyor belt system that has been in use for 10 years. A new, faster
conveyor system is introduced to the market. The factory must evaluate whether the
increased productivity from the new system justifies the replacement cost.
Calculation:
- Current System: Processes 100 units per hour at an operating cost of $50/hour.
- New System: Processes 150 units per hour at an operating cost of $60/hour.
- Cost of New System: $20,000.
If the increase in productivity and reduction in operating costs outweighs the purchase cost
over a specific period, replacing the old system is justified.
---
- Group Replacement Policy: Replace a group of assets simultaneously, even if they haven’t
all failed.
- Example: Replace all light bulbs in a building every 2 years, regardless of whether they
are still functioning.
Comparison Example:
- Individual Replacement: If light bulbs in an office are replaced individually as they fail, the
replacement cost is spread over time.
- Group Replacement: If all bulbs are replaced at once, the cost is incurred at one time, but
the process is more efficient and less disruptive.
Here's a detailed and easy-to-understand explanation of Game Theory for Unit 7, complete
with numerical examples to help your students grasp the concepts.
Unit 7: Game Theory
Example: Consider two companies, A and B, competing in the same market. Each company
must decide whether to launch an aggressive marketing campaign. The success of each
company's decision depends on what the other company decides to do.
Example: In a chess game, the two players are the opponents playing the game.
Example: In chess, strategies could be opening moves, like the King's Pawn Opening or
Queen's Gambit.
- Payoffs: The outcomes of the strategies chosen by the players. The payoff is what each
player gains or loses as a result of the game.
Example: In a pricing game between two companies, the payoff could be the profit each
company earns.
A Two-Person, Zero-Sum Game is a game where there are two players, and the total payoff
is constant, meaning one player's gain is exactly equal to the other player's loss.
Example:
- Game Setup: Two companies, A and B, are competing in a market. Each can choose to
either reduce prices or keep prices the same.
In this matrix:
- If both reduce prices, neither gains nor loses market share (payoff = 0, 0).
- If Company A reduces prices and Company B keeps prices the same, Company A gains
market share (+10) while Company B loses (-10), and vice versa.
- If both keep prices the same, the market share remains unchanged (payoff = 0, 0).
4. Pure Strategy
A Pure Strategy is when a player consistently chooses the same action every time the game
is played.
Numerical Example:
- Suppose Player 1 always chooses "rock" and Player 2 always chooses "scissors." Player 1
will always win, as rock beats scissors. The outcome is predictable, and this is a pure
strategy for Player 1.
5. Dominance Theory
Example:
- Game Setup: Two companies, A and B, can either advertise or not advertise.
A Mixed Strategy is when a player randomizes over two or more strategies to avoid being
predictable. This is used when no pure strategy dominates.
Example:
- Game Setup: Two players are playing rock-paper-scissors.
In this game, no pure strategy dominates, so players might choose each option (scissors,
rock, paper) with equal probability (1/3 each). This randomization forms a mixed strategy.
Graphical Method
This method is useful for solving games where one player has two strategies and the other
has multiple strategies.
Example:
- Player A has two strategies, and Player B has three.
- The payoffs can be plotted on a graph, with B’s strategies on the x-axis and A’s payoffs on
the y-axis.