% -*- latex -*-
% FILE: "/home/evmik/jobs/wm/2011_fall_practical_computing_for_scientists/hw07/hw07.tex"
% LAST MODIFICATION: "Sun, 30 Oct 2011 22:53:57 -0400 (evmik)"
% (C) 2010 by Eugeniy Mikhailov, <evgmik@gmail.com>
% $Id:$
\documentclass[letter,12pt]{article}

%---------------------------------------------------------------
\usepackage{listings}
\usepackage{color}
\usepackage{fullpage}
%---------------------------------------------------------------

\begin{document}
\newcommand{\problem}[1]{%
	{\flushleft  \bf #1\\}
}
\newcommand{\hw}[1]{%
	\begin{center}
		\Large  \bf Homework #1%
	\end{center}%
}
\newcommand{\mat}[1]{% matlab code
{\color{blue}\texttt{#1}}%
}

%---------------------------------------------------------------
\hw{00}

General comments: 
\begin{itemize}
	\item Do not forget to run some test cases. 
	\item All data files provided at the class web page.
\end{itemize}


\problem{Problem 1 (5 points)}
%---------------------------------------------------------------
Modify provided traveler salesman combinatorial algorithm to solve 
a slightly different problem. You are looking for the shortest route which
goes through all cities, while starts and stops in the same city (first
one), i.e. the close loop route. 

Coordinates of cities are provided in the 'cities\_for\_combinatorial\_search.dat' file:
the first column  of
the data file is 'x' coordinate and second one contains 'y' coordinates.
The coordinates of the beginning/end route city are in the first string.  

What is the sequence of the cities in the shortest route?

What is the total length of the best route?

Provide the plot of the cities and the shortest route.



\problem{Problem 2 (10 points)}
%---------------------------------------------------------------
Implement Metropolis algorithm to solve above problem. Good way to obtain
new test route is to randomly swap two cities  along the route.
Tweak the algorithm number of cycles,  initial and final  temperature ($kT$).

Compare this algorithm solution  with the above combinatorial one.

Now load the cities coordinates from the 
'cities\_for\_metropolis\_search.dat' file.  Find the shortest route for
this cities.

What is the sequence of the cities in the shortest route?

What is the total length of the best route?

Provide the plot of cities and the shortest route.

\problem{Problem 3 (10 points)}
%---------------------------------------------------------------
Recall midterm 1. Find (plot) the speed and hight of the rocket as function of
time for $b=1.79$ in the time interval from 0 till time 100 seconds (note
change of the final time) with Euler's method. What is the maximum speed
and height. It is up to you to find adequate time step.

%---------------------------------------------------------------
\end{document}
%---------------------------------------------------------------
