From 2e864f325d189c2cc360094f8ea2531e9c91a8c5 Mon Sep 17 00:00:00 2001 From: Petr Hajduk Date: Mon, 9 Sep 2024 13:05:00 +0300 Subject: [PATCH] filling missing parameters for model and adjusting testing value in mode split test --- Scripts/parameters/destination_choice.py | 178 +++++++++----- Scripts/parameters/mode_choice.py | 290 ++++++++++++++++++++++- Scripts/parameters/tour_generation.py | 2 +- Scripts/tests/integration/test_models.py | 2 +- 4 files changed, 404 insertions(+), 68 deletions(-) diff --git a/Scripts/parameters/destination_choice.py b/Scripts/parameters/destination_choice.py index a6b5d3ba..2eef783a 100644 --- a/Scripts/parameters/destination_choice.py +++ b/Scripts/parameters/destination_choice.py @@ -21,20 +21,23 @@ }, "size": { "workplaces": 1.0, - "area": 85.15485292715536 + "zone_area": 85.15485292715536 } }, "transit": { "impedance": { "cost": (-0.140005787552, -0.140005787552), - "time": (-0.016972928457, -0.016972928457) + "time": -0.016972928457 }, "log": { "size": 1.0 }, "size": { "workplaces": 1.0, - "area": 85.15485292715536 + "zone_area": 85.15485292715536 + }, + "attraction": { + } }, "bike": { @@ -46,7 +49,10 @@ }, "size": { "workplaces": 1.0, - "area": 85.15485292715536 + "zone_area": 85.15485292715536 + }, + "attraction": { + } }, "walk": { @@ -58,7 +64,10 @@ }, "size": { "workplaces": 1.0, - "area": 85.15485292715536 + "zone_area": 85.15485292715536 + }, + "attraction": { + } } }, @@ -68,7 +77,7 @@ "time": (-0.0651224641997, -0.0651224641997) }, "log": { - "transform": -1.7803163780000002, + "transform": -1.780316378, "size": 1.0 }, "transform": { @@ -81,13 +90,16 @@ }, "size": { "comprehensive_schools": 1.0, - "secondary_schools": 0.5184168941205347, - "area": 84.44188603996112 + "secondary_schools": 0.5184168941205348, + "zone_area": 84.44188603996112 + }, + "attraction": { + } }, "transit": { "log": { - "transform": -1.7803163780000002, + "transform": -1.780316378, "size": 1.0 }, "transform": { @@ -99,12 +111,15 @@ } }, "impedance": { - "time": (-0.025324773613900002, -0.025324773613900002) + "time": -0.0253247736139 }, "size": { "comprehensive_schools": 1.0, - "secondary_schools": 0.5184168941205347, - "area": 84.44188603996112 + "secondary_schools": 0.5184168941205348, + "zone_area": 84.44188603996112 + }, + "attraction": { + } }, "bike": { @@ -116,8 +131,11 @@ }, "size": { "comprehensive_schools": 1.0, - "secondary_schools": 0.5184168941205347, - "area": 84.44188603996112 + "secondary_schools": 0.5184168941205348, + "zone_area": 84.44188603996112 + }, + "attraction": { + } }, "walk": { @@ -129,8 +147,11 @@ }, "size": { "comprehensive_schools": 1.0, - "secondary_schools": 0.5184168941205347, - "area": 84.44188603996112 + "secondary_schools": 0.5184168941205348, + "zone_area": 84.44188603996112 + }, + "attraction": { + } } }, @@ -149,13 +170,13 @@ "size": { "secondary_schools": 1.0, "tertiary_education": 2.309725037812683, - "area": 772.5951659479507 + "zone_area": 772.59516594795 } }, "transit": { "impedance": { "cost": (-0.220560059913, -0.220560059913), - "time": (-0.0195111793724, -0.0195111793724) + "time": -0.0195111793724 }, "log": { "size": 1.0 @@ -163,7 +184,10 @@ "size": { "secondary_schools": 1.0, "tertiary_education": 2.309725037812683, - "area": 772.5951659479507 + "zone_area": 772.59516594795 + }, + "attraction": { + } }, "bike": { @@ -176,7 +200,10 @@ "size": { "secondary_schools": 1.0, "tertiary_education": 2.309725037812683, - "area": 772.5951659479507 + "zone_area": 772.59516594795 + }, + "attraction": { + } }, "walk": { @@ -189,18 +216,21 @@ "size": { "secondary_schools": 1.0, "tertiary_education": 2.309725037812683, - "area": 772.5951659479507 + "zone_area": 772.59516594795 + }, + "attraction": { + } } }, "hs": { "car": { "attraction": { - "parking_cost_errand": (-0.26545384075100004, -0.26545384075100004) + "parking_cost_errand": (-0.265453840751, -0.265453840751) }, "impedance": { - "time": (-0.0459163563410375, -0.0459163563410375), - "cost": (-0.5130319144250001, -0.5130319144250001) + "time": (-0.045916356341037495, -0.045916356341037495), + "cost": (-0.513031914425, -0.513031914425) }, "log": { "size": 1.0 @@ -209,13 +239,13 @@ "population": 1.0, "service": 8.050306985676482, "shops": 178.9029456047575, - "area": 1466.6244395531417 + "zone_area": 1466.6244395531403 } }, "transit": { "impedance": { - "cost": (-0.5130319144250001, -0.5130319144250001), - "time": (-0.0321923140734, -0.0321923140734) + "cost": (-0.513031914425, -0.513031914425), + "time": -0.0321923140734 }, "log": { "size": 1.0 @@ -224,7 +254,10 @@ "population": 1.0, "service": 8.050306985676482, "shops": 178.9029456047575, - "area": 1466.6244395531417 + "zone_area": 1466.6244395531403 + }, + "attraction": { + } }, "bike": { @@ -238,12 +271,15 @@ "population": 1.0, "service": 8.050306985676482, "shops": 178.9029456047575, - "area": 1466.6244395531417 + "zone_area": 1466.6244395531403 + }, + "attraction": { + } }, "walk": { "impedance": { - "dist": -0.8951182013429999 + "dist": -0.895118201343 }, "log": { "size": 1.0 @@ -252,7 +288,10 @@ "population": 1.0, "service": 8.050306985676482, "shops": 178.9029456047575, - "area": 1466.6244395531417 + "zone_area": 1466.6244395531403 + }, + "attraction": { + } } }, @@ -269,13 +308,16 @@ "population": 1.0, "service": 20.085536923187668, "shops": 7.38905609893065, - "area": 1.0 + "zone_area": 1.0 + }, + "attraction": { + } }, "transit": { "impedance": { "cost": (0.01, 0.01), - "time": (-0.024812532636, -0.024812532636) + "time": -0.024812532636 }, "log": { "size": 1.0 @@ -284,7 +326,10 @@ "population": 1.0, "service": 20.085536923187668, "shops": 7.38905609893065, - "area": 1.0 + "zone_area": 1.0 + }, + "attraction": { + } }, "bike": { @@ -298,7 +343,10 @@ "population": 1.0, "service": 20.085536923187668, "shops": 7.38905609893065, - "area": 1.0 + "zone_area": 1.0 + }, + "attraction": { + } }, "walk": { @@ -312,7 +360,10 @@ "population": 1.0, "service": 20.085536923187668, "shops": 7.38905609893065, - "area": 1.0 + "zone_area": 1.0 + }, + "attraction": { + } } }, @@ -330,7 +381,7 @@ "time": -0.167802825326 }, "attraction": { - "parking_cost_errand": (-0.204598505332, -0.204598505332) + "parking_cost_errand": -0.204598505332 } }, "transit": { @@ -343,7 +394,10 @@ "shops": 19.014887841870237 }, "impedance": { - "time": -0.046455399199400005 + "time": -0.0464553991994 + }, + "attraction": { + } }, "bike": { @@ -357,6 +411,9 @@ }, "impedance": { "dist": -0.847308504612 + }, + "attraction": { + } } }, @@ -378,7 +435,7 @@ "service": 4.899936388531657, "shops_cbd": 36.161227785768844, "shops_elsewhere": 29.03185180709253, - "own_zone": (1034.3523780364185, 1034.3523780364185) + "own_zone": (np.float64(1034.3523780364185), np.float64(1034.3523780364185)) } }, "transit": { @@ -399,7 +456,7 @@ "service": 4.899936388531657, "shops_cbd": 36.161227785768844, "shops_elsewhere": 29.03185180709253, - "own_zone": (1034.3523780364185, 1034.3523780364185) + "own_zone": (np.float64(1034.3523780364185), np.float64(1034.3523780364185)) } }, "bike": { @@ -419,7 +476,7 @@ "service": 4.899936388531657, "shops_cbd": 36.161227785768844, "shops_elsewhere": 29.03185180709253, - "own_zone": (1034.3523780364185, 1034.3523780364185) + "own_zone": (np.float64(1034.3523780364185), np.float64(1034.3523780364185)) } }, "walk": { @@ -439,42 +496,45 @@ "service": 4.899936388531657, "shops_cbd": 36.161227785768844, "shops_elsewhere": 29.03185180709253, - "own_zone": (1034.3523780364185, 1034.3523780364185) + "own_zone": (np.float64(1034.3523780364185), np.float64(1034.3523780364185)) } } }, "oo": { "car": { "attraction": { - "parking_cost_errand": (-0.12024635638699999, -0.12024635638699999) + "parking_cost_errand": (-0.120246356387, -0.120246356387) }, "impedance": { - "time": (-0.029298148659566002, -0.029298148659566002), - "cost": (-0.32735361630800003, -0.32735361630800003) + "time": (-0.029298148659565995, -0.029298148659565995), + "cost": (-0.327353616308, -0.327353616308) }, "log": { "size": 1.0 }, "size": { "population": 1.0, - "service": 6.630673698198112, + "service": 6.630673698198111, "shops": 56.02846477957964, - "area": 8143.054966843178 + "zone_area": 8143.054966843192 } }, "transit": { "impedance": { - "cost": (-0.32735361630800003, -0.32735361630800003), - "time": (-0.0231941928793, -0.0231941928793) + "cost": (-0.327353616308, -0.327353616308), + "time": -0.0231941928793 }, "log": { "size": 1.0 }, "size": { "population": 1.0, - "service": 6.630673698198112, + "service": 6.630673698198111, "shops": 56.02846477957964, - "area": 8143.054966843178 + "zone_area": 8143.054966843192 + }, + "attraction": { + } }, "bike": { @@ -486,9 +546,12 @@ }, "size": { "population": 1.0, - "service": 6.630673698198112, + "service": 6.630673698198111, "shops": 56.02846477957964, - "area": 8143.054966843178 + "zone_area": 8143.054966843192 + }, + "attraction": { + } }, "walk": { @@ -500,9 +563,12 @@ }, "size": { "population": 1.0, - "service": 6.630673698198112, + "service": 6.630673698198111, "shops": 56.02846477957964, - "area": 8143.054966843178 + "zone_area": 8143.054966843192 + }, + "attraction": { + } } }, @@ -684,7 +750,7 @@ "size": { "population": 1, "workplaces": 3.548453112443126, - "shops_cbd": (2.9726339946617237, 441.17800200345823), + "shops_cbd": (np.float64(2.9726339946617237), np.float64(441.17800200345823)), "shops_elsewhere": 13.766802535817257 } }, diff --git a/Scripts/parameters/mode_choice.py b/Scripts/parameters/mode_choice.py index ef596f1e..423f4344 100644 --- a/Scripts/parameters/mode_choice.py +++ b/Scripts/parameters/mode_choice.py @@ -8,31 +8,74 @@ "hw": { "car": { "generation": { - "car_density": (1.2250392848606655, 1.2250392848606655) + "car_density": (1.2250392848606657, 1.2250392848606657) }, "individual_dummy": { "car_users": (4.00815837105, 4.00815837105) }, "log": { - "logsum": 0.9019259612739999 + "logsum": 0.901925961274 + }, + "constant": (0.0, 0.0), + "attraction": { + + }, + "impedance": { + } }, "transit": { "constant": (4.069975274649584, 4.069975274649584), "log": { - "logsum": 0.9019259612739999 + "logsum": 0.901925961274 + }, + "generation": { + + }, + "attraction": { + + }, + "impedance": { + + }, + "individual_dummy": { + } }, "bike": { "constant": (2.912968477866267, 2.912968477866267), "log": { - "logsum": 0.9019259612739999 + "logsum": 0.901925961274 + }, + "generation": { + + }, + "attraction": { + + }, + "impedance": { + + }, + "individual_dummy": { + } }, "walk": { - "constant": (4.782333281438626, 4.782333281438626), + "constant": (4.782333281438627, 4.782333281438627), "log": { - "logsum": 0.9019259612739999 + "logsum": 0.901925961274 + }, + "generation": { + + }, + "attraction": { + + }, + "impedance": { + + }, + "individual_dummy": { + } } }, @@ -43,24 +86,70 @@ }, "log": { "logsum": 0.253613771543 + }, + "constant": (0.0, 0.0), + "attraction": { + + }, + "impedance": { + + }, + "individual_dummy": { + } }, "transit": { "constant": (2.830426833903452, 2.830426833903452), "log": { "logsum": 0.253613771543 + }, + "generation": { + + }, + "attraction": { + + }, + "impedance": { + + }, + "individual_dummy": { + } }, "bike": { "constant": (2.4845082618272936, 2.4845082618272936), "log": { "logsum": 0.253613771543 + }, + "generation": { + + }, + "attraction": { + + }, + "impedance": { + + }, + "individual_dummy": { + } }, "walk": { "constant": (3.162473568883928, 3.162473568883928), "log": { "logsum": 0.253613771543 + }, + "generation": { + + }, + "attraction": { + + }, + "impedance": { + + }, + "individual_dummy": { + } } }, @@ -71,24 +160,70 @@ }, "log": { "logsum": 1.0 + }, + "constant": (0.0, 0.0), + "attraction": { + + }, + "impedance": { + + }, + "individual_dummy": { + } }, "transit": { - "constant": (4.197980940369999, 4.197980940369999), + "constant": (4.19798094037, 4.19798094037), "log": { "logsum": 1.0 + }, + "generation": { + + }, + "attraction": { + + }, + "impedance": { + + }, + "individual_dummy": { + } }, "bike": { - "constant": (2.7288299967299996, 2.7288299967299996), + "constant": (2.72882999673, 2.72882999673), "log": { "logsum": 1.0 + }, + "generation": { + + }, + "attraction": { + + }, + "impedance": { + + }, + "individual_dummy": { + } }, "walk": { "constant": (4.20886869795, 4.20886869795), "log": { "logsum": 1.0 + }, + "generation": { + + }, + "attraction": { + + }, + "impedance": { + + }, + "individual_dummy": { + } } }, @@ -102,24 +237,67 @@ }, "log": { "logsum": 0.557198870792 + }, + "constant": (0.0, 0.0), + "attraction": { + + }, + "impedance": { + } }, "transit": { - "constant": (3.9577080672768545, 3.9577080672768545), + "constant": (3.9577080672768554, 3.9577080672768554), "log": { "logsum": 0.557198870792 + }, + "generation": { + + }, + "attraction": { + + }, + "impedance": { + + }, + "individual_dummy": { + } }, "bike": { "constant": (2.3017199560405333, 2.3017199560405333), "log": { "logsum": 0.557198870792 + }, + "generation": { + + }, + "attraction": { + + }, + "impedance": { + + }, + "individual_dummy": { + } }, "walk": { "constant": (4.659707430419396, 4.659707430419396), "log": { "logsum": 0.557198870792 + }, + "generation": { + + }, + "attraction": { + + }, + "impedance": { + + }, + "individual_dummy": { + } } }, @@ -130,24 +308,70 @@ }, "log": { "logsum": 0.0331041833915 + }, + "constant": (0.0, 0.0), + "generation": { + + }, + "attraction": { + + }, + "impedance": { + } }, "transit": { "constant": (1.3034795000580932, 1.3034795000580932), "log": { "logsum": 0.0331041833915 + }, + "generation": { + + }, + "attraction": { + + }, + "impedance": { + + }, + "individual_dummy": { + } }, "bike": { "constant": (0.8629432015400033, 0.8629432015400033), "log": { "logsum": 0.0331041833915 + }, + "generation": { + + }, + "attraction": { + + }, + "impedance": { + + }, + "individual_dummy": { + } }, "walk": { "constant": (3.054667882518675, 3.054667882518675), "log": { "logsum": 0.0331041833915 + }, + "generation": { + + }, + "attraction": { + + }, + "impedance": { + + }, + "individual_dummy": { + } } }, @@ -235,24 +459,70 @@ }, "log": { "logsum": 0.560117105619 + }, + "constant": (0.0, 0.0), + "attraction": { + + }, + "impedance": { + + }, + "individual_dummy": { + } }, "transit": { "constant": (2.134266766251907, 2.134266766251907), "log": { "logsum": 0.560117105619 + }, + "generation": { + + }, + "attraction": { + + }, + "impedance": { + + }, + "individual_dummy": { + } }, "bike": { "constant": (-0.28735110033777433, -0.28735110033777433), "log": { "logsum": 0.560117105619 + }, + "generation": { + + }, + "attraction": { + + }, + "impedance": { + + }, + "individual_dummy": { + } }, "walk": { - "constant": (4.023706009091386, 4.023706009091386), + "constant": (4.023706009091387, 4.023706009091387), "log": { "logsum": 0.560117105619 + }, + "generation": { + + }, + "attraction": { + + }, + "impedance": { + + }, + "individual_dummy": { + } } }, diff --git a/Scripts/parameters/tour_generation.py b/Scripts/parameters/tour_generation.py index b397f296..298540a0 100644 --- a/Scripts/parameters/tour_generation.py +++ b/Scripts/parameters/tour_generation.py @@ -10,7 +10,7 @@ 3: 1.05446538, 4: 1.2455917 + 0.1043963, } -# Tour combinations (generated) +# Tour combinations (calibrated) tour_combinations = { 0: { (): { diff --git a/Scripts/tests/integration/test_models.py b/Scripts/tests/integration/test_models.py index 600099eb..492f1875 100644 --- a/Scripts/tests/integration/test_models.py +++ b/Scripts/tests/integration/test_models.py @@ -53,7 +53,7 @@ def test_models(self): self._validate_impedances(impedance["iht"]) # Check that model result does not change - self.assertAlmostEquals(model.mode_share[0]["car"], 0.2208946494559418) + self.assertAlmostEquals(model.mode_share[0]["car"], 0.3607218819661421) print("Model system test done")