Helsingin yliopisto Tietojenkäsittelytieteen laitos

Tietojenkäsittelytieteen laitos

Tietoa laitoksesta:



To get credits from the course, you must complete the project assignment.

In July 2008, Helsingin Sanomat published an article, in where a photographer was flying through every Finnish airfield and airport. A collection of pictures is available on-line.

When encountering such an idea, the most obvious question for a computer scientist is to think whether that particular route was the shortest possible, or would it have been possible to save in gasoline costs by selecting a shorter route.

The assignment is to write a program in Scala (or Erlang, if you really insist =) to support this. The input for your program is a tab-delimited text-file, which contains airfield/airport information, one per line, as follows:
1. Mnemonic of the airfield (e.g. EFHK )
2. Name of the airfield (e.g. Helsinki-Vantaa) - optional.
3. North/South-coordinates of the airfield (60 19 02N) - optional.
4. East/West-coordinates of the airfield (024 57 48E) - optional.

The file can contain lines which do not conform to this definition. Those lines are to be skipped. The fields 2-4 are optional when an airfield with equal mnemonic has already been defined previously in the file.

Examples: example1.txt, example2.txt, example3.txt

The name of the text file is given as the first command line argument to your program. Rest of the command lines define, what should be calculated.
print the length of the route which visits each of the airfields in the file in that order.

print the shortest route for visiting each of the defined airfields, as many times as mentioned in the file. Two sequent visits to an airfield require that another airfield has been visited in-between.

defines the starting point for which the shortest route should start

Note: a brute-force algorithm is definitely adequate for the scope of this assignment. You are free to implement clever tricks, however.

Use ScalaCheck to define the functionality of your program's building blocks.


The assignment should be returned by Sunday 28th of September, via e-mail.
Place all the files in a zip file of name FirstnameLastname-Scala.zip.
All source files should reside in a directory called 'src'.
All testing input files should reside in a directory called 'tests'
A document named 'document.pdf' explaining the structure of the work should be included in the root directory.
The work should compile by writing 'ant' in the root directory.
'ant clean' should clean everything that was produced during compilation.
'ant test' should run the tests.


The grade for the course depends on the scope and quality of the project. An acceptable work (grade 1) can read the input file and calculate the length of the route defined in that file. A good work (grade 3) implements all of the command line parameters. For an excellent work (grade 5), there should be something to brag about. E.g
- being in top 10% performance-wise in route calculation
- being in top 10% in scalability when running on a machine with multiple cpu's
- implementing additional functionality, such as airfield information fetching from the web
- comparision and discussion of object-oriented and functional implementations in the documentation
.. will improve the chances of receiving an excellent grade.

The overall quality of the tests and documentation adjusts the grade +- 2 steps. Please, don't make your code too messy. Otherwise, a very angry Nasse-setä will eat you.

Links to resources:

Definition of great-circle distance in Wikipedia: http://en.wikipedia.org/wiki/Great-circle_distance
The list of airports in Finland: https://ais.fi/ais/eaip/fi/ (In part AD 2)
The list of airfields in Finland: http://www.lentopaikat.net