Lecture 6: Graphical Solution Method

Lecture 6: Graphical Solution Method#

Note

In this lecture, we will further discuss the graphical solution method for linear programming through other two-variable problems.


Example #2#

Consider the two routes, \(\text{R}_1\) and \(\text{R}_2\), connecting Chennai Central Railway Station to Madras International Meenambakkam Airport. Here, \(\text{R}_1\) is a major arterial route with a travel time of 30 minutes and capacity of 1000 vehicles per hour. On the other hand, \(\text{R}_2\) is a collector route with a travel time of 45 minutes and capacity of 750 vehicles per hour. Assuming that Chennai Unified Metropolitan Transport Authority (CUMTA) has approporiate traffic control systems to route traffic through either of these routes, how should CUMTA allocate peak traffic of 1200 vehicles per hour to each route in order to minimise the total vehicle hours traveled (VHT)?

Objective:

\[ \min_{x_1, x_2} \ z = 30x_1 + 45x_2 \]

Subject to:

\[\begin{split} \begin{aligned} x_1 + x_2 & \geq 1200 \\ x_1 & \leq 1000 \\ x_2 & \leq 750 \\ x_1, x_2 & \geq 0 \end{aligned} \end{split}\]

alt text

In this problem, the constraints define a bounded feasible region, making (1000, 200) the unique optimal solution with \(x_1 + x_2 \geq 1200\) and \(x_1 \leq 1000\) forming the binding constraints, while \(x_2 \leq 750\) and \(x_1, x_2 \geq 0\) forming the non-binding constraints. Thus, CUMTA should route 1000 vehicles via \(\text{R}_1\) and remaining 200 via \(\text{R}_2\) between Chennai Central Railway Station to Madras International Meenambakkam Airport, rendering 39k vehicle hours traveled (VHT).


How does the solution change if both routes had a travel time of 40 minutes instead?

Objective:

\[ \min_{x_1, x_2} \ z = 40x_1 + 40x_2 \]

Subject to:

\[\begin{split} \begin{aligned} x_1 + x_2 & \geq 1200 \\ x_1 & \leq 1000 \\ x_2 & \leq 750 \\ x_1, x_2 & \geq 0 \end{aligned} \end{split}\]

alt text

With both routes having same travel time, all solutions on the line \(x_1 + x_2 = 1200\) such that \(x_1 \leq 1000\) and \(x_2 \leq 750\) are optimal.

In such a scenario, how should CUMTA route vehicles between the two routes?

  1. Distribute traffic evenly, i.e., \(x_2 / x_1 = 1\), thus rendering \((600, 600)\) as the optimal solution.

  2. Balance flows based on route capacity such that \(x_2 / x_1 = 0.75\), thus rendering \((685.7, 514.3)\) as the optimal solution.

  3. Maintain traffic to reduce pavement wear & tear based on pavement quality and associated maintenance schedule, for instance, \(x_2 / x_1 = 0.5\), thus rendering \((800, 400)\) as the optimal solution.


How does the solution change if capacity of route \(\text{R}_1\) is instead 300 vehicles?

Objective:

\[ \min_{x_1, x_2} \ z = 30x_1 + 45x_2 \]

Subject to:

\[\begin{split} \begin{aligned} x_1 + x_2 & \geq 1200 \\ x_1 & \leq 300 \\ x_2 & \leq 750 \\ x_1, x_2 & \geq 0 \end{aligned} \end{split}\]

Caution

For representation purpose, we have relaxed the constraint \(x_1, x_2 \in \mathbb{Z}_+\) to \(x_1, x_2 \geq 0\) in the above formulations.

import numpy as np
import ipywidgets as widgets
import matplotlib.pyplot as plt

# Define objective function parameters and constraint coefficients
c1, c2 = 30, 45             # Parameters for the objective function c1 * x1 + c2 * x2
a11, a12, b1 = 1, 1, 1200   # Coefficients for constraint a11 * x1 + a12 * x2 >= b1
a21, a22, b2 = 1, 0, 300    # Coefficients for constraint a21 * x1 + a22 * x2 <= b2
a31, a32, b3 = 0, 1, 750    # Coefficients for constraint a31 * x1 + a32 * x2 <= b3

