From: Neil Smith Date: Sat, 20 May 2017 19:32:15 +0000 (+0100) Subject: Tweaked problem definition and data file for problem 1 X-Git-Url: https://git.njae.me.uk/?a=commitdiff_plain;h=91a537313710c79eab01c2f4b94b1eb66934cff0;p=ou-summer-of-code-2017.git Tweaked problem definition and data file for problem 1 --- diff --git a/01-ticket-prices/01-holidays.txt b/01-ticket-prices/01-holidays.txt index f0f2f9b..63fa029 100644 --- a/01-ticket-prices/01-holidays.txt +++ b/01-ticket-prices/01-holidays.txt @@ -1,124 +1,124 @@ -5f12ce1b86 1192 Sukhumi 14 -0279c8a91b 1008 Estacada 14 -1faea40e9c 1085 Tambon-Pa-Fa 14 -f421c9db0e 1056 Giessenmestia 10 -4d0ae38b17 1173 Mamula 7 -a61861c0ac 1692 Mamula 21 -8917807a68 1364 Parowan 7 -dc16c9b87f 1118 Karlukovo 21 -9e074d106c 887 Hajnowski 7 -25b1f581cf 1350 Tambon-Pa-Fa 14 -18568253ed 1368 Grimsey-Island 21 -5ca507289d 1476 Almaty 21 -90450d21f6 734 Karlukovo 3 -6bf2d26963 945 Sofia 7 -f13de9792c 1258 Aalborg 10 -4c3bd41774 1583 Holmegaard 21 -a211ae5b39 1400 Tubakuba 14 -1ee88b0301 1319 Mamula 14 -908ab2a57b 1394 Gorongosa 14 -7ad1ff45a7 1360 Tubakuba 14 -05949506f4 1599 Nullarbor 14 -5c8ae5d69b 1081 Giessenmestia 14 -93bb91f174 1027 Zhangye-Shi 10 -c1cce289bb 1048 Zhangye-Shi 14 -07ba9b25bb 1317 Mora 3 -557495ff48 1245 Brorfelde 14 -4d91320955 1231 Nordkapp 21 -c3d1a965bf 1564 Zhangye-Shi 14 -905044f0db 1231 Zhangye-Shi 14 -d8c29f025b 850 Uzupis 7 -7d21173587 827 Mamula 21 -7b61f62563 1059 Gorongosa 14 -418c819924 1592 Hajnowski 14 -39ba2e545f 1153 Giessenmestia 14 -a88bcde08f 1200 Geoje-Si 21 -ba97dce538 1334 Luoyang 10 -bfedf47e75 1411 Tambon-Pa-Fa 14 -c75972736e 1360 Tambon-Pa-Fa 10 -a627eacf02 1071 Hajnowski 14 -e5fd4f07f0 1722 Estacada 14 -ecedd5dec7 1298 Holmegaard 21 -82a6d39daf 1304 Hajnowski 14 -df88afc558 1002 Stonington-Island 21 -adfcc87811 1291 Uzupis 10 -ab7c401708 1088 Jayuya 14 -4338ffb0c8 1508 Gorongosa 7 -19137c9d63 1147 Aalborg 21 -e3c8a3457a 938 Sofia 14 -9e17759004 873 Brorfelde 10 -949147682b 1708 Tambon-Pa-Fa 14 -cd8a9e25a5 1331 Parowan 21 -49422ce165 966 Ijsseloog 21 -083f95c140 1277 Stonington-Island 7 -6b0687b1d5 1857 Mora 7 -011a8d05a9 1502 Parowan 21 -905e3adc44 1020 Giessenmestia 7 -dd90450a55 1099 Morgantown 7 -558e37a9cb 1570 Lemnos 7 -adfeed7f5b 930 Luoyang 14 -5b55438fd6 1367 Almaty 10 -d6dbecc2c1 653 Jayuya 21 -c824920d19 916 Giessenmestia 7 -f3e75eb80d 1315 Uzupis 14 -f5b0fa5b52 1351 Mora 21 -1b838183cb 1204 Mamula 14 -d123aee4db 1325 Sofia 7 -d4c5260a30 1238 Brorfelde 7 -15dbab77d7 1124 Nullarbor 21 -4224689a18 1016 Sukhumi 14 -f9dbdcceb5 671 Gorongosa 3 -0cf6e1dcda 1522 Karlukovo 7 -e24cd566b5 1264 Lemnos 7 -f006291b5d 1395 Tubakuba 14 -616b33a8eb 1010 Hajnowski 21 -cc7c78b4d5 828 Tambon-Pa-Fa 14 -748933a4a8 1261 Luoyang 14 -3730f51e7a 1425 Grimsey-Island 3 -0a1786b80e 1336 Brorfelde 14 -7834d83383 1220 Morgantown 14 -921d50e71f 1193 Lemnos 21 -81fc28b097 1224 Lemnos 3 -71271e63c2 936 Morgantown 10 -13272fc146 1063 Zhangye-Shi 10 -999a111ce6 1626 Morgantown 7 -1e6696144b 986 Nullarbor 7 -ea8b6ab428 1256 Nordkapp 3 -f2f4aa7f7f 1223 Lemnos 21 -3b75ed4e29 1483 Holmegaard 14 -227468b611 1280 Grimsey-Island 3 -6316268a67 1240 Holmegaard 14 -ace0751a7e 943 Puente-Laguna-Garzonkuala-Penyu 3 -251b0a29b5 1064 Morgantown 7 -08e358a1a5 1302 Giessenmestia 7 -c4e4b32b01 1117 Grimsey-Island 7 -8b45e786d7 1491 Tubakuba 14 -305c933269 922 Puente-Laguna-Garzonkuala-Penyu 14 -05dc1935d7 1187 Lemnos 21 -31283b3453 794 Jayuya 21 -b08811d0dd 785 Stonington-Island 14 -8108742c66 1137 Jayuya 21 -23a0fefaaa 1129 Tambon-Pa-Fa 14 -0172041cc4 1398 Nullarbor 3 -101f85c2a2 1240 Giessenmestia 21 -e62b71d07b 1121 Aalborg 14 -087a0e8722 1244 Parowan 14 -d3a9a562a0 1252 Giessenmestia 3 -ecddeec9a6 1275 Brorfelde 7 -705d831a04 1411 Almaty 3 -2ed3627cba 1185 Sukhumi 21 -659db7f4ad 1324 Tambon-Pa-Fa 3 -204e527a4b 1465 Giessenmestia 21 -ddb845b71a 1225 Uzupis 7 -ea29fb1ec3 1321 Sukhumi 14 -61d9efb897 1071 Aalborg 14 -e32c91ca86 1130 Puente-Laguna-Garzonkuala-Penyu 14 -164b06af74 1188 Hajnowski 21 -3274507344 1099 Brorfelde 7 -bd18df3cc1 1446 Jayuya 3 -971a59b616 967 Nullarbor 7 -cb3169c441 1132 Almaty 7 -d8ab39ff18 1504 Karlukovo 21 -ad350fa7f1 1373 Geoje-Si 7 -660febfb76 1157 Sukhumi 14 -ec8149cba9 1197 Hajnowski 21 +07ea553e 1348 Zhangye-Shi 14 +02d4b258b8a 1152 Estacada 3 +d29a0551504e 1210 Zhangye-Shi 7 +3e4d219009 904 Geoje-Si 7 +97afbad2bb 1129 Stonington-Island 21 +98c040c3 1375 Nullarbor 14 +8d178e8fe50 1310 Aalborg 7 +b4c9727f3a 955 Nordkapp 7 +646c6f60 1247 Sofia 10 +698a05914c 1440 Giessenmestia 14 +6106854836f 748 Brorfelde 14 +44aadddc 1245 Tubakuba 14 +c81a1fcfb 931 Sukhumi 21 +dc8aebebfc2 946 Parowan 3 +0e9e7473eb 1023 Gorongosa 14 +c7b043d2 1327 Nullarbor 7 +7bd023c3 1191 Holmegaard 21 +072a1106d 1329 Lemnos 14 +0b9cb9e950 1458 Estacada 7 +54945eeed430 1001 Nullarbor 10 +ccf770ecaa2 1206 Tubakuba 14 +90b158ef 1350 Morgantown 14 +e1d4e033df7 1057 Grimsey-Island 21 +fad4adaf 1297 Luoyang 3 +1cf53c93a 919 Sofia 7 +ddd7891fb37 1348 Almaty 7 +d752d52589 1148 Geoje-Si 21 +062bb5cf 1178 Zhangye-Shi 14 +c19a8114d44 1188 Hajnowski 3 +44946ac3d470 852 Karlukovo 3 +989f0ca8 930 Nordkapp 21 +d826034e08 1195 Tubakuba 14 +f4dd99265 1294 Karlukovo 21 +6ea4cebc128f 775 Mora 10 +328fd2275 806 Aalborg 21 +fd7278523 1363 Sukhumi 7 +865d85be7 896 Ijsseloog 21 +b7f4d5b476c 1755 Nullarbor 14 +eca25db7a 968 Gorongosa 14 +19ef5c556 1624 Sofia 14 +d6b5aa1d219e 1303 Aalborg 14 +deb36f50 1761 Nordkapp 14 +744efb40a295 1068 Morgantown 14 +07cc90dd3 1209 Lemnos 14 +4c0c6a48 1069 Sofia 7 +7ed300f23 1474 Luoyang 21 +f7db1341c848 1240 Nullarbor 3 +48b4a7976bf1 1133 Jayuya 3 +dd23065a18 1391 Stonington-Island 14 +0c33d4e1 1551 Luoyang 7 +d33d871c 1150 Aalborg 14 +2da4222c8 1374 Geoje-Si 10 +e11b4c5c 1075 Parowan 3 +aef2526d1978 1422 Morgantown 21 +7b95b6d95 1525 Morgantown 21 +ffcc1079c877 1579 Puente-Laguna-Garzonkuala-Penyu 14 +ddb13dd26f 1158 Lemnos 10 +6a1a190ed083 1042 Sukhumi 14 +3ca80302270 1404 Luoyang 7 +5daea80f7d2 1399 Sofia 7 +91bc0a2d0 1180 Almaty 14 +53b5f150 1149 Jayuya 10 +0085ebcc2b2 1442 Holmegaard 21 +4a52d756 1174 Uzupis 7 +d57afd163 1140 Geoje-Si 7 +9910d5838754 860 Morgantown 14 +6454824e86 1359 Lemnos 7 +9aa4a9bbd9f8 1391 Aalborg 10 +980e8f3064fc 976 Giessenmestia 14 +1d6a1b08 927 Luoyang 21 +64f067b7fc 1392 Luoyang 14 +b268e12d1d0b 984 Mora 7 +eac0d3ed07 1531 Brorfelde 21 +beaf2d8e35 947 Grimsey-Island 3 +e2c945275868 867 Zhangye-Shi 21 +677046c1f45d 1213 Karlukovo 10 +d3e9b79053c 1274 Aalborg 21 +cb24efd90 948 Morgantown 21 +ca9fe765 1491 Grimsey-Island 14 +d5821111c6c 1236 Nordkapp 14 +dcdccf9a55b8 1574 Ijsseloog 7 +e689ad12 1405 Zhangye-Shi 21 +8b6e8446 1360 Morgantown 21 +fafb6875f 1140 Brorfelde 21 +182f52c61f 916 Estacada 10 +4a264d5f4e 1262 Ijsseloog 14 +bf086837530 1162 Parowan 14 +dbfe9d638ef 1221 Nordkapp 7 +9e1d45351 1292 Giessenmestia 21 +541bd6119 1028 Mamula 7 +0aeeffa1a3 1209 Luoyang 21 +901c5848 1107 Sofia 10 +3100ad053f 910 Tambon-Pa-Fa 10 +295b0f07 997 Zhangye-Shi 21 +7bb0a03d18ab 1673 Brorfelde 21 +25c7800fd18 1582 Lemnos 14 +18952053b 1049 Mamula 7 +bc53df7eb 1168 Hajnowski 14 +8cb1c9b33b 1001 Almaty 7 +911bee88b048 1218 Almaty 21 +8f6abf6d 1580 Sukhumi 14 +85f6122bb848 1296 Gorongosa 14 +094ee9edf9ce 676 Tubakuba 7 +17637f07 1242 Jayuya 7 +6e4ca2fdf 684 Ijsseloog 3 +5d85167ed5c 878 Luoyang 3 +91e78da67 1054 Nordkapp 7 +43cd83bb01 1443 Giessenmestia 14 +9c1f692ea 1061 Stonington-Island 21 +0e792455b8d 1007 Tambon-Pa-Fa 14 +669c3fe3f 1038 Karlukovo 7 +ca039bc4a1ed 1216 Sofia 7 +7a95be26f65 944 Jayuya 7 +3da51cf71e 1864 Giessenmestia 14 +811b8fcf 1335 Morgantown 10 +4cffd22dd9b9 1089 Stonington-Island 14 +894fa3b99c 704 Gorongosa 7 +b73e3ee1b21 1028 Zhangye-Shi 7 +83377c09f17 980 Sofia 7 +686e7e91a 1282 Giessenmestia 10 +c18ca0a78 1069 Grimsey-Island 14 +14e6e1034a 948 Nordkapp 21 +3634c172 1176 Grimsey-Island 10 +08d2936f40 1175 Estacada 3 diff --git a/01-ticket-prices/ticket-pricing-generator.ipynb b/01-ticket-prices/ticket-pricing-generator.ipynb index 3d591fd..7214bd7 100644 --- a/01-ticket-prices/ticket-pricing-generator.ipynb +++ b/01-ticket-prices/ticket-pricing-generator.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 45, + "execution_count": 1, "metadata": { "collapsed": true }, @@ -15,7 +15,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 2, "metadata": { "collapsed": true }, @@ -29,7 +29,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 3, "metadata": {}, "outputs": [ { @@ -66,7 +66,7 @@ " 'Luoyang']" ] }, - "execution_count": 20, + "execution_count": 3, "metadata": {}, "output_type": "execute_result" } @@ -84,50 +84,50 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "{'Aalborg': 1,\n", - " 'Almaty': 1,\n", - " 'Brorfelde': 1,\n", - " 'Estacada': 1,\n", - " 'Geoje-Si': 1,\n", - " 'Giessenmestia': 1,\n", - " 'Gorongosa': 1,\n", - " 'Grimsey-Island': 1,\n", - " 'Hajnowski': 1,\n", - " 'Holmegaard': 1,\n", - " 'Ijsseloog': 1,\n", - " 'Jayuya': 1,\n", - " 'Karlukovo': 1,\n", - " 'Lemnos': 1,\n", - " 'Luoyang': 1,\n", - " 'Mamula': 1,\n", - " 'Mora': 1,\n", - " 'Morgantown': 1,\n", - " 'Nordkapp': 1,\n", - " 'Nullarbor': 1,\n", - " 'Parowan': 1,\n", - " 'Puente-Laguna-Garzonkuala-Penyu': 1,\n", - " 'Sofia': 1,\n", - " 'Stonington-Island': 1,\n", - " 'Sukhumi': 1,\n", - " 'Tambon-Pa-Fa': 1,\n", - " 'Tubakuba': 1,\n", - " 'Uzupis': 1,\n", - " 'Zhangye-Shi': 1}" + "{'Aalborg': 1.0,\n", + " 'Almaty': 1.0,\n", + " 'Brorfelde': 1.0,\n", + " 'Estacada': 1.0,\n", + " 'Geoje-Si': 1.0,\n", + " 'Giessenmestia': 1.0,\n", + " 'Gorongosa': 1.0,\n", + " 'Grimsey-Island': 1.0,\n", + " 'Hajnowski': 1.0,\n", + " 'Holmegaard': 1.0,\n", + " 'Ijsseloog': 1.0,\n", + " 'Jayuya': 1.0,\n", + " 'Karlukovo': 1.0,\n", + " 'Lemnos': 1.0,\n", + " 'Luoyang': 1.0,\n", + " 'Mamula': 1.0,\n", + " 'Mora': 1.0,\n", + " 'Morgantown': 1.0,\n", + " 'Nordkapp': 1.0,\n", + " 'Nullarbor': 1.0,\n", + " 'Parowan': 1.0,\n", + " 'Puente-Laguna-Garzonkuala-Penyu': 1.0,\n", + " 'Sofia': 1.0,\n", + " 'Stonington-Island': 1.0,\n", + " 'Sukhumi': 1.0,\n", + " 'Tambon-Pa-Fa': 1.0,\n", + " 'Tubakuba': 1.0,\n", + " 'Uzupis': 1.0,\n", + " 'Zhangye-Shi': 1.0}" ] }, - "execution_count": 39, + "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "destination_scores = {n: 1 for n in destination_names}\n", + "destination_scores = {n: 1.0 for n in destination_names}\n", "destination_scores" ] }, @@ -203,7 +203,7 @@ }, { "cell_type": "code", - "execution_count": 66, + "execution_count": 5, "metadata": { "collapsed": true }, @@ -215,7 +215,56 @@ }, { "cell_type": "code", - "execution_count": 44, + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'Aalborg': 1.0,\n", + " 'Almaty': 2.0,\n", + " 'Brorfelde': 0.9,\n", + " 'Estacada': 0.4,\n", + " 'Geoje-Si': 1.0,\n", + " 'Giessenmestia': 1.0,\n", + " 'Gorongosa': 1.0,\n", + " 'Grimsey-Island': 1.0,\n", + " 'Hajnowski': 1.0,\n", + " 'Holmegaard': 1.0,\n", + " 'Ijsseloog': 1.0,\n", + " 'Jayuya': 0.6,\n", + " 'Karlukovo': 2.2,\n", + " 'Lemnos': 1.0,\n", + " 'Luoyang': 1.0,\n", + " 'Mamula': 1.0,\n", + " 'Mora': 1.0,\n", + " 'Morgantown': 2.9,\n", + " 'Nordkapp': 1.5,\n", + " 'Nullarbor': 2.2,\n", + " 'Parowan': 1.0,\n", + " 'Puente-Laguna-Garzonkuala-Penyu': 0.4,\n", + " 'Sofia': 1.0,\n", + " 'Stonington-Island': 1.0,\n", + " 'Sukhumi': 1.0,\n", + " 'Tambon-Pa-Fa': 1.0,\n", + " 'Tubakuba': 1.0,\n", + " 'Uzupis': 0.9,\n", + " 'Zhangye-Shi': 1.0}" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "destination_scores.update(destination_score_exceptions)\n", + "destination_scores" + ] + }, + { + "cell_type": "code", + "execution_count": 7, "metadata": {}, "outputs": [ { @@ -247,7 +296,7 @@ }, { "cell_type": "code", - "execution_count": 48, + "execution_count": 12, "metadata": { "collapsed": true }, @@ -260,22 +309,22 @@ " price = 0\n", " for _ in range(4):\n", " price += random.randint(100, 500)\n", - " hol_id = str(uuid.uuid4())\n", + " hol_id = str(uuid.uuid4())[-random.randint(8, 12):]\n", " return hol_id, price, name, days" ] }, { "cell_type": "code", - "execution_count": 54, + "execution_count": 13, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "('4615dad7-f5ab-4c9b-8028-b3e5c676ff24', 1046, 'Almaty', 14)" + "('c657491bdd7', 737, 'Ijsseloog', 21)" ] }, - "execution_count": 54, + "execution_count": 13, "metadata": {}, "output_type": "execute_result" } @@ -286,47 +335,44 @@ }, { "cell_type": "code", - "execution_count": 59, + "execution_count": 24, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "[('3c425201-5538-4a3f-bfd7-1219137c9d63', 1147, 'Aalborg', 21),\n", - " ('5913e357-dc18-49c5-850d-aa0172041cc4', 1398, 'Nullarbor', 3),\n", - " ('bc966859-49ad-4c26-b36e-94251b0a29b5', 1064, 'Morgantown', 7),\n", - " ('ab1d0a54-41bc-4351-beb8-f6e5fd4f07f0', 1722, 'Estacada', 14),\n", - " ('b5efba4e-373d-4a15-b048-8fcb3169c441', 1132, 'Almaty', 7),\n", - " ('bd1ff2b9-5b97-4a13-9d8a-601faea40e9c', 1085, 'Tambon-Pa-Fa', 14),\n", - " ('5b9df004-a8b7-4c28-a27e-21e24cd566b5', 1264, 'Lemnos', 7),\n", - " ('5951de60-9e98-471f-a917-74e3c8a3457a', 938, 'Sofia', 14),\n", - " ('c6a4cad7-cd9a-4e05-bd16-92305c933269',\n", - " 922,\n", - " 'Puente-Laguna-Garzonkuala-Penyu',\n", - " 14),\n", - " ('9527ee0b-4bcd-4a1f-95fd-b3a627eacf02', 1071, 'Hajnowski', 14),\n", - " ('82b6adfb-f09d-420f-bbf9-ea90450d21f6', 734, 'Karlukovo', 3),\n", - " ('7b08192c-5e30-45dc-bb31-2da61861c0ac', 1692, 'Mamula', 21),\n", - " ('5abbe3e4-7d2e-404c-9ce2-27083f95c140', 1277, 'Stonington-Island', 7),\n", - " ('b3f517ca-2a07-427d-8531-81227468b611', 1280, 'Grimsey-Island', 3),\n", - " ('f1fa90d2-0f58-480f-80c0-0fddb845b71a', 1225, 'Uzupis', 7),\n", - " ('330e4f58-31d2-474f-8e23-654224689a18', 1016, 'Sukhumi', 14),\n", - " ('a6837ba1-42aa-488d-b39a-5b49422ce165', 966, 'Ijsseloog', 21),\n", - " ('a7e4161a-0435-4915-961e-8c204e527a4b', 1465, 'Giessenmestia', 21),\n", - " ('633be2e4-a719-496e-9987-d5ea8b6ab428', 1256, 'Nordkapp', 3),\n", - " ('bd83d3e3-6134-4511-918c-a94338ffb0c8', 1508, 'Gorongosa', 7),\n", - " ('05ed4593-3582-4fde-8958-a63274507344', 1099, 'Brorfelde', 7),\n", - " ('b8361d0a-7f23-4491-9450-c28917807a68', 1364, 'Parowan', 7),\n", - " ('dc7f49c2-672e-4abc-a58a-4e8b45e786d7', 1491, 'Tubakuba', 14),\n", - " ('b709a89e-e5c5-4a60-97ca-55ad350fa7f1', 1373, 'Geoje-Si', 7),\n", - " ('18888ae2-e410-4430-87af-1d07ba9b25bb', 1317, 'Mora', 3),\n", - " ('b08ebc25-7d02-4973-8e28-fa3b75ed4e29', 1483, 'Holmegaard', 14),\n", - " ('d3519dde-9a15-4982-b1ed-1dd6dbecc2c1', 653, 'Jayuya', 21),\n", - " ('fa882848-1787-424a-90c3-8593bb91f174', 1027, 'Zhangye-Shi', 10),\n", - " ('21d2fcc8-f528-467d-b0ba-a6748933a4a8', 1261, 'Luoyang', 14)]" + "[('9d25c63364', 1375, 'Aalborg', 14),\n", + " ('9eebed9a8c', 1024, 'Nullarbor', 21),\n", + " ('1878f1decd0f', 1074, 'Morgantown', 14),\n", + " ('8c5701a15090', 1126, 'Estacada', 10),\n", + " ('f54356416', 1476, 'Almaty', 14),\n", + " ('fd3f630097', 1211, 'Tambon-Pa-Fa', 3),\n", + " ('ba1eca1e3c', 1134, 'Lemnos', 14),\n", + " ('6e614079e', 983, 'Sofia', 21),\n", + " ('723d6cd8b8c', 1226, 'Puente-Laguna-Garzonkuala-Penyu', 7),\n", + " ('67d5ba46574', 885, 'Hajnowski', 14),\n", + " ('af932c766e', 1756, 'Karlukovo', 3),\n", + " ('6803ee6ab68f', 891, 'Mamula', 10),\n", + " ('b721ca2c', 1269, 'Stonington-Island', 14),\n", + " ('c10ced934a83', 1254, 'Grimsey-Island', 21),\n", + " ('13f08b1e45b', 970, 'Uzupis', 21),\n", + " ('212729ebcc0', 1100, 'Sukhumi', 14),\n", + " ('294407f475f', 1273, 'Ijsseloog', 14),\n", + " ('e63140bd9652', 859, 'Giessenmestia', 10),\n", + " ('cd815d115', 970, 'Nordkapp', 21),\n", + " ('ff301e4dc', 1103, 'Gorongosa', 21),\n", + " ('e44ce4502a6', 1326, 'Brorfelde', 14),\n", + " ('8631ec6315', 1194, 'Parowan', 14),\n", + " ('766fe50f8f3', 1078, 'Tubakuba', 7),\n", + " ('6238cc640', 1409, 'Geoje-Si', 3),\n", + " ('0ae89c204', 1085, 'Mora', 21),\n", + " ('aa221d744', 1157, 'Holmegaard', 14),\n", + " ('9f842558a', 941, 'Jayuya', 21),\n", + " ('791ed3da', 1159, 'Zhangye-Shi', 10),\n", + " ('9ac98764f', 1048, 'Luoyang', 14)]" ] }, - "execution_count": 59, + "execution_count": 24, "metadata": {}, "output_type": "execute_result" } @@ -340,7 +386,7 @@ }, { "cell_type": "code", - "execution_count": 60, + "execution_count": 25, "metadata": { "collapsed": true }, @@ -352,30 +398,191 @@ }, { "cell_type": "code", - "execution_count": 62, + "execution_count": 29, "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "iterating\n" + ] + }, + { + "data": { + "text/plain": [ + "[('8d178e8fe50', 1310, 'Aalborg', 7),\n", + " ('98c040c3', 1375, 'Nullarbor', 14),\n", + " ('744efb40a295', 1068, 'Morgantown', 14),\n", + " ('08d2936f40', 1175, 'Estacada', 3),\n", + " ('91bc0a2d0', 1180, 'Almaty', 14),\n", + " ('0e792455b8d', 1007, 'Tambon-Pa-Fa', 14),\n", + " ('6454824e86', 1359, 'Lemnos', 7),\n", + " ('5daea80f7d2', 1399, 'Sofia', 7),\n", + " ('ffcc1079c877', 1579, 'Puente-Laguna-Garzonkuala-Penyu', 14),\n", + " ('bc53df7eb', 1168, 'Hajnowski', 14),\n", + " ('669c3fe3f', 1038, 'Karlukovo', 7),\n", + " ('541bd6119', 1028, 'Mamula', 7),\n", + " ('dd23065a18', 1391, 'Stonington-Island', 14),\n", + " ('3634c172', 1176, 'Grimsey-Island', 10),\n", + " ('4a52d756', 1174, 'Uzupis', 7),\n", + " ('6a1a190ed083', 1042, 'Sukhumi', 14),\n", + " ('4a264d5f4e', 1262, 'Ijsseloog', 14),\n", + " ('9e1d45351', 1292, 'Giessenmestia', 21),\n", + " ('b4c9727f3a', 955, 'Nordkapp', 7),\n", + " ('894fa3b99c', 704, 'Gorongosa', 7),\n", + " ('fafb6875f', 1140, 'Brorfelde', 21),\n", + " ('dc8aebebfc2', 946, 'Parowan', 3),\n", + " ('094ee9edf9ce', 676, 'Tubakuba', 7),\n", + " ('d752d52589', 1148, 'Geoje-Si', 21),\n", + " ('6ea4cebc128f', 775, 'Mora', 10),\n", + " ('0085ebcc2b2', 1442, 'Holmegaard', 21),\n", + " ('48b4a7976bf1', 1133, 'Jayuya', 3),\n", + " ('e689ad12', 1405, 'Zhangye-Shi', 21),\n", + " ('fad4adaf', 1297, 'Luoyang', 3),\n", + " ('6e4ca2fdf', 684, 'Ijsseloog', 3),\n", + " ('83377c09f17', 980, 'Sofia', 7),\n", + " ('3ca80302270', 1404, 'Luoyang', 7),\n", + " ('91e78da67', 1054, 'Nordkapp', 7),\n", + " ('ddb13dd26f', 1158, 'Lemnos', 10),\n", + " ('865d85be7', 896, 'Ijsseloog', 21),\n", + " ('dbfe9d638ef', 1221, 'Nordkapp', 7),\n", + " ('698a05914c', 1440, 'Giessenmestia', 14),\n", + " ('e11b4c5c', 1075, 'Parowan', 3),\n", + " ('9910d5838754', 860, 'Morgantown', 14),\n", + " ('3e4d219009', 904, 'Geoje-Si', 7),\n", + " ('19ef5c556', 1624, 'Sofia', 14),\n", + " ('072a1106d', 1329, 'Lemnos', 14),\n", + " ('7bb0a03d18ab', 1673, 'Brorfelde', 21),\n", + " ('07cc90dd3', 1209, 'Lemnos', 14),\n", + " ('ca9fe765', 1491, 'Grimsey-Island', 14),\n", + " ('3100ad053f', 910, 'Tambon-Pa-Fa', 10),\n", + " ('7a95be26f65', 944, 'Jayuya', 7),\n", + " ('4cffd22dd9b9', 1089, 'Stonington-Island', 14),\n", + " ('eac0d3ed07', 1531, 'Brorfelde', 21),\n", + " ('d826034e08', 1195, 'Tubakuba', 14),\n", + " ('7bd023c3', 1191, 'Holmegaard', 21),\n", + " ('ddd7891fb37', 1348, 'Almaty', 7),\n", + " ('d3e9b79053c', 1274, 'Aalborg', 21),\n", + " ('6106854836f', 748, 'Brorfelde', 14),\n", + " ('9c1f692ea', 1061, 'Stonington-Island', 21),\n", + " ('bf086837530', 1162, 'Parowan', 14),\n", + " ('8b6e8446', 1360, 'Morgantown', 21),\n", + " ('1d6a1b08', 927, 'Luoyang', 21),\n", + " ('e1d4e033df7', 1057, 'Grimsey-Island', 21),\n", + " ('deb36f50', 1761, 'Nordkapp', 14),\n", + " ('aef2526d1978', 1422, 'Morgantown', 21),\n", + " ('97afbad2bb', 1129, 'Stonington-Island', 21),\n", + " ('18952053b', 1049, 'Mamula', 7),\n", + " ('43cd83bb01', 1443, 'Giessenmestia', 14),\n", + " ('d57afd163', 1140, 'Geoje-Si', 7),\n", + " ('d29a0551504e', 1210, 'Zhangye-Shi', 7),\n", + " ('182f52c61f', 916, 'Estacada', 10),\n", + " ('9aa4a9bbd9f8', 1391, 'Aalborg', 10),\n", + " ('d6b5aa1d219e', 1303, 'Aalborg', 14),\n", + " ('64f067b7fc', 1392, 'Luoyang', 14),\n", + " ('0c33d4e1', 1551, 'Luoyang', 7),\n", + " ('cb24efd90', 948, 'Morgantown', 21),\n", + " ('328fd2275', 806, 'Aalborg', 21),\n", + " ('c81a1fcfb', 931, 'Sukhumi', 21),\n", + " ('ccf770ecaa2', 1206, 'Tubakuba', 14),\n", + " ('44946ac3d470', 852, 'Karlukovo', 3),\n", + " ('fd7278523', 1363, 'Sukhumi', 7),\n", + " ('0e9e7473eb', 1023, 'Gorongosa', 14),\n", + " ('8f6abf6d', 1580, 'Sukhumi', 14),\n", + " ('677046c1f45d', 1213, 'Karlukovo', 10),\n", + " ('beaf2d8e35', 947, 'Grimsey-Island', 3),\n", + " ('d33d871c', 1150, 'Aalborg', 14),\n", + " ('54945eeed430', 1001, 'Nullarbor', 10),\n", + " ('911bee88b048', 1218, 'Almaty', 21),\n", + " ('062bb5cf', 1178, 'Zhangye-Shi', 14),\n", + " ('b73e3ee1b21', 1028, 'Zhangye-Shi', 7),\n", + " ('b268e12d1d0b', 984, 'Mora', 7),\n", + " ('53b5f150', 1149, 'Jayuya', 10),\n", + " ('0aeeffa1a3', 1209, 'Luoyang', 21),\n", + " ('901c5848', 1107, 'Sofia', 10),\n", + " ('c19a8114d44', 1188, 'Hajnowski', 3),\n", + " ('989f0ca8', 930, 'Nordkapp', 21),\n", + " ('02d4b258b8a', 1152, 'Estacada', 3),\n", + " ('f7db1341c848', 1240, 'Nullarbor', 3),\n", + " ('8cb1c9b33b', 1001, 'Almaty', 7),\n", + " ('811b8fcf', 1335, 'Morgantown', 10),\n", + " ('f4dd99265', 1294, 'Karlukovo', 21),\n", + " ('d5821111c6c', 1236, 'Nordkapp', 14),\n", + " ('c18ca0a78', 1069, 'Grimsey-Island', 14),\n", + " ('c7b043d2', 1327, 'Nullarbor', 7),\n", + " ('dcdccf9a55b8', 1574, 'Ijsseloog', 7),\n", + " ('646c6f60', 1247, 'Sofia', 10),\n", + " ('980e8f3064fc', 976, 'Giessenmestia', 14),\n", + " ('0b9cb9e950', 1458, 'Estacada', 7),\n", + " ('295b0f07', 997, 'Zhangye-Shi', 21),\n", + " ('3da51cf71e', 1864, 'Giessenmestia', 14),\n", + " ('4c0c6a48', 1069, 'Sofia', 7),\n", + " ('7ed300f23', 1474, 'Luoyang', 21),\n", + " ('ca039bc4a1ed', 1216, 'Sofia', 7),\n", + " ('07ea553e', 1348, 'Zhangye-Shi', 14),\n", + " ('44aadddc', 1245, 'Tubakuba', 14),\n", + " ('25c7800fd18', 1582, 'Lemnos', 14),\n", + " ('14e6e1034a', 948, 'Nordkapp', 21),\n", + " ('eca25db7a', 968, 'Gorongosa', 14),\n", + " ('90b158ef', 1350, 'Morgantown', 14),\n", + " ('2da4222c8', 1374, 'Geoje-Si', 10),\n", + " ('5d85167ed5c', 878, 'Luoyang', 3),\n", + " ('b7f4d5b476c', 1755, 'Nullarbor', 14),\n", + " ('686e7e91a', 1282, 'Giessenmestia', 10),\n", + " ('85f6122bb848', 1296, 'Gorongosa', 14),\n", + " ('e2c945275868', 867, 'Zhangye-Shi', 21),\n", + " ('17637f07', 1242, 'Jayuya', 7),\n", + " ('1cf53c93a', 919, 'Sofia', 7),\n", + " ('7b95b6d95', 1525, 'Morgantown', 21)]" + ] + }, + "execution_count": 29, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "finished = False\n", + "while not finished:\n", + " print('iterating')\n", + " holidays = []\n", + " for n in destination_names:\n", + " holidays += [make_holiday(n)]\n", + " for _ in range(95):\n", + " holidays += [make_holiday()]\n", + " finished = (len(set(h[0] for h in holidays)) == len(holidays))\n", + "holidays" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "random.shuffle(holidays)\n", "with open('01-holidays.txt', 'w') as f:\n", " for hid, price, name, days in holidays:\n", - " f.write('{} {} {} {}\\n'.format(hid[-10:], price, name, days))" + " f.write('{} {} {} {}\\n'.format(hid, price, name, days))" ] }, { "cell_type": "code", - "execution_count": 63, + "execution_count": 31, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "[['5f12ce1b86', '1192', 'Sukhumi', '14'],\n", - " ['0279c8a91b', '1008', 'Estacada', '14'],\n", - " ['1faea40e9c', '1085', 'Tambon-Pa-Fa', '14']]" + "[['07ea553e', '1348', 'Zhangye-Shi', '14'],\n", + " ['02d4b258b8a', '1152', 'Estacada', '3'],\n", + " ['d29a0551504e', '1210', 'Zhangye-Shi', '7']]" ] }, - "execution_count": 63, + "execution_count": 31, "metadata": {}, "output_type": "execute_result" } @@ -388,7 +595,7 @@ }, { "cell_type": "code", - "execution_count": 64, + "execution_count": 18, "metadata": { "collapsed": true }, @@ -399,22 +606,22 @@ }, { "cell_type": "code", - "execution_count": 78, + "execution_count": 19, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "[('6138068a-3c16-4f7f-8dc6-a1199608abc5', 1209, 'Nordkapp', 21),\n", - " ('eafb15a4-1839-4fb5-be9b-d8389018bd07', 1052, 'Estacada', 21),\n", - " ('ab659b71-347d-45dc-9416-34def36ffc7d', 1514, 'Giessenmestia', 21),\n", - " ('bb8d5034-49ce-483d-ab6c-d16caf2584a5', 724, 'Stonington-Island', 14),\n", - " ('7476b214-8b55-47f6-833e-dfa487c4270a', 782, 'Geoje-Si', 14),\n", - " ('f2ffe169-7cc5-42e1-9b46-8cdb61bb906d', 769, 'Morgantown', 3),\n", - " ('2e6a6d6d-6c08-4021-b99f-05202c898b5f', 1184, 'Morgantown', 21)]" + "[('c6efb742d00c', 1010, 'Puente-Laguna-Garzonkuala-Penyu', 7),\n", + " ('7c111cbe', 1061, 'Morgantown', 14),\n", + " ('6b1006fa49', 1137, 'Sofia', 3),\n", + " ('fb330270', 1075, 'Uzupis', 3),\n", + " ('acf977ef446f', 1318, 'Mora', 14),\n", + " ('02277d8e', 1023, 'Zhangye-Shi', 10),\n", + " ('3fa7eb52c', 1515, 'Zhangye-Shi', 14)]" ] }, - "execution_count": 78, + "execution_count": 19, "metadata": {}, "output_type": "execute_result" } @@ -429,22 +636,22 @@ }, { "cell_type": "code", - "execution_count": 79, + "execution_count": 20, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "[('f2ffe169-7cc5-42e1-9b46-8cdb61bb906d', 769, 'Morgantown', 3),\n", - " ('2e6a6d6d-6c08-4021-b99f-05202c898b5f', 1184, 'Morgantown', 21),\n", - " ('ab659b71-347d-45dc-9416-34def36ffc7d', 1514, 'Giessenmestia', 21),\n", - " ('eafb15a4-1839-4fb5-be9b-d8389018bd07', 1052, 'Estacada', 21),\n", - " ('7476b214-8b55-47f6-833e-dfa487c4270a', 782, 'Geoje-Si', 14),\n", - " ('bb8d5034-49ce-483d-ab6c-d16caf2584a5', 724, 'Stonington-Island', 14),\n", - " ('6138068a-3c16-4f7f-8dc6-a1199608abc5', 1209, 'Nordkapp', 21)]" + "[('c6efb742d00c', 1010, 'Puente-Laguna-Garzonkuala-Penyu', 7),\n", + " ('3fa7eb52c', 1515, 'Zhangye-Shi', 14),\n", + " ('fb330270', 1075, 'Uzupis', 3),\n", + " ('7c111cbe', 1061, 'Morgantown', 14),\n", + " ('02277d8e', 1023, 'Zhangye-Shi', 10),\n", + " ('6b1006fa49', 1137, 'Sofia', 3),\n", + " ('acf977ef446f', 1318, 'Mora', 14)]" ] }, - "execution_count": 79, + "execution_count": 20, "metadata": {}, "output_type": "execute_result" } @@ -456,7 +663,7 @@ }, { "cell_type": "code", - "execution_count": 82, + "execution_count": 21, "metadata": { "collapsed": true }, @@ -473,26 +680,26 @@ }, { "cell_type": "code", - "execution_count": 83, + "execution_count": 23, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "db61bb906d 769 Morgantown 3\n", - "202c898b5f 1284 Morgantown 21\n", - "def36ffc7d 1514 Giessenmestia 21\n", - "389018bd07 1052 Estacada 21\n", - "a487c4270a 782 Geoje-Si 14\n", - "6caf2584a5 724 Stonington-Island 14\n", - "199608abc5 1209 Nordkapp 21\n" + "f2ffe169-7cc5-42e1-9b46-8cdb61bb906d 769 Morgantown 3\n", + "2e6a6d6d-6c08-4021-b99f-05202c898b5f 1284 Morgantown 21\n", + "ab659b71-347d-45dc-9416-34def36ffc7d 1514 Giessenmestia 21\n", + "eafb15a4-1839-4fb5-be9b-d8389018bd07 1052 Estacada 21\n", + "7476b214-8b55-47f6-833e-dfa487c4270a 782 Geoje-Si 14\n", + "bb8d5034-49ce-483d-ab6c-d16caf2584a5 724 Stonington-Island 14\n", + "6138068a-3c16-4f7f-8dc6-a1199608abc5 1209 Nordkapp 21\n" ] } ], "source": [ "for hid, price, name, days in example_holidays:\n", - " print('{} {} {} {}'.format(hid[-10:], price, name, days))" + " print('{} {} {} {}'.format(hid, price, name, days))" ] }, { diff --git a/01-ticket-prices/ticket-pricing-question.ipynb b/01-ticket-prices/ticket-pricing-question.ipynb new file mode 100644 index 0000000..5ad6637 --- /dev/null +++ b/01-ticket-prices/ticket-pricing-question.ipynb @@ -0,0 +1,110 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Ticket pricing\n", + "\n", + "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", + "\n", + "It's a simple text file, with one possible holiday package per line.\n", + "\n", + "Each line has four fields, separated by spaces. They are:\n", + "* The deal ID, from the price comparison website you found it.\n", + "* The holiday price, in whole pounds.\n", + "* The location of the holiday, always a single word.\n", + "* The number of nights you'd be staying. \n", + "\n", + "For example, the data file might look like this:\n", + "\n", + "```\n", + "db61bb90 769 Morgantown 3\n", + "202c898b5f 1284 Morgantown 21\n", + "def36ffcd 1514 Giessenmestia 21\n", + "389018bd0707 1052 Estacada 21\n", + "a487c4270 782 Geoje-Si 14\n", + "6caf2584a55 724 Stonington-Island 14\n", + "199608abc5 1209 Nordkapp 21\n", + "```" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Part 1\n", + "You have a budget of £1200. How many of the holidays can you afford?\n", + "\n", + "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", + "\n", + "The 21 day trip to Morgantown and the trips to Giessenmestia and Nordkapp are all too expensive." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Part 2\n", + "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", + "\n", + "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", + "\n", + "Assume all holidays have a relative value of 1, apart from these destinations.\n", + "\n", + "| Destination | Score |\n", + "|-------------|-------|\n", + "| Almaty | 2.0 |\n", + "| Brorfelde | 0.9 |\n", + "| Estacada | 0.4 |\n", + "| Jayuya | 0.6 |\n", + "| Karlukovo | 2.2 |\n", + "| Morgantown | 2.9 |\n", + "| Nordkapp | 1.5 |\n", + "| Nullarbor | 2.2 |\n", + "| Puente-Laguna-Garzonkuala-Penyu | 0.4 |\n", + "| Uzupis | 0.9 |\n", + "\n", + "## Example\n", + "\n", + "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", + "\n", + "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", + "\n", + "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", + "\n", + "The best value affordable holiday is the trip to Stonnington Island, with $\\frac{14}{1284} = 0.0193$ nights per pound." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.5.2+" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/01-ticket-prices/ticket-pricing-solution.ipynb b/01-ticket-prices/ticket-pricing-solution.ipynb index 59d7046..df02700 100644 --- a/01-ticket-prices/ticket-pricing-solution.ipynb +++ b/01-ticket-prices/ticket-pricing-solution.ipynb @@ -19,12 +19,12 @@ "For example, the data file might look like this:\n", "\n", "```\n", - "db61bb906d 769 Morgantown 3\n", + "db61bb90 769 Morgantown 3\n", "202c898b5f 1284 Morgantown 21\n", - "def36ffc7d 1514 Giessenmestia 21\n", - "389018bd07 1052 Estacada 21\n", - "a487c4270a 782 Geoje-Si 14\n", - "6caf2584a5 724 Stonington-Island 14\n", + "def36ffcd 1514 Giessenmestia 21\n", + "389018bd0707 1052 Estacada 21\n", + "a487c4270 782 Geoje-Si 14\n", + "6caf2584a55 724 Stonington-Island 14\n", "199608abc5 1209 Nordkapp 21\n", "```" ] @@ -36,7 +36,9 @@ "## Part 1\n", "You have a budget of £1200. How many of the holidays can you afford?\n", "\n", - "Given the example data above, you could afford four of the holidays: the 21 day trip to Morgantown and the trips to Giessenmestia and Nordkapp are all too expensive." + "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", + "\n", + "The 21 day trip to Morgantown and the trips to Giessenmestia and Nordkapp are all too expensive." ] }, { @@ -48,18 +50,18 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "[['5f12ce1b86', '1192', 'Sukhumi', '14'],\n", - " ['0279c8a91b', '1008', 'Estacada', '14'],\n", - " ['1faea40e9c', '1085', 'Tambon-Pa-Fa', '14']]" + "[['07ea553e', '1348', 'Zhangye-Shi', '14'],\n", + " ['02d4b258b8a', '1152', 'Estacada', '3'],\n", + " ['d29a0551504e', '1210', 'Zhangye-Shi', '7']]" ] }, - "execution_count": 7, + "execution_count": 1, "metadata": {}, "output_type": "execute_result" } @@ -75,16 +77,16 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "57" + "66" ] }, - "execution_count": 25, + "execution_count": 2, "metadata": {}, "output_type": "execute_result" } @@ -107,16 +109,16 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "57" + "66" ] }, - "execution_count": 6, + "execution_count": 3, "metadata": {}, "output_type": "execute_result" } @@ -151,16 +153,18 @@ "\n", "## Example\n", "\n", - "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. 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", + "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", "\n", "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", "\n", + "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", + "\n", "The best value affordable holiday is the trip to Stonnington Island, with $\\frac{14}{1284} = 0.0193$ nights per pound." ] }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 4, "metadata": { "collapsed": true }, @@ -173,8 +177,10 @@ }, { "cell_type": "code", - "execution_count": 11, - "metadata": {}, + "execution_count": 5, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "def value_of_destination(name):\n", @@ -186,8 +192,10 @@ }, { "cell_type": "code", - "execution_count": 32, - "metadata": {}, + "execution_count": 6, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "def value_of_holiday(holiday):\n", @@ -198,16 +206,16 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "'dc16c9b87f'" + "'cb24efd90'" ] }, - "execution_count": 36, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } @@ -233,16 +241,16 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "'dc16c9b87f'" + "'cb24efd90'" ] }, - "execution_count": 34, + "execution_count": 8, "metadata": {}, "output_type": "execute_result" }