\documentclass[12pt,a4paper]{article}

\usepackage{fullpage,amsmath,amsfonts,graphicx,colortbl,eurosym}
\usepackage{tikz,calc}
\usetikzlibrary{arrows,positioning,automata}

\newcommand{\x}{\boldsymbol{x}}
\newcommand{\y}{\boldsymbol{y}}
\newcommand{\q}{\boldsymbol{q}}
\newcommand{\p}{\boldsymbol{p}}
\renewcommand{\b}{\boldsymbol{b}}
\renewcommand{\c}{\boldsymbol{c}}
\newcommand{\R}{\mathbb{R}}

\begin{document}

\title{Operations Research}
\author{Final Exam}
\date{December 17, 2016}
\maketitle

% \vspace*{\fill}
% {\baselineskip=40pt
% \begin{tabbing}\
% Student ID Number: \= \kill
% Last Name: \> \rule[-2pt]{10cm}{0.3pt} \\
% First Name:  \> \rule[-2pt]{10cm}{0.3pt} \\
% Signature: \> \rule[-2pt]{10cm}{0.3pt} \\
% %Code: \> \fbox{\rule{0pt}{1.5em}\rule{1.5ex}{0pt}}
% %\fbox{\rule{0pt}{1.5em}\rule{1.5ex}{0pt}}
% %\fbox{\rule{0pt}{1.5em}\rule{1.5ex}{0pt}}
% %\fbox{\rule{0pt}{1.5em}\rule{1.5ex}{0pt}}
% \end{tabbing}}
% \vspace*{\fill}

% \newpage
\begin{enumerate}

\item Minimize
\[
  z = x^2 - 2 \, x + y^4 - 2 \, y^2 + 2
\]
subject to
\begin{gather*}
  2 \, x \leq 4 \,, \\
  x + 2 \, y \leq 6 \,, \\
  x, y \geq 0 \,.
\end{gather*}
(Be aware that for nonlinear programs, the location of the minimum may
be anywhere on an edge or in the interior the feasible region!)
\hfill(20)

\item Consider the following network where the number on each arc
represents the actual distance.

\begin{center}
\newdimen\nodeDistance
\nodeDistance = 2cm
\tikzset{
    position/.style args={#1:#2 from #3}{
        at=(#3.#1), anchor=#1+180, shift=(#1:#2)
    }
}
\begin{tikzpicture}[shorten >=1pt,node distance=\nodeDistance,on grid]
  \node[state] (O)                    {START};
  \node[state] (A) [position=30:{1.15\nodeDistance} from O]  {$A$};
  \node[state] (B) [position=0:{0.9\nodeDistance} from O] {$B$};
  \node[state] (C) [position=-30:{1.15\nodeDistance} from O]  {$C$};
  \node[state] (D) [position=-15:{\nodeDistance} from A] {$D$};
  \node[state] (E) [position=15:{\nodeDistance} from C]  {$E$};
  \node[state] (T)[position=-15:{\nodeDistance} from D] {FINISH};
\tikzset{mystyle/.style={->}} 
\path (O) edge [mystyle] node [above] {9} (A) 
      (O) edge [mystyle] node [above] {6} (B)
      (O) edge [mystyle] node [above] {7} (C)
      (A) edge [mystyle] node [above] {5} (D)
      (B) edge [mystyle] node [above] {7} (D)
      (B) edge [mystyle] node [above] {8} (E)
      (C) edge [mystyle] node [above] {6} (E)
      (D) edge [mystyle] node [above] {6} (T)
      (E) edge [mystyle] node [above] {7} (T);
\end{tikzpicture}
\end{center}

\begin{enumerate}
\item Solve the shortest path problem for this network.  Use dynamic
programming and show the details of your work.

\item Formulate the shortest path problem as an equivalent linear
programming problem.  (You can use the concrete network above or,
alternatively, consider an abstract shortest path problem.)

\item Which solver should be used when solving shortest path problems
in their LP formulation?  Explain!

\end{enumerate}
\hfill(10+5+5)

\item \emph{Gadgets \& More Inc.}\ produces bells and whistles.  Their
products are so popular that the more they sell, the more customers
are willing to pay.  Tom and Clara both work in production planning
and each, independently, derived a function for the profit from each
product given the number of units produced.
\begin{center}
\includegraphics[width=\textwidth]{BellsAndWhistels.pdf}
\end{center}
As the factory has limited production capacity, they need to solve an
optimization problem for the total profit as a function of the number
of bells $x$ and whistles $y$ produced.

Tom's and Clara's Pyomo implementations are attached.

\begin{enumerate}
\item State Tom's model  in mathematical notation.  Make
sure you list all constraints.

\item State Clara's model in mathematical notation.  Again, make sure
you list all constraints.

\item Clara's model is a linear (integer) programming problem.  Can
you provide an equivalent nonlinear programming formulation that looks
more like Tom's?

\item Compare the two solutions.  How are they different?  Do you
think the difference is caused by the use of slightly different profit
functions?  Explain!

\item Can you indicate a fix for the approach which gives the inferior
solution?

\item State their advantages and disadvantages of the two approaches
and express a preference.  Explain your choice.

\end{enumerate}
\hfill(5+5+5+5+5+5)

\item The Hit-and-Miss Manufacturing Company produces integrated
electronic circuits in batches of $2$.  It is known that there are
``good'' batches, where each circuit has an independent $10\%$ chance
of being defective and there are ``bad'' batches where each circuit
has an independent $80\%$ chance of being defective.  Good batches are
produced $\tfrac23$ of the time, bad batches are produced $\tfrac13$
of the time.

\begin{enumerate}
\item What is the probability that a randomly selected circuit is
defective?

\item Given that one circuit is tested and found functional, what is
the probability that the other circuit \emph{from the same batch} is
also functional?

\item Testing is expensive at \euro{25} per circuit.  The test is
$100\%$ reliable.  If a defective unit is passed on to the next stage
in the manufacturing process, a loss of \euro{100} is incurred.  It is
possible to forgo testing completely, to test only one unit from each
batch, or, possibly depending on the outcome of the first test, also
test the other unit from each batch.  Determine the most economical
testing schedule.  As part of your answer, draw a complete decision
tree for this problem.

\end{enumerate}
\hfill(5+5+10)


\item A factory produces items continuously at a rate of $100$ units
per day.  From time to time, a truck takes finished units to a major
distributor at a cost of \euro{500} independent of the number of items
shipped.  Finished units incur a holding cost of \euro{0.10} per unit
per day until they are shipped.  Derive a formula for the most
economical shipping batch size $Q$.  \hfill(10)


\end{enumerate}


\end{document}