# Andy Sandbox

This example ended up being too much. Might include as example later.

Vanessa is scheduling her employees for the upcoming week. When on the assembly line, Darren assembles 5 units per hour and Lori assembles 4 units per hour. When on the packaging line, Darren packages 10 units per hour, and Lori packages 8 units per hour. Darren's pay is $12 per hour and Lori's pay is $9 per hour

Vanessa needs to have at least 350 units assembled and packaged by the end of the week. She can assign each worker a maximum of 40 hours. How should Vanessa schedule her employees to minimize payroll?

Let \(a_d\) and \(a_l\) be the number of hours that Darren and Lori work on the assembly line, respectively. Let \(p_d\) and \(p_l\) be the number of hours that Darren and Lori work on the packaging line, respectively. Each worker can work a maximum of 40 hours. This gives the constraints:

\[\begin{align} a_d+p_d &\le 40 \\ a_l +p_l &\le 40 \end{align}\]

Vanessa would not want to waste hours on packaging if there are no assembled units to package. Therefore, the number of units assembled should equal the number of units packaged. This can be expressed with equation:

\[5a_d+4a_l=10p_d+8p_l\]

In order to reduce the number of variables in the system of constraints, solve for \(p_l:\)

\[p_l=\frac{5}{8}a_d+\frac{1}{2}a_l-\frac{5}{4}p_d\]

Note that this expression should be greater than or equal to 0:

\[\frac{5}{8}a_d+\frac{1}{2}a_l-\frac{5}{4}p_d \ge 0\]

There should be at least 350 units assembled and packaged. This gives the constraint:

\[5a_d+4a_l \ge 350\]

Combining these constraints gives the system:

\[\begin{cases} \begin{array}{ccccccc} a_d & & & + & p_d & \le & 40 \\ 5a_d & + & 12a_l & - & 10p_d & \le & 320 \\ 5a_d & + & 4a_l & - & 10p_d & \ge & 0 \\ 5a_d & + & 4a_l & & & \ge & 350 \\ a_d, & & a_l, & & p_d & \ge 0 \end{array} \end{cases}\]

The objective function is given by:

\[\begin{align} f(a_d, a_l, p_d, p_l) &= 12a_d+9a_l+12p_d+9p_l \\ f(a_d, a_l, p_d) &= 12a_d+9a_l+12p_d+9\left(\frac{5}{8}a_d+\frac{1}{2}a_l-\frac{5}{4}p_d\right) \\ f(a_d, a_l, p_d) &=\frac{141}{8}a_d+\frac{27}{2}a_l+\frac{3}{4}p_d \end{align}\]

Converting the system of constraints and objective function to a system of equations:

\[\begin{cases} \begin{array}{ccccccccccccccccc} -z & + & \frac{141}{8}a_d & + & \frac{27}{2}a_l & + & \frac{3}{4}p_d & & & & & & & & & = & 0 \\ & & a_d & & & + & p_d & + & s_1 & & & & & & & = & 40 \\ & & 5a_d & + & 12a_l & - & 10p_d & & & + & s_2 & & & & & = & 320 \\ & & 5a_d & + & 4a_l & - & 10p_d & & & & & - & s_3 & & & = & 0 \\ & & 5a_d & + & 4a_l & & & & & & & & & - & s_4 & = & 350 \\ \end{array} \end{cases} \quad \begin{array}{c} (0) \\ (1) \\ (2) \\ (3) \\ (4) \end{array}\]

Converting to an augmented matrix:

\[\left[\begin{array}{cccccccc|c} -8 & 141 & 108 & 6 & 0 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 1 & 1 & 0 & 0 & 0 & 40 \\ 0 & 5 & 12 & -10 & 0 & 1 & 0 & 0 & 320 \\ 0 & 5 & 4 & -10 & 0 & 0 & -1 & 0 & 0 \\ 0 & 5 & 4 & 0 & 0 & 0 & 0 & -1 & 350 \\ \end{array}\right]\]

