\documentclass[12pt]{article}
\usepackage{fullpage,amsmath,amsfonts,graphicx}

\newcommand{\x}{\boldsymbol{x}}
\newcommand{\y}{\boldsymbol{y}}
\renewcommand{\a}{\boldsymbol{a}}
\renewcommand{\b}{\boldsymbol{b}}
\renewcommand{\c}{\boldsymbol{c}}

\begin{document}

\title{Operations Research}
\author{Homework 5}
\date{Due via Moodle (Pyomo) by Saturday, October 17, 2020}
\maketitle


\begin{enumerate}

\item \emph{(This is a variation of Exercise 8.1-2 from HL.)} The
Childfair Company has three plants producing child push chairs that
are to be shipped to four distribution centers.  Plants 1, 2, and 3
produce 12, 17, and 11 shipments per month, respectively.  Each
distribution center needs to receive 10 shipments per month.  The
distance from each plant to the respective distribution centers is
given below:

\begin{center}
\begin{tabular}{lcccc}
\hline
& \multicolumn{4}{c}{\textbf{Distribution Center}$\vphantom{1^{1^1}}$} \\
& \textbf{1}$\vphantom{1^{1^1}}$ & \textbf{2} &
  \textbf{3} & \textbf{4} \\
\hline
\textbf{Plant 1}$^{\vphantom{\tfrac11}}$ & 800 miles & 1\,300 miles&
  400 miles & 700 miles \\
\textbf{Plant 2} & 1\,100 miles & 1\,400 miles & 600 miles & 1\,000
                                                            miles \\
\textbf{Plant 3} & 600 miles & 1\,200 miles & 800 miles & 900 miles \\
\hline
\end{tabular}
\end{center}
The freight cost for each shipment is \$100 plus 50 cents per mile.
The objective is minimizing the total cost of transportation.

\begin{enumerate}
\item Formulate and solve the problem in Pyomo.

\item Now suppose that demand in the area served by Center~1 goes up
to 15 shipments per month.  Production cannot be increased on short
notice, so some or all of the distribution centers will be
under-supplied.  Modify your Pyomo code to determine the total number
of shipments to arrive at each of the centers if the objective is
still to minimize the overall cost of transportation.
\end{enumerate}
Submit a commented printout (PDF) of your Ipython notebook showing
code and output for each.

\item \emph{(HL, Exercise 8.1-4.)} The Versatech Corporation has
decided to produce three new products. Five branch plants now have
excess product capacity. The unit manufacturing cost of the first
product would be \$31, \$29, \$32, \$28, and \$29 in Plants 1, 2, 3,
4, and 5, respectively. The unit manufacturing cost of the second
product would be \$45, \$41, \$46, \$42, and \$43 in Plants 1, 2, 3,
4, and 5, respectively. The unit manufacturing cost of the third
product would be \$38, \$35, and \$40 in Plants 1, 2, and 3,
respectively, whereas Plants 4 and 5 do not have the capability for
producing this product. Sales forecasts indicate that 600, 1\,000, and
800 units of products 1, 2, and 3, respectively, should be produced
per day. Plants 1, 2, 3, 4, and 5 have the capacity to produce 400,
600, 400, 600, and 1\,000 units daily, respectively, regardless of
the product or combination of products involved. Assume that any
plant having the capability and capacity to produce them can produce
any combination of the products in any quantity.  Management wishes to
know how to allocate the new products to the plants to minimize
total manufacturing cost.  
\begin{enumerate}
\item Formulate this problem as a
transportation problem.
\item Use Pyomo to obtain an optimal solution.
\end{enumerate}
Part (a) should be submitted handwritten on paper or typed into the
Ipython notebook using mathematical markup; for part (b) submit a
printout (PDF) of your Ipython notebook showing code and output.



\item \emph{(From HL, Problem~8.3-2.)} Four cargo ships will be used
for shipping goods from one port to four other ports (labeled 1, 2, 3,
4).  Any ship can be used for making any one of these four trips.
However, because of differences in the ships and cargoes, the total
cost of loading, transporting, and unloading the goods for the
different ship-port combinations varies considerably, as shown in the
following table:

\begin{center}
\begin{tabular}{lcccc}
\hline
& \multicolumn{4}{c}{\textbf{Port}$\vphantom{1^{1^1}}$} \\
& \textbf{1}$\vphantom{1^{1^1}}$ & \textbf{2} &
  \textbf{3} & \textbf{4} \\
\hline
\textbf{Ship 1}$^{\vphantom{\tfrac11}}$ & \$500 & \$400 & \$600 & \$700 \\
\textbf{Ship 2} & \$600 & \$600 & \$700 & \$500 \\
\textbf{Ship 3} & \$700 & \$500 & \$700 & \$600 \\
\textbf{Ship 4} & \$500 & \$400 & \$600 & \$600 \\
\hline
\end{tabular}
\end{center}
The objective is to assign the four ships to four different ports in
such a way as to minimize the total cost for all four shipments.

\begin{enumerate}
\item Let $x_{ij}=1$ if ship $i$ is sent to port $j$ with $x_{ij}=0$
otherwise.  (A problem of this form is called an assignment problem.)
Formulate and solve this problem in Pyomo.  You should submit a
printout of your Ipython notebook showing code and solution.

\emph{Hint:} In Pyomo, you can declare a variable to take only values
$0$ and $1$ by using the option \verb+within=Boolean+.

\item Now suppose you drop the requirement that the $x_{ij}$ are
Boolean and replace it with the usual non-negativity requirement.  In
other words, you are allowing to send ``a fraction of a ship'' to one
port and another fraction to another.  Re-solve the problem in Pyomo.
What do you see?

% \item \emph{Extra credit:} Can you come up with a more general
% mathematical statement and a proof of what you have seen?

\end{enumerate}
\end{enumerate}

\end{document}
