Skip to content

Commit

Permalink
Feat/601 create sandbox example input for adaptation run (#645)
Browse files Browse the repository at this point in the history
* chore: extend config and reader

* chore: add/correct attributes of config data

* chore: extend reader with options

* Folder structure with input files

* Removing adaptation option input and changing the config file

* Changes to input structure

* Putting input data in the correct location and changes to folder names

* chore: add adaptation property and extend test

* chore: first changes

* chore: add adaptation to enum

* chore: extend classes

* chore: put adaptation in separate enum

* chore: add get_analysis

* chore: remove no_intervention from config

* chore: rename no_intervention to no_adaptation

* Delete ra2ce/analysis/adaptation/adaptation_option_collection.py

* chore: restore no_adaptation_option

* chore: expand logic and add tests

* chore: add losses analysis name to config

* chore: take losses_analysis from config

* chore: fix test

* test: add tests

* chore: fix logic for paths

* chore: small changes

* test: add test data

* chore: small change of folders

* chore: small changes to paths

* chore: small ini change

* chore: typo

* chore: create class and extend factory

* test: fix failing tests

* chore: remove VAT

* chore: add cost calculation

* chore: process review comments

* chore: process review comments

* merge master

* chore: fix issues

* chore: fix test

* updated example, output_graph folder updated

* test: add output_graph files

* test: remove test

* Changes to the notebook

* chore: process review comments

* chore: add base_network in the factory

* chore: add cost calculation

* chore: rename collection attribute

* chore: small changes

* chore: add calculate to collectino

* chore: add root_path

* test: extend conftest

* test: move test input

* chore: add path properties to adaptation_option

* chore: first damages setup

* test: fix/extend tests

* chore: add aggregate_wl to config

* chore: add losses (start)

* chore: big overhaul of the creation of adaptation options

* chore: add docstring

* chore: remove unused imports

* test: fix losses input paths

* chore: fix losses run

* chore: small cleanup

* chore: small changes, add docstring

* chore: fix tests

* chore: small changes

* test: adapt losses configs

* chore: restore graph_file_hazard

* chore: copy static folder as well for avg_speed

* chore: add hazard section with wl_aggregate

* Changes to notebook and input folder structure

* test: correct name of resilience_curve csv

* updated network in test data

* change in naming

* added parameters in the lossess section

* Folder structure revised

* chore: calculate benefit for options

* chore: final changes

* chore: add TODOs

* chore: change readers into dataclasses

* chore: add expected total cost (for now based on unit cost only)

* chore: process rework

* chore/add input files for notebook

* chore/git add ini file

* chore/git add ini file

* chore/add all data for example adaptation

* chore/update notebook and data

* chore/update notebook

* chore/apply review suggestions

* commit notebook again

* chore/remove output test file

* add files to run analysis and losses

* add output_path to Adaptation class

* clear output

* chore/fix notebook

---------

Co-authored-by: Ardt Klapwijk <[email protected]>
Co-authored-by: Cham8920 <[email protected]>
Co-authored-by: Ardt Klapwijk <[email protected]>
  • Loading branch information
4 people authored Dec 11, 2024
1 parent 37ab5eb commit 5103791
Show file tree
Hide file tree
Showing 7 changed files with 650 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
depth;damage
cm;% of total construction costs
0;0
100;0.1
200;0.2
400;0.4
800;0.8
12000;1
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Road_type \ lanes;1;2;3;4;5
unit;euro/m;euro/m;euro/m;euro/m;euro/m
tertiary_link;110;120;130;140;150
tertiary;110;120;130;140;150
secondary_link;11;12;13;14;15
secondary;11;12;13;14;15
residential;1100;1200;1300;1400;1500
['tertiary', 'residential'];510;520;530;540;550
25 changes: 25 additions & 0 deletions examples/data/adaptation/input/resilience_curve.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
link_type_hazard_intensity;duration_steps;functionality_loss_ratio
secondary_0.0-0.2;[1.0];[0.05]
secondary_0.2-0.5;[1, 2.5];[0.125, 0.05]
secondary_0.5-1.5;[2.5, 5, 7.5];[0.375, 0.25, 0.125]
secondary_1.5-9999.0;[7.5, 9, 10];[0.5, 0.45, 0.375]
secondary_link_0.0-0.2;[1.0];[0.05]
secondary_link_0.2-0.5;[1, 2.5];[0.125, 0.05]
secondary_link_0.5-1.5;[2.5, 5, 7.5];[0.375, 0.25, 0.125]
secondary_link_1.5-9999.0;[7.5, 9, 10];[0.5, 0.45, 0.375]
tertiary_0.0-0.2;[2.0];[0.1]
tertiary_0.2-0.5;[2, 5];[0.25, 0.1]
tertiary_0.5-1.5;[5, 10, 15];[0.75, 0.5, 0.25]
tertiary_1.5-9999.0;[15, 18, 20];[1, 0.9, 0.75]
tertiary_link_0.0-0.2;[2.0];[0.1]
tertiary_link_0.2-0.5;[2, 5];[0.25, 0.1]
tertiary_link_0.5-1.5;[5, 10, 15];[0.75, 0.5, 0.25]
tertiary_link_1.5-9999.0;[15, 18, 20];[1, 0.9, 0.75]
trunk_0.0-0.2;[3.0];[0.2]
trunk_0.2-0.5;[3, 7.5];[0.5, 0.2]
trunk_0.5-1.5;[7.5, 15, 22.5];[0.7, 0.6, 0.5]
trunk_1.5-9999.0;[22.5, 27, 30];[1, 0.95, 0.7]
trunk_link_0.0-0.2;[3.0];[0.2]
trunk_link_0.2-0.5;[3, 7.5];[0.5, 0.2]
trunk_link_0.5-1.5;[7.5, 15, 22.5];[0.7, 0.6, 0.5]
trunk_link_1.5-9999.0;[22.5, 27, 30];[1, 0.95, 0.7]
273 changes: 273 additions & 0 deletions examples/data/adaptation/input/traffic_intensities.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,273 @@
ID,evening_peak_total,evening_peak_freight,evening_peak_commute,evening_peak_business,evening_peak_other,day_freight,day_commute,day_business,day_other,day_total
0,0,0,0,0,0,15,31,66,44,156
1,0,0,0,0,0,90,22,95,98,305
2,0,0,0,0,0,28,29,18,13,88
3,0,0,0,0,0,41,92,64,52,249
4,0,0,0,0,0,93,31,17,14,155
5,0,0,0,0,0,47,53,39,49,188
6,0,0,0,0,0,33,97,31,48,209
7,0,0,0,0,0,40,98,82,41,261
8,0,0,0,0,0,37,70,70,47,224
9,0,0,0,0,0,18,24,93,54,189
10,0,0,0,0,0,35,58,89,40,222
11,0,0,0,0,0,58,67,80,31,236
12,0,0,0,0,0,57,76,73,85,291
13,0,0,0,0,0,30,94,98,51,273
14,0,0,0,0,0,24,14,53,16,107
15,0,0,0,0,0,74,66,21,24,185
16,0,0,0,0,0,30,97,57,30,214
17,0,0,0,0,0,69,30,99,19,217
18,0,0,0,0,0,88,94,58,65,305
19,0,0,0,0,0,22,71,85,80,258
20,0,0,0,0,0,78,19,51,71,219
21,0,0,0,0,0,88,83,76,100,347
22,0,0,0,0,0,43,90,26,43,202
23,0,0,0,0,0,34,89,15,52,190
24,0,0,0,0,0,73,67,30,39,209
25,0,0,0,0,0,32,22,29,67,150
26,0,0,0,0,0,19,42,35,90,186
27,0,0,0,0,0,82,17,76,93,268
28,0,0,0,0,0,28,63,42,100,233
29,0,0,0,0,0,76,27,57,88,248
30,0,0,0,0,0,12,90,55,86,243
31,0,0,0,0,0,17,15,63,45,140
32,0,0,0,0,0,60,76,43,21,200
33,0,0,0,0,0,77,26,34,26,163
34,0,0,0,0,0,34,35,85,94,248
35,0,0,0,0,0,72,22,34,49,177
36,0,0,0,0,0,84,11,57,15,167
37,0,0,0,0,0,59,53,19,34,165
38,0,0,0,0,0,48,11,80,24,163
39,0,0,0,0,0,38,77,47,40,202
40,0,0,0,0,0,56,10,50,81,197
41,0,0,0,0,0,36,64,44,89,233
42,0,0,0,0,0,89,49,75,35,248
43,0,0,0,0,0,73,12,39,75,199
44,0,0,0,0,0,64,62,49,27,202
45,0,0,0,0,0,38,29,10,38,115
46,0,0,0,0,0,46,71,54,31,202
47,0,0,0,0,0,54,35,56,11,156
48,0,0,0,0,0,34,81,94,31,240
49,0,0,0,0,0,31,89,30,51,201
50,0,0,0,0,0,64,28,63,11,166
51,0,0,0,0,0,85,86,45,24,240
52,0,0,0,0,0,14,49,84,40,187
53,0,0,0,0,0,42,39,45,38,164
54,0,0,0,0,0,48,68,83,22,221
55,0,0,0,0,0,77,77,82,73,309
56,0,0,0,0,0,10,26,12,67,115
57,0,0,0,0,0,37,73,54,80,244
58,0,0,0,0,0,27,86,88,60,261
59,0,0,0,0,0,36,51,38,69,194
60,0,0,0,0,0,67,74,93,67,301
61,0,0,0,0,0,53,96,45,26,220
62,0,0,0,0,0,64,96,17,21,198
63,0,0,0,0,0,31,22,84,94,231
64,0,0,0,0,0,22,72,28,80,202
65,0,0,0,0,0,72,51,86,89,298
66,0,0,0,0,0,91,22,94,53,260
67,0,0,0,0,0,95,23,92,99,309
68,0,0,0,0,0,10,100,40,19,169
69,0,0,0,0,0,82,56,49,99,286
70,0,0,0,0,0,85,59,46,45,235
71,0,0,0,0,0,22,63,12,90,187
72,0,0,0,0,0,36,65,30,41,172
73,0,0,0,0,0,38,33,93,64,228
74,0,0,0,0,0,55,62,52,57,226
75,0,0,0,0,0,36,99,18,48,201
76,0,0,0,0,0,79,59,43,18,199
77,0,0,0,0,0,19,51,99,25,194
78,0,0,0,0,0,73,84,73,12,242
79,0,0,0,0,0,20,96,36,65,217
80,0,0,0,0,0,84,94,86,30,294
81,0,0,0,0,0,62,43,17,92,214
82,0,0,0,0,0,55,23,87,65,230
83,0,0,0,0,0,37,62,53,39,191
84,0,0,0,0,0,85,65,66,78,294
85,0,0,0,0,0,56,39,53,48,196
86,0,0,0,0,0,99,52,33,88,272
87,0,0,0,0,0,64,94,29,76,263
88,0,0,0,0,0,61,80,63,21,225
89,0,0,0,0,0,85,85,61,63,294
90,0,0,0,0,0,54,85,48,90,277
91,0,0,0,0,0,70,16,74,78,238
92,0,0,0,0,0,17,45,15,55,132
93,0,0,0,0,0,90,95,26,75,286
94,0,0,0,0,0,80,55,12,78,225
95,0,0,0,0,0,38,71,48,87,244
96,0,0,0,0,0,56,40,19,35,150
97,0,0,0,0,0,63,21,81,74,239
98,0,0,0,0,0,44,47,84,12,187
99,0,0,0,0,0,78,24,97,52,251
100,0,0,0,0,0,26,59,58,34,177
101,0,0,0,0,0,73,48,33,46,200
102,0,0,0,0,0,62,100,39,78,279
103,0,0,0,0,0,63,78,39,51,231
104,0,0,0,0,0,19,49,84,10,162
105,0,0,0,0,0,44,65,28,52,189
106,0,0,0,0,0,35,92,23,74,224
107,0,0,0,0,0,48,56,71,66,241
108,0,0,0,0,0,31,35,80,96,242
109,0,0,0,0,0,39,26,79,77,221
110,0,0,0,0,0,90,76,49,90,305
111,0,0,0,0,0,35,68,36,79,218
112,0,0,0,0,0,23,61,62,92,238
113,0,0,0,0,0,49,36,32,96,213
114,0,0,0,0,0,79,16,61,55,211
115,0,0,0,0,0,35,17,28,61,141
116,0,0,0,0,0,86,99,54,28,267
117,0,0,0,0,0,87,99,80,50,316
118,0,0,0,0,0,37,16,47,49,149
119,0,0,0,0,0,80,63,43,30,216
120,0,0,0,0,0,97,90,74,29,290
121,0,0,0,0,0,89,83,13,41,226
122,0,0,0,0,0,52,96,32,100,280
123,0,0,0,0,0,11,86,39,98,234
124,0,0,0,0,0,32,79,45,79,235
125,0,0,0,0,0,39,37,56,99,231
126,0,0,0,0,0,34,59,50,32,175
127,0,0,0,0,0,34,63,30,45,172
128,0,0,0,0,0,80,69,17,51,217
129,0,0,0,0,0,60,73,71,94,298
130,0,0,0,0,0,77,69,91,29,266
131,0,0,0,0,0,40,60,13,47,160
132,0,0,0,0,0,78,85,31,36,230
133,0,0,0,0,0,14,65,68,30,177
134,0,0,0,0,0,71,47,97,29,244
135,0,0,0,0,0,26,96,78,31,231
136,0,0,0,0,0,27,19,48,49,143
137,0,0,0,0,0,18,36,34,80,168
138,0,0,0,0,0,76,95,28,20,219
139,0,0,0,0,0,14,81,66,88,249
140,0,0,0,0,0,13,83,18,83,197
141,0,0,0,0,0,53,83,23,96,255
142,0,0,0,0,0,56,87,32,96,271
143,0,0,0,0,0,30,79,69,89,267
144,0,0,0,0,0,45,77,81,44,247
145,0,0,0,0,0,23,73,84,20,200
146,0,0,0,0,0,14,94,89,91,288
147,0,0,0,0,0,10,90,18,38,156
148,0,0,0,0,0,81,67,37,40,225
149,0,0,0,0,0,32,31,44,15,122
150,0,0,0,0,0,97,31,26,37,191
151,0,0,0,0,0,31,21,25,42,119
152,0,0,0,0,0,83,20,11,21,135
153,0,0,0,0,0,44,11,82,94,231
154,0,0,0,0,0,20,73,100,38,231
155,0,0,0,0,0,61,36,53,93,243
156,0,0,0,0,0,98,50,90,45,283
157,0,0,0,0,0,79,36,38,15,168
158,0,0,0,0,0,19,37,82,75,213
159,0,0,0,0,0,100,84,30,41,255
160,0,0,0,0,0,38,83,78,55,254
161,0,0,0,0,0,41,40,65,52,198
162,0,0,0,0,0,70,82,65,14,231
163,0,0,0,0,0,94,23,28,96,241
164,0,0,0,0,0,19,59,93,11,182
165,0,0,0,0,0,54,81,72,94,301
166,0,0,0,0,0,81,98,49,28,256
167,0,0,0,0,0,28,71,86,94,279
168,0,0,0,0,0,13,100,83,99,295
169,0,0,0,0,0,37,52,64,16,169
170,0,0,0,0,0,40,43,87,52,222
171,0,0,0,0,0,33,55,36,70,194
172,0,0,0,0,0,59,47,48,78,232
173,0,0,0,0,0,70,57,26,26,179
174,0,0,0,0,0,63,44,40,67,214
175,0,0,0,0,0,14,25,28,87,154
176,0,0,0,0,0,39,15,69,68,191
177,0,0,0,0,0,14,21,100,38,173
178,0,0,0,0,0,23,85,30,92,230
179,0,0,0,0,0,48,16,12,67,143
180,0,0,0,0,0,97,93,74,60,324
181,0,0,0,0,0,53,17,86,94,250
182,0,0,0,0,0,36,28,12,71,147
183,0,0,0,0,0,86,11,89,28,214
184,0,0,0,0,0,15,72,35,95,217
185,0,0,0,0,0,21,100,37,58,216
186,0,0,0,0,0,38,74,54,56,222
187,0,0,0,0,0,87,63,70,97,317
188,0,0,0,0,0,80,56,60,92,288
189,0,0,0,0,0,54,77,76,15,222
190,0,0,0,0,0,90,51,26,84,251
191,0,0,0,0,0,55,44,49,31,179
192,0,0,0,0,0,42,44,44,59,189
193,0,0,0,0,0,90,88,93,33,304
194,0,0,0,0,0,35,34,45,88,202
195,0,0,0,0,0,38,60,15,36,149
196,0,0,0,0,0,29,31,83,54,197
197,0,0,0,0,0,67,62,70,40,239
198,0,0,0,0,0,93,10,51,30,184
199,0,0,0,0,0,73,61,94,38,266
200,0,0,0,0,0,47,25,87,52,211
201,0,0,0,0,0,27,34,71,22,154
202,0,0,0,0,0,32,45,70,97,244
203,0,0,0,0,0,47,62,29,58,196
204,0,0,0,0,0,25,89,30,35,179
205,0,0,0,0,0,37,12,39,69,157
206,0,0,0,0,0,72,31,29,73,205
207,0,0,0,0,0,62,99,13,31,205
208,0,0,0,0,0,82,13,77,15,187
209,0,0,0,0,0,66,98,34,53,251
210,0,0,0,0,0,36,43,30,64,173
211,0,0,0,0,0,61,86,47,85,279
212,0,0,0,0,0,18,98,59,45,220
213,0,0,0,0,0,95,83,52,26,256
214,0,0,0,0,0,45,93,60,15,213
215,0,0,0,0,0,87,17,40,57,201
216,0,0,0,0,0,59,84,77,29,249
217,0,0,0,0,0,10,92,47,59,208
218,0,0,0,0,0,64,32,89,21,206
219,0,0,0,0,0,92,23,61,38,214
220,0,0,0,0,0,25,78,40,18,161
221,0,0,0,0,0,81,85,86,62,314
222,0,0,0,0,0,10,52,15,23,100
223,0,0,0,0,0,78,33,15,81,207
224,0,0,0,0,0,16,95,85,82,278
225,0,0,0,0,0,100,18,40,27,185
226,0,0,0,0,0,74,15,24,53,166
227,0,0,0,0,0,29,23,15,39,106
228,0,0,0,0,0,55,45,44,23,167
229,0,0,0,0,0,31,69,56,28,184
230,0,0,0,0,0,14,57,56,59,186
231,0,0,0,0,0,61,62,51,37,211
232,0,0,0,0,0,81,70,98,32,281
233,0,0,0,0,0,42,90,68,24,224
234,0,0,0,0,0,68,19,69,35,191
235,0,0,0,0,0,59,100,34,44,237
236,0,0,0,0,0,52,32,62,29,175
237,0,0,0,0,0,68,97,31,40,236
238,0,0,0,0,0,79,21,89,60,249
239,0,0,0,0,0,72,53,81,76,282
240,0,0,0,0,0,68,16,22,42,148
241,0,0,0,0,0,38,19,15,11,83
242,0,0,0,0,0,81,78,63,99,321
243,0,0,0,0,0,50,95,85,17,247
244,0,0,0,0,0,90,18,95,57,260
245,0,0,0,0,0,64,48,35,85,232
246,0,0,0,0,0,83,10,65,43,201
247,0,0,0,0,0,59,58,48,14,179
248,0,0,0,0,0,36,27,98,25,186
249,0,0,0,0,0,25,61,52,62,200
250,0,0,0,0,0,68,43,92,22,225
251,0,0,0,0,0,44,85,54,42,225
252,0,0,0,0,0,31,66,27,24,148
253,0,0,0,0,0,63,34,45,89,231
254,0,0,0,0,0,69,76,24,81,250
255,0,0,0,0,0,83,73,72,28,256
256,0,0,0,0,0,32,82,29,61,204
257,0,0,0,0,0,10,54,92,73,229
258,0,0,0,0,0,86,66,82,95,329
259,0,0,0,0,0,43,43,59,31,176
260,0,0,0,0,0,64,71,85,61,281
261,0,0,0,0,0,43,50,10,79,182
262,0,0,0,0,0,38,14,67,63,182
263,0,0,0,0,0,42,77,83,35,237
264,0,0,0,0,0,44,72,97,38,251
265,0,0,0,0,0,74,26,90,96,286
266,0,0,0,0,0,55,16,12,50,133
267,0,0,0,0,0,53,99,76,42,270
268,0,0,0,0,0,88,81,15,64,248
269,0,0,0,0,0,46,70,37,37,190
270,0,0,0,0,0,33,37,87,34,191
271,0,0,0,0,0,30,40,90,30,190
5 changes: 5 additions & 0 deletions examples/data/adaptation/input/values_of_time.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
trip_types;value_of_time;occupants
business;20;2
commute;10;3
freight;200;1
other;100;20
Loading

0 comments on commit 5103791

Please sign in to comment.