def slide(b2):
  # Define the range of x1 values
  x1 = np.linspace(0, b1/a11, 400)

  # Calculate x2 values for each constraint
  x2_1 = (b1 - a11 * x1) / a12  # From a11 * x1 + a12 * x2 >= b1
  x2_2 = np.full_like(x1, b2)   # From a21 * x1 + a22 * x2 <= b2
  x2_3 = np.full_like(x1, b3)   # From a31 * x1 + a32 * x2 <= b3

  # Plot the constraints
  plt.plot(x1, x2_1, label=fr'$x_1 + x_2 \geq {b1}$')
  plt.axvline(x=b2, label=fr'$x_1 \leq {b2}$', color='orange')
  plt.axhline(y=b3, label=fr'$x_2 \leq {b3}$', color='red')

  # Fill the feasible region where all constraints are satisfied
  plt.fill_between(x1, x2_1, np.maximum(x2_1, x2_3), where=(x1 <= x2_2), color='grey', alpha=0.3, label="Feasible Region")

  # Set plot attributes
  plt.xlim(0, b1/a11)
  plt.ylim(0, b1/a12)
  plt.xlabel(r'$x_1$ (Vehicles via $R_1$)')
  plt.ylabel(r'$x_2$ (Vehicles via $R_2$)')
  plt.legend()
  plt.grid(True)

  # Display the plot
  plt.show()

widgets.interact(slide, b2=widgets.IntSlider(value=300, min=100, max=1000, step=50, description=r'R1 capacity'))

Thus, for route \(\text{R}_1\) capacity values less than 450, there exists no feasible region and consequenlty, no optimal solution.

Example #3#

A transportation firm in Chennai aims to manage commuter flow between Anna Nagar and Guindy by deploying two types of bus services, \(\text{B}_1\) (standard) and \(\text{B}_2\) (express), with the goal of minimising total costs. Specifically, bus service \(\text{B}_1\) is a standard 2-hour service priced at ₹50 per ticket with a capacity for 50 passengers, while bus service \(\text{B}_2\) is an express 1.5-hour service priced at ₹100 per ticket with a capacity for 30 passengers. Note, the purchase cost of the bus for standard service is ₹25,00,000 while that for the express service is ₹30,00,000. On the other hand, the operational costs amount to ₹1500 for the standard and ₹1000 for the express service. Given a planning horizon of 10 years, 330 working days in a year, and a discount rate of 3%, how many buses should the transportation firm deploy in order to minimise the total cost while ensuring a mimum service level with at least 5 standard service buses and a maximum total commuter-hours of 25. Assume ticket prices and operational costs to grow at the discount rate.

Objective:

\[ \max_{x_1, x_2} \ z = 111.89x_1 + 934.27x_2 \]

Subject to:

\[\begin{split} \begin{aligned} 2x_1 + 1.5x_2 & \leq 25 \\ x_1 & \geq 5 \\ x_2 & \geq 0 \end{aligned} \end{split}\]

alt text

In this problem, the constraints define a bounded feasible region, making (5, 10) the unique optimal solution with \(2x_1 + 1.5x_2 \leq 25\) and \(x_1 \geq 10\) forming the binding constraints, while \(x_2 \geq 0\) forming the non-binding constraints. Thus, the transportation firm should purchase and operate 5 buses with standard service and another 10 buses with express service, rendering average daily profit of about ₹9.9k.


How does the solution change if there was no commuter-hour constraint?

Objective:

\[ \max_{x_1, x_2} \ z = 111.89x_1 + 934.27x_2 \]

Subject to:

\[\begin{split} \begin{aligned} x_1 & \geq 5 \\ x_2 & \geq 0 \end{aligned} \end{split}\]

alt text

Here, we have an unbounded feasible region, with no value in the feasible region being optimal. Generally speaking, this indicates an error in either problem definition, data collection, or problem formulation stage.

Caution

For representation purpose, we have relaxed the constraint \(x_1, x_2 \in \mathbb{Z}_+\) in the above formulations.


Caution

For a general \(n\)-dimensional problem, i.e., for a problem with \(n\) decision variables, we will have an \(n\) dimensional feasible region. And therefore, for an \(n\)-dimensional problem, the graphical solution is not a viable alternative. Hence, in the next lecture we will develop spreadsheet-based solution methods for \(n\)-dimensional linear programming problems.