Using linear programming for solving mechanical engineering problems: The ladder against a wall problem

A person with weight Q stands on a ladder. This ladder is leaning against a vertical wall. What is the maximum position x this person can reach before the ladder starts sliding? This ladder against a wall problem is depicted in the following figure (with on the right-hand side a free body diagram).

linear programming ladder against wall problem

The following R code demonstrates how to use linear programming for solving the ladder against the wall problem.

Note that the ladder against the wall problem (and its analytical solution) is described by Gross and colleagues in their 2013 book Engineering mechanics 1: statics (2nd. Ed.).
For readers interested in linear programming, I would like to refer to the excellent introduction by Doris Lloyd Grosh in her 2010 book Linear programming for beginners.

Suggestions and/or questions? Please contact Stefan Gelissen (email: info at datall-analyse.nl).
See this page for an overview of all of Stefan’s R code blog posts.

 

Frictionless wall

For solving the ladder against a wall problem we need to express 1) the equilibrium conditions, and 2) the conditions of static friction.

If the ladder is leaning against a frictionless wall, we can state the following 3 equilibrium conditions (see figure above, and note that the force Hb is zero since there is no friction between the wall and the top of the ladder):

1) The sum of the forces in the horizontal direction: Nb – Ha = 0
2) The sum of the forces is the vertical direction: Na – Q = 0
3) The sum of the moments about point A: x*Q – h*Nb = 0

The condition of static friction (in case of a rough floor and frictionless wall) is expressed as:

Ha ≤ μfloor*Na
(where μfloor is the static friction coefficient between the floor and the base of the ladder).

It is also possible to formulate the same problem as a maximization problem:

Maximize the objective function: x = (h/Q)*Nb

Subject to the 3 constraints:
1) Nb – Ha = 0
2) Na = Q
3) Ha – μfloor*Na ≤ 0

This maximization problem can be solved using linear programming.

R code

library(lpSolve)

#initialize values
Q <- 70*9.81 #person has a mass of 70kg
h <- 2
mu <- .5 #static friction coefficient between floor and ladder
#angle between ladder and wall
alpha <- 30
#convert degrees to radians (by multiplying with pi/180), and calculate tangent of angle
tanAlpha <- tan(alpha*pi/180)

#specify linear programming problem
#objective function:
#x = (h/Q)*Nb+0*Ha+0*Na
fObj <- c(h/Q,0,0)
names(fObj) <- c("Nb", "Ha", "Na")
#constraints:
#1*Nb-1*Ha+0*Na=0
#0*Nb+0*Ha+1*Na=Q
#0*Nb+1*Ha-mu*Na<=0
fConstr <- matrix(c(1,-1,0,0,0,1,0,1,-mu), nrow=3, byrow=TRUE)
fDir <- c("==", "==", "<=")
fRhs <- c(0,Q,0)
names(fRhs) <- c("c1", "c2", "c3")

#solve linear programming problem using the revised simplex method
solLp <- lp("max", fObj, fConstr, fDir, fRhs)
solLp

#max value (=x) of objective function
solLp$objval
#note: this value is identical to the analytical solution (which is: x<=mu*h)
#also note that the analytical solution of the distance x depends only
#on the static friction coefficient (mu) and the height (h),
#but not on the weight (Q) of the person
#similarly, the linear programming solution for x also depends only on mu and h,
#and not Q (try it yourself!)

#reaction forces (Nb, Ha, Na, respectively) at optimal solution
solLp$solution

#the computed distance x for our problem is 1
#the ladder starts sliding if the person exceeds this distance of 1
#in our case this is a potentially dangerous situation since the
#distance b (see figure) is equal to
h*tanAlpha
#this distance b is larger than the computed distance x
#hence, stability of the ladder is not ensured!

Friction between the ladder and both the floor and wall

If both the floor and wall have rough surfaces, then we can state the following 3 equilibrium conditions (again, see figure above):

1) The sum of the forces in the horizontal direction: Nb – Ha = 0
2) The sum of the forces is the vertical direction: Na + Hb = Q
3) The sum of the moments about point A: x*Q – h*Nb – (h*tan(α))*Hb= 0

The conditions of static friction in case of a rough wall and floor are expressed as:

  1. Hb ≤ μwall*Nb
    where μwall is the static friction coefficient between the wall and the top of the ladder
  2. Ha ≤ μfloor*Na
    where μfloor is the static friction coefficient between the floor and the base of the ladder.

Note that this is a statically indeterminate problem (i.e., 3 equilibrium equations, yet 4 unknown reaction forces). According to Gross et al. is solving this problem not straightforward. However, once we formulate this problem as a maximization problem it is possible to solve it using linear programming:

Maximize the objective function: x = (h/Q)*Nb + ((h*tan(α))/Q)*Hb

Subject to the 4 constraints:
1) Nb – Ha = 0
2) Na + Hb = Q
3) Hb – μwall*Nb ≤ 0
4) Ha – μfloor*Na ≤ 0

R code

library(lpSolve)

#initialize values
Q <- 70*9.81
h <- 2
muFloor <- .5
muWall <- 1.2
alpha <- 30
tanAlpha <- tan(alpha*pi/180)

#objective function:
#x = ((h*tanAlpha)/Q)*Hb+(h/Q)*Nb+0*Ha+0*Na
fObj <- c((h*tanAlpha)/Q,h/Q,0,0)
names(fObj) <- c("Hb", "Nb", "Ha", "Na")
#constraints:
#0*Hb+1*Nb-1*Ha+0*Na=0
#1*Hb+0*Nb+0*Ha+1*Na=Q
#1*Hb-muWall*Nb+0*Ha+0*Na<=0
#0*Hb+0*Nb+1*Ha-muFloor*Na<=0
fConstr <- matrix(c(0,1,-1,0,1,0,0,1,1,-muWall,0,0,0,0,1,-muFloor), nrow=4, byrow=TRUE)
fDir <- c("==", "==", "<=", "<=")
fRhs <- c(0,Q,0,0)
names(fRhs) <- c("c1", "c2", "c3", "c4")

#revised simplex method
solLp <- lp("max", fObj, fConstr, fDir, fRhs)
solLp

#max value (=x) of objective function
#again, the linear programming solution for x depends only on muFloor, muWall, and h,
#but not on Q (try it yourself!)
solLp$objval
#reaction forces (Hb, Nb, Ha, Na, respectively) at optimal solution
solLp$solution

#despite the roughness of the wall, our problem situation is still potentially dangerous
#remember that the distance b (see figure) is equal to
h*tanAlpha
#and this distance b is larger than the computed distance x (=1.06)
#thus, stability of the ladder is still not ensured!

Next blog post?
In my next blog post I will present a solution strategy (including R code) for finding the minimum angle such that a ladder doesn’t slip down.