Another bad version of the problem:

Vanessa is scheduling her employees for the upcoming week. When on the assembly line, Darren assembles 5 units per hour, and when on the packaging line, he packages 10 units per hour. Lori only works on the assembly line, and she assembles 4 units per hour. Darren's pay is $12 per hour and Lori's pay is $9 per hour

Vanessa needs to have at least 300 units assembled and packaged by the end of the week. She can assign each worker a maximum of 40 hours. How should Vanessa schedule her employees to minimize payroll?

Let \(a_d\) and \(a_l\) be the number of hours that Darren and Lori work on the assembly line, respectively. Let \(p_d\) be the number of hours that Darren and Lori work on the packaging line, respectively. Each worker can work a maximum of 40 hours. This gives the constraints:

\[\begin{align} a_d+p_d &\le 40 \\ a_l &\le 40 \end{align}\]

Vanessa would not want to waste hours on packaging if there are no assembled units to package. Therefore, the number of units assembled should equal the number of units packaged. This can be expressed with the equation:

\[5a_d+4a_l=10p_d\]

The number of units assembled and packaged should be at least 300. This can be expressed with the constraint:

\[\begin{align} 10p_d &\ge 300 \\ p_d &\ge 30 \end{align}\]

This gives the system of constraints:

\[\begin{cases} \begin{array}{ccccccc} a_d & & & + & p_d & \le & 40 \\ & & a_l & & & \le & 40 \\ 5a_d & + & 4a_l & - & 10p_d & = & 0 \\ & & & & p_d & \ge & 30 \\ a_d, & & a_l & & & \ge & 0 \end{array} \end{cases}\]

The objective function is:

\[f(a_d,a_l,p_d)=12a_d+9a_l+12p_d\]

Converting the system of constraints and objective function to a system of equations:

\[\begin{cases} \begin{array}{ccccccccccccccc} -z & + & 12a_d & + & 9a_l & + & 12p_d & & & & & & & = & 0 \\ & & a_d & & & + & p_d & + & s_1 & & & & & = & 40 \\ & & & & a_l & & & & & + & s_2 & & & = & 40 \\ & & 5a_d & + & 4a_l & - & 10p_d & & & & & & & = & 0 \\ & & & & & & p_d & & & & & - & s_3 & = & 30 \\ \end{array} \end{cases} \quad \begin{array}{c} (0) \\ (1) \\ (2) \\ (3) \\ (4) \end{array}\]

\[\left[\begin{array}{ccccccc|c} -1 & 12 & 9 & 12 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 1 & 1 & 0 & 0 & 40 \\ 0 & 0 & 1 & 0 & 0 & 1 & 0 & 40 \\ 0 & 5 & 4 & -10 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 & -1 & 30 \\ \end{array}\right] \quad \begin{array}{c} (0) \\ (1) \\ (2) \\ (3) \\ (4) \end{array}\]

The basic solution is currently infeasible:

\[a_d=0 \quad a_l=0 \quad p_d=0 \quad s_1 = 40 \quad s_2=40 \quad s_3=-30\]

Since the \(s_3\) has a non-valid value, it makes sense to make it the

leavingvariable for the first pivot. \(p_d\) will be theenteringvariable.\[\left[\begin{array}{ccccccc|c} -1 & 12 & 9 & 0 & 0 & 0 & 12 & -360 \\ 0 & 1 & 0 & 0 & 1 & 0 & 1 & 10 \\ 0 & 0 & 1 & 0 & 0 & 1 & 0 & 40 \\ 0 & 5 & 4 & 0 & 0 & 0 & -10 & 300 \\ 0 & 0 & 0 & 1 & 0 & 0 & -1 & 30 \\ \end{array}\right] \quad \begin{array}{c} (0) \\ (1) \\ (2) \\ (3) \\ (4) \end{array}\]