Removing files from data analysis directory
[ou-summer-of-code-2017.git] / 01-ticket-prices / ticket-pricing-question.ipynb
1 {
2 "cells": [
3 {
4 "cell_type": "markdown",
5 "metadata": {},
6 "source": [
7 "# Ticket pricing\n",
8 "\n",
9 "You've been shopping around for a holiday package deal and its time to make your choice of which deal to go with. The file [01-holidays.txt](01-holidays.txt) contains a summary of your investigations. \n",
10 "\n",
11 "It's a simple text file, with one possible holiday package per line.\n",
12 "\n",
13 "Each line has four fields, separated by spaces. They are:\n",
14 "* The deal ID, from the price comparison website you found it.\n",
15 "* The holiday price, in whole pounds.\n",
16 "* The location of the holiday, always a single word.\n",
17 "* The number of nights you'd be staying. \n",
18 "\n",
19 "For example, the data file might look like this:\n",
20 "\n",
21 "```\n",
22 "db61bb90 769 Morgantown 3\n",
23 "202c898b5f 1284 Morgantown 21\n",
24 "def36ffcd 1514 Giessenmestia 21\n",
25 "389018bd0707 1052 Estacada 21\n",
26 "a487c4270 782 Geoje-Si 14\n",
27 "6caf2584a55 724 Stonington-Island 14\n",
28 "199608abc5 1209 Nordkapp 21\n",
29 "```"
30 ]
31 },
32 {
33 "cell_type": "markdown",
34 "metadata": {},
35 "source": [
36 "## Part 1\n",
37 "You have a budget of £1200. How many of the holidays can you afford?\n",
38 "\n",
39 "Given the example data above, you could afford four of the holidays: the trips to Estacada, Geoje-Si and Stonnington-Island, and the three-day trip to Morgantown. \n",
40 "\n",
41 "The 21 day trip to Morgantown and the trips to Giessenmestia and Nordkapp are all too expensive."
42 ]
43 },
44 {
45 "cell_type": "markdown",
46 "metadata": {},
47 "source": [
48 "# Part 2\n",
49 "You don't just want _a_ holiday. You want the _best_ holiday. What is the code of the holiday which would give you the best value?\n",
50 "\n",
51 "The \"value\" of a holiday is the duration per pound. Because some destinations are better than others, you'll want to scale the value for some locations. For instance, a night in Timbuktu is worth three times as much as a holiday in Bletchley.\n",
52 "\n",
53 "Assume all holidays have a relative value of 1, apart from these destinations.\n",
54 "\n",
55 "| Destination | Score |\n",
56 "|-------------|-------|\n",
57 "| Almaty | 2.0 |\n",
58 "| Brorfelde | 0.9 |\n",
59 "| Estacada | 0.4 |\n",
60 "| Jayuya | 0.6 |\n",
61 "| Karlukovo | 2.2 |\n",
62 "| Morgantown | 2.9 |\n",
63 "| Nordkapp | 1.5 |\n",
64 "| Nullarbor | 2.2 |\n",
65 "| Puente-Laguna-Garzonkuala-Penyu | 0.4 |\n",
66 "| Uzupis | 0.9 |\n",
67 "\n",
68 "## Example\n",
69 "\n",
70 "Given the holiday list above, the holiday to Geoje-Si (with the standard weighting of 1) has a value of $\\frac{14}{782} = 0.0179$ nights per pound. \n",
71 "\n",
72 "The trip to Estacada looks promising, at $\\frac{21}{1052} = 0.0200$ nights per pound. Unfortunately, the weighting for Estacada is low, to the adjusted cost is $0.4 \\times \\frac{21}{1052} = 0.00798$ nights per pound.\n",
73 "\n",
74 "The best value holiday is the 21 day trip to Morgantown, with a value of $2.9 \\times \\frac{21}{1284} = 0.0474$ nights per pound. Unfortunately, it's unaffordable. \n",
75 "\n",
76 "The best value affordable holiday is the trip to Stonnington Island, with $\\frac{14}{1284} = 0.0193$ nights per pound."
77 ]
78 },
79 {
80 "cell_type": "code",
81 "execution_count": null,
82 "metadata": {
83 "collapsed": true
84 },
85 "outputs": [],
86 "source": []
87 }
88 ],
89 "metadata": {
90 "kernelspec": {
91 "display_name": "Python 3",
92 "language": "python",
93 "name": "python3"
94 },
95 "language_info": {
96 "codemirror_mode": {
97 "name": "ipython",
98 "version": 3
99 },
100 "file_extension": ".py",
101 "mimetype": "text/x-python",
102 "name": "python",
103 "nbconvert_exporter": "python",
104 "pygments_lexer": "ipython3",
105 "version": "3.5.2+"
106 }
107 },
108 "nbformat": 4,
109 "nbformat_minor": 2
110 }