Package: sumo / 1.18.0+dfsg-4

python3.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
8315
8316
8317
8318
8319
8320
8321
8322
8323
8324
8325
8326
8327
8328
8329
8330
8331
8332
8333
8334
8335
8336
8337
8338
8339
8340
8341
8342
8343
8344
8345
8346
8347
8348
8349
8350
8351
8352
8353
8354
8355
8356
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8384
8385
8386
8387
8388
8389
8390
8391
8392
8393
8394
8395
8396
8397
8398
8399
8400
8401
8402
8403
8404
8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
8419
8420
8421
8422
8423
8424
8425
8426
8427
8428
8429
8430
8431
8432
8433
8434
8435
8436
8437
8438
8439
8440
8441
8442
8443
8444
8445
8446
8447
8448
8449
8450
8451
8452
8453
8454
8455
8456
8457
8458
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
8473
8474
8475
8476
8477
8478
8479
8480
8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8496
8497
8498
8499
8500
8501
8502
8503
8504
8505
8506
8507
8508
8509
8510
8511
8512
8513
8514
8515
8516
8517
8518
8519
8520
8521
8522
8523
8524
8525
8526
8527
8528
8529
8530
8531
8532
8533
8534
8535
8536
8537
8538
8539
8540
8541
8542
8543
8544
8545
8546
8547
8548
8549
8550
8551
8552
8553
8554
8555
8556
8557
8558
8559
8560
8561
8562
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
8590
8591
8592
8593
8594
8595
8596
8597
8598
8599
8600
8601
8602
8603
8604
8605
8606
8607
8608
8609
8610
8611
8612
8613
8614
8615
8616
8617
8618
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
8641
8642
8643
8644
8645
8646
8647
8648
8649
8650
8651
8652
8653
8654
8655
8656
8657
8658
8659
8660
8661
8662
8663
8664
8665
8666
8667
8668
8669
8670
8671
8672
8673
8674
8675
8676
8677
8678
8679
8680
8681
8682
8683
8684
8685
8686
8687
8688
8689
8690
8691
8692
8693
8694
8695
8696
8697
8698
8699
8700
8701
8702
8703
8704
8705
8706
8707
8708
8709
8710
8711
8712
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740
8741
8742
8743
8744
8745
8746
8747
8748
8749
8750
8751
8752
8753
8754
8755
8756
8757
8758
8759
8760
8761
8762
8763
8764
8765
8766
8767
8768
8769
8770
8771
8772
8773
8774
8775
8776
8777
8778
8779
8780
8781
8782
8783
8784
8785
8786
8787
8788
8789
8790
8791
8792
8793
8794
8795
8796
8797
8798
8799
8800
8801
8802
8803
8804
8805
8806
8807
8808
8809
8810
8811
8812
8813
8814
8815
8816
8817
8818
8819
8820
8821
8822
8823
8824
8825
8826
8827
8828
8829
8830
8831
8832
8833
8834
8835
8836
8837
8838
8839
8840
8841
8842
8843
8844
8845
8846
8847
8848
8849
8850
8851
8852
8853
8854
8855
8856
8857
8858
8859
8860
8861
8862
8863
8864
8865
8866
8867
8868
8869
8870
8871
8872
8873
8874
8875
8876
8877
8878
8879
8880
8881
8882
8883
8884
8885
8886
8887
8888
8889
8890
8891
8892
8893
8894
8895
8896
8897
8898
8899
8900
8901
8902
8903
8904
8905
8906
8907
8908
8909
8910
8911
8912
8913
8914
8915
8916
8917
8918
8919
8920
8921
8922
8923
8924
8925
8926
8927
8928
8929
8930
8931
8932
8933
8934
8935
8936
8937
8938
8939
8940
8941
8942
8943
8944
8945
8946
8947
8948
8949
8950
8951
8952
8953
8954
8955
8956
8957
8958
8959
8960
8961
8962
8963
8964
8965
8966
8967
8968
8969
8970
8971
8972
8973
8974
8975
8976
8977
8978
8979
8980
8981
8982
8983
8984
8985
8986
8987
8988
8989
8990
8991
8992
8993
8994
8995
8996
8997
8998
8999
9000
9001
9002
9003
9004
9005
9006
9007
9008
9009
9010
9011
9012
9013
9014
9015
9016
9017
9018
9019
9020
9021
9022
9023
9024
9025
9026
9027
9028
9029
9030
9031
9032
9033
9034
9035
9036
9037
9038
9039
9040
9041
9042
9043
9044
9045
9046
9047
9048
9049
9050
9051
9052
9053
9054
9055
9056
9057
9058
9059
9060
9061
9062
9063
9064
9065
9066
9067
9068
9069
9070
9071
9072
9073
9074
9075
9076
9077
9078
9079
9080
9081
9082
9083
9084
9085
9086
9087
9088
9089
9090
9091
9092
9093
9094
9095
9096
9097
9098
9099
9100
9101
9102
9103
9104
9105
9106
9107
9108
9109
9110
9111
9112
9113
9114
9115
9116
9117
9118
9119
9120
9121
9122
9123
9124
9125
9126
9127
9128
9129
9130
9131
9132
9133
9134
9135
9136
9137
9138
9139
9140
9141
9142
9143
9144
9145
9146
9147
9148
9149
9150
9151
9152
9153
9154
9155
9156
9157
9158
9159
9160
9161
9162
9163
9164
9165
9166
9167
9168
9169
9170
9171
9172
9173
9174
9175
9176
9177
9178
9179
9180
9181
9182
9183
9184
9185
9186
9187
9188
9189
9190
9191
9192
9193
9194
9195
9196
9197
9198
9199
9200
9201
9202
9203
9204
9205
9206
9207
9208
9209
9210
9211
9212
9213
9214
9215
9216
9217
9218
9219
9220
9221
9222
9223
9224
9225
9226
9227
9228
9229
9230
9231
9232
9233
9234
9235
9236
9237
9238
9239
9240
9241
9242
9243
9244
9245
9246
9247
9248
9249
9250
9251
9252
9253
9254
9255
9256
9257
9258
9259
9260
9261
9262
9263
9264
9265
9266
9267
9268
9269
9270
9271
9272
9273
9274
9275
9276
9277
9278
9279
9280
9281
9282
9283
9284
9285
9286
9287
9288
9289
9290
9291
9292
9293
9294
9295
9296
9297
9298
9299
9300
9301
9302
9303
9304
9305
9306
9307
9308
9309
9310
9311
9312
9313
9314
9315
9316
9317
9318
9319
9320
9321
9322
9323
9324
9325
9326
9327
9328
9329
9330
9331
9332
9333
9334
9335
9336
9337
9338
9339
9340
9341
9342
9343
9344
9345
9346
9347
9348
9349
9350
9351
9352
9353
9354
9355
9356
9357
9358
9359
9360
9361
9362
9363
9364
9365
9366
9367
9368
9369
9370
9371
9372
9373
9374
9375
9376
9377
9378
9379
9380
9381
9382
9383
9384
9385
9386
9387
9388
9389
9390
9391
9392
9393
9394
9395
9396
9397
9398
9399
9400
9401
9402
9403
9404
9405
9406
9407
9408
9409
9410
9411
9412
9413
9414
9415
9416
9417
9418
9419
9420
9421
9422
9423
9424
9425
9426
9427
9428
9429
9430
9431
9432
9433
9434
9435
9436
9437
9438
9439
9440
9441
9442
9443
9444
9445
9446
9447
9448
9449
9450
9451
9452
9453
9454
9455
9456
9457
9458
9459
9460
9461
9462
9463
9464
9465
9466
9467
9468
9469
9470
9471
9472
9473
9474
9475
9476
9477
9478
9479
9480
9481
9482
9483
9484
9485
9486
9487
9488
9489
9490
9491
9492
9493
9494
9495
9496
9497
9498
9499
9500
9501
9502
9503
9504
9505
9506
9507
9508
9509
9510
9511
9512
9513
9514
9515
9516
9517
9518
9519
9520
9521
9522
9523
9524
9525
9526
9527
9528
9529
9530
9531
9532
9533
9534
9535
9536
9537
9538
9539
9540
9541
9542
9543
9544
9545
9546
9547
9548
9549
9550
9551
9552
9553
9554
9555
9556
9557
9558
9559
9560
9561
9562
9563
9564
9565
9566
9567
9568
9569
9570
9571
9572
9573
9574
9575
9576
9577
9578
9579
9580
9581
9582
9583
9584
9585
9586
9587
9588
9589
9590
9591
9592
9593
9594
9595
9596
9597
9598
9599
9600
9601
9602
9603
9604
9605
9606
9607
9608
9609
9610
9611
9612
9613
9614
9615
9616
9617
9618
9619
9620
9621
9622
9623
9624
9625
9626
9627
9628
9629
9630
9631
9632
9633
9634
9635
9636
9637
9638
9639
9640
9641
9642
9643
9644
9645
9646
9647
9648
9649
9650
9651
9652
9653
9654
9655
9656
9657
9658
9659
9660
9661
9662
9663
9664
9665
9666
9667
9668
9669
9670
9671
9672
9673
9674
9675
9676
9677
9678
9679
9680
9681
9682
9683
9684
9685
9686
9687
9688
9689
9690
9691
9692
9693
9694
9695
9696
9697
9698
9699
9700
9701
9702
9703
9704
9705
9706
9707
9708
9709
9710
9711
9712
9713
9714
9715
9716
9717
9718
9719
9720
9721
9722
9723
9724
9725
9726
9727
9728
9729
9730
9731
9732
9733
9734
9735
9736
9737
9738
9739
9740
9741
9742
9743
9744
9745
9746
9747
9748
9749
9750
9751
9752
9753
9754
9755
9756
9757
9758
9759
9760
9761
9762
9763
9764
9765
9766
9767
9768
9769
9770
9771
9772
9773
9774
9775
9776
9777
9778
9779
9780
9781
9782
9783
9784
9785
9786
9787
9788
9789
9790
9791
9792
9793
9794
9795
9796
9797
9798
9799
9800
9801
9802
9803
9804
9805
9806
9807
9808
9809
9810
9811
9812
9813
9814
9815
9816
9817
9818
9819
9820
9821
9822
9823
9824
9825
9826
9827
9828
9829
9830
9831
9832
9833
9834
9835
9836
9837
9838
9839
9840
9841
9842
9843
9844
9845
9846
9847
9848
9849
9850
9851
9852
9853
9854
9855
9856
9857
9858
9859
9860
9861
9862
9863
9864
9865
9866
9867
9868
9869
9870
9871
9872
9873
9874
9875
9876
9877
9878
9879
9880
9881
9882
9883
9884
9885
9886
9887
9888
9889
9890
9891
9892
9893
9894
9895
9896
9897
9898
9899
9900
9901
9902
9903
9904
9905
9906
9907
9908
9909
9910
9911
9912
9913
9914
9915
9916
9917
9918
9919
9920
9921
9922
9923
9924
9925
9926
9927
9928
9929
9930
9931
9932
9933
9934
9935
9936
9937
9938
9939
9940
9941
9942
9943
9944
9945
9946
9947
9948
9949
9950
9951
9952
9953
9954
9955
9956
9957
9958
9959
9960
9961
9962
9963
9964
9965
9966
9967
9968
9969
9970
9971
9972
9973
9974
9975
9976
9977
9978
9979
9980
9981
9982
9983
9984
9985
9986
9987
9988
9989
9990
9991
9992
9993
9994
9995
9996
9997
9998
9999
10000
10001
10002
10003
10004
10005
10006
10007
10008
10009
10010
10011
10012
10013
10014
10015
10016
10017
10018
10019
10020
10021
10022
10023
10024
10025
10026
10027
10028
10029
10030
10031
10032
10033
10034
10035
10036
10037
10038
10039
10040
10041
10042
10043
10044
10045
10046
10047
10048
10049
10050
10051
10052
10053
10054
10055
10056
10057
10058
10059
10060
10061
10062
10063
10064
10065
10066
10067
10068
10069
10070
10071
10072
10073
10074
10075
10076
10077
10078
10079
10080
10081
10082
10083
10084
10085
10086
10087
10088
10089
10090
10091
10092
10093
10094
10095
10096
10097
10098
10099
10100
10101
10102
10103
10104
10105
10106
10107
10108
10109
10110
10111
10112
10113
10114
10115
10116
10117
10118
10119
10120
10121
10122
10123
10124
10125
10126
10127
10128
10129
10130
10131
10132
10133
10134
10135
10136
10137
10138
10139
10140
10141
10142
10143
10144
10145
10146
10147
10148
10149
10150
10151
10152
10153
10154
10155
10156
10157
10158
10159
10160
10161
10162
10163
10164
10165
10166
10167
10168
10169
10170
10171
10172
10173
10174
10175
10176
10177
10178
10179
10180
10181
10182
10183
10184
10185
10186
10187
10188
10189
10190
10191
10192
10193
10194
10195
10196
10197
10198
10199
10200
10201
10202
10203
10204
10205
10206
10207
10208
10209
10210
10211
10212
10213
10214
10215
10216
10217
10218
10219
10220
10221
10222
10223
10224
10225
10226
10227
10228
10229
10230
10231
10232
10233
10234
10235
10236
10237
10238
10239
10240
10241
10242
10243
10244
10245
10246
10247
10248
10249
10250
10251
10252
10253
10254
10255
10256
10257
10258
10259
10260
10261
10262
10263
10264
10265
10266
10267
10268
10269
10270
10271
10272
10273
10274
10275
10276
10277
10278
10279
10280
10281
10282
10283
10284
10285
10286
10287
10288
10289
10290
10291
10292
10293
10294
10295
10296
10297
10298
10299
10300
10301
10302
10303
10304
10305
10306
10307
10308
10309
10310
10311
10312
10313
10314
10315
10316
10317
10318
10319
10320
10321
10322
10323
10324
10325
10326
10327
10328
10329
10330
10331
10332
10333
10334
10335
10336
10337
10338
10339
10340
10341
10342
10343
10344
10345
10346
10347
10348
10349
10350
10351
10352
10353
10354
10355
10356
10357
10358
10359
10360
10361
10362
10363
10364
10365
10366
10367
10368
10369
10370
10371
10372
10373
10374
10375
10376
10377
10378
10379
10380
10381
10382
10383
10384
10385
10386
10387
10388
10389
10390
10391
10392
10393
10394
10395
10396
10397
10398
10399
10400
10401
10402
10403
10404
10405
10406
10407
10408
10409
10410
10411
10412
10413
10414
10415
10416
10417
10418
10419
10420
10421
10422
10423
10424
10425
10426
10427
10428
10429
10430
10431
10432
10433
10434
10435
10436
10437
10438
10439
10440
10441
10442
10443
10444
10445
10446
10447
10448
10449
10450
10451
10452
10453
10454
10455
10456
10457
10458
10459
10460
10461
10462
10463
10464
10465
10466
10467
10468
10469
10470
10471
10472
10473
10474
10475
10476
10477
10478
10479
10480
10481
10482
10483
10484
10485
10486
10487
10488
10489
10490
10491
10492
10493
10494
10495
10496
10497
10498
10499
10500
10501
10502
10503
10504
10505
10506
10507
10508
10509
10510
10511
10512
10513
10514
10515
10516
10517
10518
10519
10520
10521
10522
10523
10524
10525
10526
10527
10528
10529
10530
10531
10532
10533
10534
10535
10536
10537
10538
10539
10540
10541
10542
10543
10544
10545
10546
10547
10548
10549
10550
10551
10552
10553
10554
10555
10556
10557
10558
10559
10560
10561
10562
10563
10564
10565
10566
10567
10568
10569
10570
10571
10572
10573
10574
10575
10576
10577
10578
10579
10580
10581
10582
10583
10584
10585
10586
10587
10588
10589
10590
10591
10592
10593
10594
10595
10596
10597
10598
10599
10600
10601
10602
10603
10604
10605
10606
10607
10608
10609
10610
10611
10612
10613
10614
10615
10616
10617
10618
10619
10620
10621
10622
10623
10624
10625
10626
10627
10628
10629
10630
10631
10632
10633
10634
10635
10636
10637
10638
10639
10640
10641
10642
10643
10644
10645
10646
10647
10648
10649
10650
10651
10652
10653
10654
10655
10656
10657
10658
10659
10660
10661
10662
10663
10664
10665
10666
10667
10668
10669
10670
10671
10672
10673
10674
10675
10676
10677
10678
10679
10680
10681
10682
10683
10684
10685
10686
10687
10688
10689
10690
10691
10692
10693
10694
10695
10696
10697
10698
10699
10700
10701
10702
10703
10704
10705
10706
10707
10708
10709
10710
10711
10712
10713
10714
10715
10716
10717
10718
10719
10720
10721
10722
10723
10724
10725
10726
10727
10728
10729
10730
10731
10732
10733
10734
10735
10736
10737
10738
10739
10740
10741
10742
10743
10744
10745
10746
10747
10748
10749
10750
10751
10752
10753
10754
10755
10756
10757
10758
10759
10760
10761
10762
10763
10764
10765
10766
10767
10768
10769
10770
10771
10772
10773
10774
10775
10776
10777
10778
10779
10780
10781
10782
10783
10784
10785
10786
10787
10788
10789
10790
10791
10792
10793
10794
10795
10796
10797
10798
10799
10800
10801
10802
10803
10804
10805
10806
10807
10808
10809
10810
10811
10812
10813
10814
10815
10816
10817
10818
10819
10820
10821
10822
10823
10824
10825
10826
10827
10828
10829
10830
10831
10832
10833
10834
10835
10836
10837
10838
10839
10840
10841
10842
10843
10844
10845
10846
10847
10848
10849
10850
10851
10852
10853
10854
10855
10856
10857
10858
10859
10860
10861
10862
10863
10864
10865
10866
10867
10868
10869
10870
10871
10872
10873
10874
10875
10876
10877
10878
10879
10880
10881
10882
10883
10884
10885
10886
10887
10888
10889
10890
10891
10892
10893
10894
10895
10896
10897
10898
10899
10900
10901
10902
10903
10904
10905
10906
10907
10908
10909
10910
10911
10912
10913
10914
10915
10916
10917
10918
10919
10920
10921
10922
10923
10924
10925
10926
10927
10928
10929
10930
10931
10932
10933
10934
10935
10936
10937
10938
10939
10940
10941
10942
10943
10944
10945
10946
10947
10948
10949
10950
10951
10952
10953
10954
10955
10956
10957
10958
10959
10960
10961
10962
10963
10964
10965
10966
10967
10968
10969
10970
10971
10972
10973
10974
10975
10976
10977
10978
10979
10980
10981
10982
10983
10984
10985
10986
10987
10988
10989
10990
10991
10992
10993
10994
10995
10996
10997
10998
10999
11000
11001
11002
11003
11004
11005
11006
11007
11008
11009
11010
11011
11012
11013
11014
11015
11016
11017
11018
11019
11020
11021
11022
11023
11024
11025
11026
11027
11028
11029
11030
11031
11032
11033
11034
11035
11036
11037
11038
11039
11040
11041
11042
11043
11044
11045
11046
11047
11048
11049
11050
11051
11052
11053
11054
11055
11056
11057
11058
11059
11060
11061
11062
11063
11064
11065
11066
11067
11068
11069
11070
11071
11072
11073
11074
11075
11076
11077
11078
11079
11080
11081
11082
11083
11084
11085
11086
11087
11088
11089
11090
11091
11092
11093
11094
11095
11096
11097
11098
11099
11100
11101
11102
11103
11104
11105
11106
11107
11108
11109
11110
11111
11112
11113
11114
11115
11116
11117
11118
11119
11120
11121
11122
11123
11124
11125
11126
11127
11128
11129
11130
11131
11132
11133
11134
11135
11136
11137
11138
11139
11140
11141
11142
11143
11144
11145
11146
11147
11148
11149
11150
11151
11152
11153
11154
11155
11156
11157
11158
11159
11160
11161
11162
11163
11164
11165
11166
11167
11168
11169
11170
11171
11172
11173
11174
11175
11176
11177
11178
11179
11180
11181
11182
11183
11184
11185
11186
11187
11188
11189
11190
11191
11192
11193
11194
11195
11196
11197
11198
11199
11200
11201
11202
11203
11204
11205
11206
11207
11208
11209
11210
11211
11212
11213
11214
11215
11216
11217
11218
11219
11220
11221
11222
11223
11224
11225
11226
11227
11228
11229
11230
11231
11232
11233
11234
11235
11236
11237
11238
11239
11240
11241
11242
11243
11244
11245
11246
11247
11248
11249
11250
11251
11252
11253
11254
11255
11256
11257
11258
11259
11260
11261
11262
11263
11264
11265
11266
11267
11268
11269
11270
11271
11272
11273
11274
11275
11276
11277
11278
11279
11280
11281
11282
11283
11284
11285
11286
11287
11288
11289
11290
11291
11292
11293
11294
11295
11296
11297
11298
11299
11300
11301
11302
11303
11304
11305
11306
11307
11308
11309
11310
11311
11312
11313
11314
11315
11316
11317
11318
11319
11320
11321
11322
11323
11324
11325
11326
11327
11328
11329
11330
11331
11332
11333
11334
11335
11336
11337
11338
11339
11340
11341
11342
11343
11344
11345
11346
11347
11348
11349
11350
11351
11352
11353
11354
11355
11356
11357
11358
11359
11360
11361
11362
11363
11364
11365
11366
11367
11368
11369
11370
11371
11372
11373
11374
11375
11376
11377
11378
11379
11380
11381
11382
11383
11384
11385
11386
11387
11388
11389
11390
11391
11392
11393
11394
11395
11396
11397
11398
11399
11400
11401
11402
11403
11404
11405
11406
11407
11408
11409
11410
11411
11412
11413
11414
11415
11416
11417
11418
11419
11420
11421
11422
11423
11424
11425
11426
11427
11428
11429
11430
11431
11432
11433
11434
11435
11436
11437
11438
11439
11440
11441
11442
11443
11444
11445
11446
11447
11448
11449
11450
11451
11452
11453
11454
11455
11456
11457
11458
11459
11460
11461
11462
11463
11464
11465
11466
11467
11468
11469
11470
11471
11472
11473
11474
11475
11476
11477
11478
11479
11480
11481
11482
11483
11484
11485
11486
11487
11488
11489
11490
11491
11492
11493
11494
11495
11496
11497
11498
11499
11500
11501
11502
11503
11504
11505
11506
11507
11508
11509
11510
11511
11512
11513
11514
11515
11516
11517
11518
11519
11520
11521
11522
11523
11524
11525
11526
11527
11528
11529
11530
11531
11532
11533
11534
11535
11536
11537
11538
11539
11540
11541
11542
11543
11544
11545
11546
11547
11548
11549
11550
11551
11552
11553
11554
11555
11556
11557
11558
11559
11560
11561
11562
11563
11564
11565
11566
11567
11568
11569
11570
11571
11572
11573
11574
11575
11576
11577
11578
11579
11580
11581
11582
11583
11584
11585
11586
11587
11588
11589
11590
11591
11592
11593
11594
11595
11596
11597
11598
11599
11600
11601
11602
11603
11604
11605
11606
11607
11608
11609
11610
11611
11612
11613
11614
11615
11616
11617
11618
11619
11620
11621
11622
11623
11624
11625
11626
11627
11628
11629
11630
11631
11632
11633
11634
11635
11636
11637
11638
11639
11640
11641
11642
11643
11644
11645
11646
11647
11648
11649
11650
11651
11652
11653
11654
11655
11656
11657
11658
11659
11660
11661
11662
11663
11664
11665
11666
11667
11668
11669
11670
11671
11672
11673
11674
11675
11676
11677
11678
11679
11680
11681
11682
11683
11684
11685
11686
11687
11688
11689
11690
11691
11692
11693
11694
11695
11696
11697
11698
11699
11700
11701
11702
11703
11704
11705
11706
11707
11708
11709
11710
11711
11712
11713
11714
11715
11716
11717
11718
11719
11720
11721
11722
11723
11724
11725
11726
11727
11728
11729
11730
11731
11732
11733
11734
11735
11736
11737
11738
11739
11740
11741
11742
11743
11744
11745
11746
11747
11748
11749
11750
11751
11752
11753
11754
11755
11756
11757
11758
11759
11760
11761
11762
11763
11764
11765
11766
11767
11768
11769
11770
11771
11772
11773
11774
11775
11776
11777
11778
11779
11780
11781
11782
11783
11784
11785
11786
11787
11788
11789
11790
11791
11792
11793
11794
11795
11796
11797
11798
11799
11800
11801
11802
11803
11804
11805
11806
11807
11808
11809
11810
11811
11812
11813
11814
11815
11816
11817
11818
11819
11820
11821
11822
11823
11824
11825
11826
11827
11828
11829
11830
11831
11832
11833
11834
11835
11836
11837
11838
11839
11840
11841
11842
11843
11844
11845
11846
11847
11848
11849
11850
11851
11852
11853
11854
11855
11856
11857
11858
11859
11860
11861
11862
11863
11864
11865
11866
11867
11868
11869
11870
11871
11872
11873
11874
11875
11876
11877
11878
11879
11880
11881
11882
11883
11884
11885
11886
11887
11888
11889
11890
11891
11892
11893
11894
11895
11896
11897
11898
11899
11900
11901
11902
11903
11904
11905
11906
11907
11908
11909
11910
11911
11912
11913
11914
11915
11916
11917
11918
11919
11920
11921
11922
11923
11924
11925
11926
11927
11928
11929
11930
11931
11932
11933
11934
11935
11936
11937
11938
11939
11940
11941
11942
11943
11944
11945
11946
11947
11948
11949
11950
11951
11952
11953
11954
11955
11956
11957
11958
11959
11960
11961
11962
11963
11964
11965
11966
11967
11968
11969
11970
11971
11972
11973
11974
11975
11976
11977
11978
11979
11980
11981
11982
11983
11984
11985
11986
11987
11988
11989
11990
11991
11992
11993
11994
11995
11996
11997
11998
11999
12000
12001
12002
12003
12004
12005
12006
12007
12008
12009
12010
12011
12012
12013
12014
12015
12016
12017
12018
12019
12020
12021
12022
12023
12024
12025
12026
12027
12028
12029
12030
12031
12032
12033
12034
12035
12036
12037
12038
12039
12040
12041
12042
12043
12044
12045
12046
12047
12048
12049
12050
12051
12052
12053
12054
12055
12056
12057
12058
12059
12060
12061
12062
12063
12064
12065
12066
12067
12068
12069
12070
12071
12072
12073
12074
12075
12076
12077
12078
12079
12080
12081
12082
12083
12084
12085
12086
12087
12088
12089
12090
12091
12092
12093
12094
12095
12096
12097
12098
12099
12100
12101
12102
12103
12104
12105
12106
12107
12108
12109
12110
12111
12112
12113
12114
12115
12116
12117
12118
12119
12120
12121
12122
12123
12124
12125
12126
12127
12128
12129
12130
12131
12132
12133
12134
12135
12136
12137
12138
12139
12140
12141
12142
12143
12144
12145
12146
12147
12148
12149
12150
12151
12152
12153
12154
12155
12156
12157
12158
12159
12160
12161
12162
12163
12164
12165
12166
12167
12168
12169
12170
12171
12172
12173
12174
12175
12176
12177
12178
12179
12180
12181
12182
12183
12184
12185
12186
12187
12188
12189
12190
12191
12192
12193
12194
12195
12196
12197
12198
12199
12200
12201
12202
12203
12204
12205
12206
12207
12208
12209
12210
12211
12212
12213
12214
12215
12216
12217
12218
12219
12220
12221
12222
12223
12224
12225
12226
12227
12228
12229
12230
12231
12232
12233
12234
12235
12236
12237
12238
12239
12240
12241
12242
12243
12244
12245
12246
12247
12248
12249
12250
12251
12252
12253
12254
12255
12256
12257
12258
12259
12260
12261
12262
12263
12264
12265
12266
12267
12268
12269
12270
12271
12272
12273
12274
12275
12276
12277
12278
12279
12280
12281
12282
12283
12284
12285
12286
12287
12288
12289
12290
12291
12292
12293
12294
12295
12296
12297
12298
12299
12300
12301
12302
12303
12304
12305
12306
12307
12308
12309
12310
12311
12312
12313
12314
12315
12316
12317
12318
12319
12320
12321
12322
12323
12324
12325
12326
12327
12328
12329
12330
12331
12332
12333
12334
12335
12336
12337
12338
12339
12340
12341
12342
12343
12344
12345
12346
12347
12348
12349
12350
12351
12352
12353
12354
12355
12356
12357
12358
12359
12360
12361
12362
12363
12364
12365
12366
12367
12368
12369
12370
12371
12372
12373
12374
12375
12376
12377
12378
12379
12380
12381
12382
12383
12384
12385
12386
12387
12388
12389
12390
12391
12392
12393
12394
12395
12396
12397
12398
12399
12400
12401
12402
12403
12404
12405
12406
12407
12408
12409
12410
12411
12412
12413
12414
12415
12416
12417
12418
12419
12420
12421
12422
12423
12424
12425
12426
12427
12428
12429
12430
12431
12432
12433
12434
12435
12436
12437
12438
12439
12440
12441
12442
12443
12444
12445
12446
12447
12448
12449
12450
12451
12452
12453
12454
12455
12456
12457
12458
12459
12460
12461
12462
12463
12464
12465
12466
12467
12468
12469
12470
12471
12472
12473
12474
12475
12476
12477
12478
12479
12480
12481
12482
12483
12484
12485
12486
12487
12488
12489
12490
12491
12492
12493
12494
12495
12496
12497
12498
12499
12500
12501
12502
12503
12504
12505
12506
12507
12508
12509
12510
12511
12512
12513
12514
12515
12516
12517
12518
12519
12520
12521
12522
12523
12524
12525
12526
12527
12528
12529
12530
12531
12532
12533
12534
12535
12536
12537
12538
12539
12540
12541
12542
12543
12544
12545
12546
12547
12548
12549
12550
12551
12552
12553
12554
12555
12556
12557
12558
12559
12560
12561
12562
12563
12564
12565
12566
12567
12568
12569
12570
12571
12572
12573
12574
12575
12576
12577
12578
12579
12580
12581
12582
12583
12584
12585
12586
12587
12588
12589
12590
12591
12592
12593
12594
12595
12596
12597
12598
12599
12600
12601
12602
12603
12604
12605
12606
12607
12608
12609
12610
12611
12612
12613
12614
12615
12616
12617
12618
12619
12620
12621
12622
12623
12624
12625
12626
12627
12628
12629
12630
12631
12632
12633
12634
12635
12636
12637
12638
12639
12640
12641
12642
12643
12644
12645
12646
12647
12648
12649
12650
12651
12652
12653
12654
12655
12656
12657
12658
12659
12660
12661
12662
12663
12664
12665
12666
12667
12668
12669
12670
12671
12672
12673
12674
12675
12676
12677
12678
12679
12680
12681
12682
12683
12684
12685
12686
12687
12688
12689
12690
12691
12692
12693
12694
12695
12696
12697
12698
12699
12700
12701
12702
12703
12704
12705
12706
12707
12708
12709
12710
12711
12712
12713
12714
12715
12716
12717
12718
12719
12720
12721
12722
12723
12724
12725
12726
12727
12728
12729
12730
12731
12732
12733
12734
12735
12736
12737
12738
12739
12740
12741
12742
12743
12744
12745
12746
12747
12748
12749
12750
12751
12752
12753
12754
12755
12756
12757
12758
12759
12760
12761
12762
12763
12764
12765
12766
12767
12768
12769
12770
12771
12772
12773
12774
12775
12776
12777
12778
12779
12780
12781
12782
12783
12784
12785
12786
12787
12788
12789
12790
12791
12792
12793
12794
12795
12796
12797
12798
12799
12800
12801
12802
12803
12804
12805
12806
12807
12808
12809
12810
12811
12812
12813
12814
12815
12816
12817
12818
12819
12820
12821
12822
12823
12824
12825
12826
12827
12828
12829
12830
12831
12832
12833
12834
12835
12836
12837
12838
12839
12840
12841
12842
12843
12844
12845
12846
12847
12848
12849
12850
12851
12852
12853
12854
12855
12856
12857
12858
12859
12860
12861
12862
12863
12864
12865
12866
12867
12868
12869
12870
12871
12872
12873
12874
12875
12876
12877
12878
12879
12880
12881
12882
12883
12884
12885
12886
12887
12888
12889
12890
12891
12892
12893
12894
12895
12896
12897
12898
12899
12900
12901
12902
12903
12904
12905
12906
12907
12908
12909
12910
12911
12912
12913
12914
12915
12916
12917
12918
12919
12920
12921
12922
12923
12924
12925
12926
12927
12928
12929
12930
12931
12932
12933
12934
12935
12936
12937
12938
12939
12940
12941
12942
12943
12944
12945
12946
12947
12948
12949
12950
12951
12952
12953
12954
12955
12956
12957
12958
12959
12960
12961
12962
12963
12964
12965
12966
12967
12968
12969
12970
12971
12972
12973
12974
12975
12976
12977
12978
12979
12980
12981
12982
12983
12984
12985
12986
12987
12988
12989
12990
12991
12992
12993
12994
12995
12996
12997
12998
12999
13000
13001
13002
13003
13004
13005
13006
13007
13008
13009
13010
13011
13012
13013
13014
13015
13016
13017
13018
13019
13020
13021
13022
13023
13024
13025
13026
13027
13028
13029
13030
13031
13032
13033
13034
13035
13036
13037
13038
13039
13040
13041
13042
13043
13044
13045
13046
13047
13048
13049
13050
13051
13052
13053
13054
13055
13056
13057
13058
13059
13060
13061
13062
13063
13064
13065
13066
13067
13068
13069
13070
13071
13072
13073
13074
13075
13076
13077
13078
13079
13080
13081
13082
13083
13084
13085
13086
13087
13088
13089
13090
13091
13092
13093
13094
13095
13096
13097
13098
13099
13100
13101
13102
13103
13104
13105
13106
13107
13108
13109
13110
13111
13112
13113
13114
13115
13116
13117
13118
13119
13120
13121
13122
13123
13124
13125
13126
13127
13128
13129
13130
13131
13132
13133
13134
13135
13136
13137
13138
13139
13140
13141
13142
13143
13144
13145
13146
13147
13148
13149
13150
13151
13152
13153
13154
13155
13156
13157
13158
13159
13160
13161
13162
13163
13164
13165
13166
13167
13168
13169
13170
13171
13172
13173
13174
13175
13176
13177
13178
13179
13180
13181
13182
13183
13184
13185
13186
13187
13188
13189
13190
13191
13192
13193
13194
13195
13196
13197
13198
13199
13200
13201
13202
13203
13204
13205
13206
13207
13208
13209
13210
13211
13212
13213
13214
13215
13216
13217
13218
13219
13220
13221
13222
13223
13224
13225
13226
13227
13228
13229
13230
13231
13232
13233
13234
13235
13236
13237
13238
13239
13240
13241
13242
13243
13244
13245
13246
13247
13248
13249
13250
13251
13252
13253
13254
13255
13256
13257
13258
13259
13260
13261
13262
13263
13264
13265
13266
13267
13268
13269
13270
13271
13272
13273
13274
13275
13276
13277
13278
13279
13280
13281
13282
13283
13284
13285
13286
13287
13288
13289
13290
13291
13292
13293
13294
13295
13296
13297
13298
13299
13300
13301
13302
13303
13304
13305
13306
13307
13308
13309
13310
13311
13312
13313
13314
13315
13316
13317
13318
13319
13320
13321
13322
13323
13324
13325
13326
13327
13328
13329
13330
13331
13332
13333
13334
13335
13336
13337
13338
13339
13340
13341
13342
13343
13344
13345
13346
13347
13348
13349
13350
13351
13352
13353
13354
13355
13356
13357
13358
13359
13360
13361
13362
13363
13364
13365
13366
13367
13368
13369
13370
13371
13372
13373
13374
13375
13376
13377
13378
13379
13380
13381
13382
13383
13384
13385
13386
13387
13388
13389
13390
13391
13392
13393
13394
13395
13396
13397
13398
13399
13400
13401
13402
13403
13404
13405
13406
13407
13408
13409
13410
13411
13412
13413
13414
13415
13416
13417
13418
13419
13420
13421
13422
13423
13424
13425
13426
13427
13428
13429
13430
13431
13432
13433
13434
13435
13436
13437
13438
13439
13440
13441
13442
13443
13444
13445
13446
13447
13448
13449
13450
13451
13452
13453
13454
13455
13456
13457
13458
13459
13460
13461
13462
13463
13464
13465
13466
13467
13468
13469
13470
13471
13472
13473
13474
13475
13476
13477
13478
13479
13480
13481
13482
13483
13484
13485
13486
13487
13488
13489
13490
13491
13492
13493
13494
13495
13496
13497
13498
13499
13500
13501
13502
13503
13504
13505
13506
13507
13508
13509
13510
13511
13512
13513
13514
13515
13516
13517
13518
13519
13520
13521
13522
13523
13524
13525
13526
13527
13528
13529
13530
13531
13532
13533
13534
13535
13536
13537
13538
13539
13540
13541
13542
13543
13544
13545
13546
13547
13548
13549
13550
13551
13552
13553
13554
13555
13556
13557
13558
13559
13560
13561
13562
13563
13564
13565
13566
13567
13568
13569
13570
13571
13572
13573
13574
13575
13576
13577
13578
13579
13580
13581
13582
13583
13584
13585
13586
13587
13588
13589
13590
13591
13592
13593
13594
13595
13596
13597
13598
13599
13600
13601
13602
13603
13604
13605
13606
13607
13608
13609
13610
13611
13612
13613
13614
13615
13616
13617
13618
13619
13620
13621
13622
13623
13624
13625
13626
13627
13628
13629
13630
13631
13632
13633
13634
13635
13636
13637
13638
13639
13640
13641
13642
13643
13644
13645
13646
13647
13648
13649
13650
13651
13652
13653
13654
13655
13656
13657
13658
13659
13660
13661
13662
13663
13664
13665
13666
13667
13668
13669
13670
13671
13672
13673
13674
13675
13676
13677
13678
13679
13680
13681
13682
13683
13684
13685
13686
13687
13688
13689
13690
13691
13692
13693
13694
13695
13696
13697
13698
13699
13700
13701
13702
13703
13704
13705
13706
13707
13708
13709
13710
13711
13712
13713
13714
13715
13716
13717
13718
13719
13720
13721
13722
13723
13724
13725
13726
13727
13728
13729
13730
13731
13732
13733
13734
13735
13736
13737
13738
13739
13740
13741
13742
13743
13744
13745
13746
13747
13748
13749
13750
13751
13752
13753
13754
13755
13756
13757
13758
13759
13760
13761
13762
13763
13764
13765
13766
13767
13768
13769
13770
13771
13772
13773
13774
13775
13776
13777
13778
13779
13780
13781
13782
13783
13784
13785
13786
13787
13788
13789
13790
13791
13792
13793
13794
13795
13796
13797
13798
13799
13800
13801
13802
13803
13804
13805
13806
13807
13808
13809
13810
13811
13812
13813
13814
13815
13816
13817
13818
13819
13820
13821
13822
13823
13824
13825
13826
13827
13828
13829
13830
13831
13832
13833
13834
13835
13836
13837
13838
13839
13840
13841
13842
13843
13844
13845
13846
13847
13848
13849
13850
13851
13852
13853
13854
13855
13856
13857
13858
13859
13860
13861
13862
13863
13864
13865
13866
13867
13868
13869
13870
13871
13872
13873
13874
13875
13876
13877
13878
13879
13880
13881
13882
13883
13884
13885
13886
13887
13888
13889
13890
13891
13892
13893
13894
13895
13896
13897
13898
13899
13900
13901
13902
13903
13904
13905
13906
13907
13908
13909
13910
13911
13912
13913
13914
13915
13916
13917
13918
13919
13920
13921
13922
13923
13924
13925
13926
13927
13928
13929
13930
13931
13932
13933
13934
13935
13936
13937
13938
13939
13940
13941
13942
13943
13944
13945
13946
13947
13948
13949
13950
13951
13952
13953
13954
13955
13956
13957
13958
13959
13960
13961
13962
13963
13964
13965
13966
13967
13968
13969
13970
13971
13972
13973
13974
13975
13976
13977
13978
13979
13980
13981
13982
13983
13984
13985
13986
13987
13988
13989
13990
13991
13992
13993
13994
13995
13996
13997
13998
13999
14000
14001
14002
14003
14004
14005
14006
14007
14008
14009
14010
14011
14012
14013
14014
14015
14016
14017
14018
14019
14020
14021
14022
14023
14024
14025
14026
14027
14028
14029
14030
14031
14032
14033
14034
14035
14036
14037
14038
14039
14040
14041
14042
14043
14044
14045
14046
14047
14048
14049
14050
14051
14052
14053
14054
14055
14056
14057
14058
14059
14060
14061
14062
14063
14064
14065
14066
14067
14068
14069
14070
14071
14072
14073
14074
14075
14076
14077
14078
14079
14080
14081
14082
14083
14084
14085
14086
14087
14088
14089
14090
14091
14092
14093
14094
14095
14096
14097
14098
14099
14100
14101
14102
14103
14104
14105
14106
14107
14108
14109
14110
14111
14112
14113
14114
14115
14116
14117
14118
14119
14120
14121
14122
14123
14124
14125
14126
14127
14128
14129
14130
14131
14132
14133
14134
14135
14136
14137
14138
14139
14140
14141
14142
14143
14144
14145
14146
14147
14148
14149
14150
14151
14152
14153
14154
14155
14156
14157
14158
14159
14160
14161
14162
14163
14164
14165
14166
14167
14168
14169
14170
14171
14172
14173
14174
14175
14176
14177
14178
14179
14180
14181
14182
14183
14184
14185
14186
14187
14188
14189
14190
14191
14192
14193
14194
14195
14196
14197
14198
14199
14200
14201
14202
14203
14204
14205
14206
14207
14208
14209
14210
14211
14212
14213
14214
14215
14216
14217
14218
14219
14220
14221
14222
14223
14224
14225
14226
14227
14228
14229
14230
14231
14232
14233
14234
14235
14236
14237
14238
14239
14240
14241
14242
14243
14244
14245
14246
14247
14248
14249
14250
14251
14252
14253
14254
14255
14256
14257
14258
14259
14260
14261
14262
14263
14264
14265
14266
14267
14268
14269
14270
14271
14272
14273
14274
14275
14276
14277
14278
14279
14280
14281
14282
14283
14284
14285
14286
14287
14288
14289
14290
14291
14292
14293
14294
14295
14296
14297
14298
14299
14300
14301
14302
14303
14304
14305
14306
14307
14308
14309
14310
14311
14312
14313
14314
14315
14316
14317
14318
14319
14320
14321
14322
14323
14324
14325
14326
14327
14328
14329
14330
14331
14332
14333
14334
14335
14336
14337
14338
14339
14340
14341
14342
14343
14344
14345
14346
14347
14348
14349
14350
14351
14352
14353
14354
14355
14356
14357
14358
14359
14360
14361
14362
14363
14364
14365
14366
14367
14368
14369
14370
14371
14372
14373
14374
14375
14376
14377
14378
14379
14380
14381
14382
14383
14384
14385
14386
14387
14388
14389
14390
14391
14392
14393
14394
14395
14396
14397
14398
14399
14400
14401
14402
14403
14404
14405
14406
14407
14408
14409
14410
14411
14412
14413
14414
14415
14416
14417
14418
14419
14420
14421
14422
14423
14424
14425
14426
14427
14428
14429
14430
14431
14432
14433
14434
14435
14436
14437
14438
14439
14440
14441
14442
14443
14444
14445
14446
14447
14448
14449
14450
14451
14452
14453
14454
14455
14456
14457
14458
14459
14460
14461
14462
14463
14464
14465
14466
14467
14468
14469
14470
14471
14472
14473
14474
14475
14476
14477
14478
14479
14480
14481
14482
14483
14484
14485
14486
14487
14488
14489
14490
14491
14492
14493
14494
14495
14496
14497
14498
14499
14500
14501
14502
14503
14504
14505
14506
14507
14508
14509
14510
14511
14512
14513
14514
14515
14516
14517
14518
14519
14520
14521
14522
14523
14524
14525
14526
14527
14528
14529
14530
14531
14532
14533
14534
14535
14536
14537
14538
14539
14540
14541
14542
14543
14544
14545
14546
14547
14548
14549
14550
14551
14552
14553
14554
14555
14556
14557
14558
14559
14560
14561
14562
14563
14564
14565
14566
14567
14568
14569
14570
14571
14572
14573
14574
14575
14576
14577
14578
14579
14580
14581
14582
14583
14584
14585
14586
14587
14588
14589
14590
14591
14592
14593
14594
14595
14596
14597
14598
14599
14600
14601
14602
14603
14604
14605
14606
14607
14608
14609
14610
14611
14612
14613
14614
14615
14616
14617
14618
14619
14620
14621
14622
14623
14624
14625
14626
14627
14628
14629
14630
14631
14632
14633
14634
14635
14636
14637
14638
14639
14640
14641
14642
14643
14644
14645
14646
14647
14648
14649
14650
14651
14652
14653
14654
14655
14656
14657
14658
14659
14660
14661
14662
14663
14664
14665
14666
14667
14668
14669
14670
14671
14672
14673
14674
14675
14676
14677
14678
14679
14680
14681
14682
14683
14684
14685
14686
14687
14688
14689
14690
14691
14692
14693
14694
14695
14696
14697
14698
14699
14700
14701
14702
14703
14704
14705
14706
14707
14708
14709
14710
14711
14712
14713
14714
14715
14716
14717
14718
14719
14720
14721
14722
14723
14724
14725
14726
14727
14728
14729
14730
14731
14732
14733
14734
14735
14736
14737
14738
14739
14740
14741
14742
14743
14744
14745
14746
14747
14748
14749
14750
14751
14752
14753
14754
14755
14756
14757
14758
14759
14760
14761
14762
14763
14764
14765
14766
14767
14768
14769
14770
14771
14772
14773
14774
14775
14776
14777
14778
14779
14780
14781
14782
14783
14784
14785
14786
14787
14788
14789
14790
14791
14792
14793
14794
14795
14796
14797
14798
14799
14800
14801
14802
14803
14804
14805
14806
14807
14808
14809
14810
14811
14812
14813
14814
14815
14816
14817
14818
14819
14820
14821
14822
14823
14824
14825
14826
14827
14828
14829
14830
14831
14832
14833
14834
14835
14836
14837
14838
14839
14840
14841
14842
14843
14844
14845
14846
14847
14848
14849
14850
14851
14852
14853
14854
14855
14856
14857
14858
14859
14860
14861
14862
14863
14864
14865
14866
14867
14868
14869
14870
14871
14872
14873
14874
14875
14876
14877
14878
14879
14880
14881
14882
14883
14884
14885
14886
14887
14888
14889
14890
14891
14892
14893
14894
14895
14896
14897
14898
14899
14900
14901
14902
14903
14904
14905
14906
14907
14908
14909
14910
14911
14912
14913
14914
14915
14916
14917
14918
14919
14920
14921
14922
14923
14924
14925
14926
14927
14928
14929
14930
14931
14932
14933
14934
14935
14936
14937
14938
14939
14940
14941
14942
14943
14944
14945
14946
14947
14948
14949
14950
14951
14952
14953
14954
14955
14956
14957
14958
14959
14960
14961
14962
14963
14964
14965
14966
14967
14968
14969
14970
14971
14972
14973
14974
14975
14976
14977
14978
14979
14980
14981
14982
14983
14984
14985
14986
14987
14988
14989
14990
14991
14992
14993
14994
14995
14996
14997
14998
14999
15000
15001
15002
15003
15004
15005
15006
15007
15008
15009
15010
15011
15012
15013
15014
15015
15016
15017
15018
15019
15020
15021
15022
15023
15024
15025
15026
15027
15028
15029
15030
15031
15032
15033
15034
15035
15036
15037
15038
15039
15040
15041
15042
15043
15044
15045
15046
15047
15048
15049
15050
15051
15052
15053
15054
15055
15056
15057
15058
15059
15060
15061
15062
15063
15064
15065
15066
15067
15068
15069
15070
15071
15072
15073
15074
15075
15076
15077
15078
15079
15080
15081
15082
15083
15084
15085
15086
15087
15088
15089
15090
15091
15092
15093
15094
15095
15096
15097
15098
15099
15100
15101
15102
15103
15104
15105
15106
15107
15108
15109
15110
15111
15112
15113
15114
15115
15116
15117
15118
15119
15120
15121
15122
15123
15124
15125
15126
15127
15128
15129
15130
15131
15132
15133
15134
15135
15136
15137
15138
15139
15140
15141
15142
15143
15144
15145
15146
15147
15148
15149
15150
15151
15152
15153
15154
15155
15156
15157
15158
15159
15160
15161
15162
15163
15164
15165
15166
15167
15168
15169
15170
15171
15172
15173
15174
15175
15176
15177
15178
15179
15180
15181
15182
15183
15184
15185
15186
15187
15188
15189
15190
15191
15192
15193
15194
15195
15196
15197
15198
15199
15200
15201
15202
15203
15204
15205
15206
15207
15208
15209
15210
15211
15212
15213
15214
15215
15216
15217
15218
15219
15220
15221
15222
15223
15224
15225
15226
15227
15228
15229
15230
15231
15232
15233
15234
15235
15236
15237
15238
15239
15240
15241
15242
15243
15244
15245
15246
15247
15248
15249
15250
15251
15252
15253
15254
15255
15256
15257
15258
15259
15260
15261
15262
15263
15264
15265
15266
15267
15268
15269
15270
15271
15272
15273
15274
15275
15276
15277
15278
15279
15280
15281
15282
15283
15284
15285
15286
15287
15288
15289
15290
15291
15292
15293
15294
15295
15296
15297
15298
15299
15300
15301
15302
15303
15304
15305
15306
15307
15308
15309
15310
15311
15312
15313
15314
15315
15316
15317
15318
15319
15320
15321
15322
15323
15324
15325
15326
15327
15328
15329
15330
15331
15332
15333
15334
15335
15336
15337
15338
15339
15340
15341
15342
15343
15344
15345
15346
15347
15348
15349
15350
15351
15352
15353
15354
15355
15356
15357
15358
15359
15360
15361
15362
15363
15364
15365
15366
15367
15368
15369
15370
15371
15372
15373
15374
15375
15376
15377
15378
15379
15380
15381
15382
15383
15384
15385
15386
15387
15388
15389
15390
15391
15392
15393
15394
15395
15396
15397
15398
15399
15400
15401
15402
15403
15404
15405
15406
15407
15408
15409
15410
15411
15412
15413
15414
15415
15416
15417
15418
15419
15420
15421
15422
15423
15424
15425
15426
15427
15428
15429
15430
15431
15432
15433
15434
15435
15436
15437
15438
15439
15440
15441
15442
15443
15444
15445
15446
15447
15448
15449
15450
15451
15452
15453
15454
15455
15456
15457
15458
15459
15460
15461
15462
15463
15464
15465
15466
15467
15468
15469
15470
15471
15472
15473
15474
15475
15476
15477
15478
15479
15480
15481
15482
15483
15484
15485
15486
15487
15488
15489
15490
15491
15492
15493
15494
15495
15496
15497
15498
15499
15500
15501
15502
15503
15504
15505
15506
15507
15508
15509
15510
15511
15512
15513
15514
15515
15516
15517
15518
15519
15520
15521
15522
15523
15524
15525
15526
15527
15528
15529
15530
15531
15532
15533
15534
15535
15536
15537
15538
15539
15540
15541
15542
15543
15544
15545
15546
15547
15548
15549
15550
15551
15552
15553
15554
15555
15556
15557
15558
15559
15560
15561
15562
15563
15564
15565
15566
15567
15568
15569
15570
15571
15572
15573
15574
15575
15576
15577
15578
15579
15580
15581
15582
15583
15584
15585
15586
15587
15588
15589
15590
15591
15592
15593
15594
15595
15596
15597
15598
15599
15600
15601
15602
15603
15604
15605
15606
15607
15608
15609
15610
15611
15612
15613
15614
15615
15616
15617
15618
15619
15620
15621
15622
15623
15624
15625
15626
15627
15628
15629
15630
15631
15632
15633
15634
15635
15636
15637
15638
15639
15640
15641
15642
15643
15644
15645
15646
15647
15648
15649
15650
15651
15652
15653
15654
15655
15656
15657
15658
15659
15660
15661
15662
15663
15664
15665
15666
15667
15668
15669
15670
15671
15672
15673
15674
15675
15676
15677
15678
15679
15680
15681
15682
15683
15684
15685
15686
15687
15688
15689
15690
15691
15692
15693
15694
15695
15696
15697
15698
15699
15700
15701
15702
15703
15704
15705
15706
15707
15708
15709
15710
15711
15712
15713
15714
15715
15716
15717
15718
15719
15720
15721
15722
15723
15724
15725
15726
15727
15728
15729
15730
15731
15732
15733
15734
15735
15736
15737
15738
15739
15740
15741
15742
15743
15744
15745
15746
15747
15748
15749
15750
15751
15752
15753
15754
15755
15756
15757
15758
15759
15760
15761
15762
15763
15764
15765
15766
15767
15768
15769
15770
15771
15772
15773
15774
15775
15776
15777
15778
15779
15780
15781
15782
15783
15784
15785
15786
15787
15788
15789
15790
15791
15792
15793
15794
15795
15796
15797
15798
15799
15800
15801
15802
15803
15804
15805
15806
15807
15808
15809
15810
15811
15812
15813
15814
15815
15816
15817
15818
15819
15820
15821
15822
15823
15824
15825
15826
15827
15828
15829
15830
15831
15832
15833
15834
15835
15836
15837
15838
15839
15840
15841
15842
15843
15844
15845
15846
15847
15848
15849
15850
15851
15852
15853
15854
15855
15856
15857
15858
15859
15860
15861
15862
15863
15864
15865
15866
15867
15868
15869
15870
15871
15872
15873
15874
15875
15876
15877
15878
15879
15880
15881
15882
15883
15884
15885
15886
15887
15888
15889
15890
15891
15892
15893
15894
15895
15896
15897
15898
15899
15900
15901
15902
15903
15904
15905
15906
15907
15908
15909
15910
15911
15912
15913
15914
15915
15916
15917
15918
15919
15920
15921
15922
15923
15924
15925
15926
15927
15928
15929
15930
15931
15932
15933
15934
15935
15936
15937
15938
15939
15940
15941
15942
15943
15944
15945
15946
15947
15948
15949
15950
15951
15952
15953
15954
15955
15956
15957
15958
15959
15960
15961
15962
15963
15964
15965
15966
15967
15968
15969
15970
15971
15972
15973
15974
15975
15976
15977
15978
15979
15980
15981
15982
15983
15984
15985
15986
15987
15988
15989
15990
15991
15992
15993
15994
15995
15996
15997
15998
15999
16000
16001
16002
16003
16004
16005
16006
16007
16008
16009
16010
16011
16012
16013
16014
16015
16016
16017
16018
16019
16020
16021
16022
16023
16024
16025
16026
16027
16028
16029
16030
16031
16032
16033
16034
16035
16036
16037
16038
16039
16040
16041
16042
16043
16044
16045
16046
16047
16048
16049
16050
16051
16052
16053
16054
16055
16056
16057
16058
16059
16060
16061
16062
16063
16064
16065
16066
16067
16068
16069
16070
16071
16072
16073
16074
16075
16076
16077
16078
16079
16080
16081
16082
16083
16084
16085
16086
16087
16088
16089
16090
16091
16092
16093
16094
16095
16096
16097
16098
16099
16100
16101
16102
16103
16104
16105
16106
16107
16108
16109
16110
16111
16112
16113
16114
16115
16116
16117
16118
16119
16120
16121
16122
16123
16124
16125
16126
16127
16128
16129
16130
16131
16132
16133
16134
16135
16136
16137
16138
16139
16140
16141
16142
16143
16144
16145
16146
16147
16148
16149
16150
16151
16152
16153
16154
16155
16156
16157
16158
16159
16160
16161
16162
16163
16164
16165
16166
16167
16168
16169
16170
16171
16172
16173
16174
16175
16176
16177
16178
16179
16180
16181
16182
16183
16184
16185
16186
16187
16188
16189
16190
16191
16192
16193
16194
16195
16196
16197
16198
16199
16200
16201
16202
16203
16204
16205
16206
16207
16208
16209
16210
16211
16212
16213
16214
16215
16216
16217
16218
16219
16220
16221
16222
16223
16224
16225
16226
16227
16228
16229
16230
16231
16232
16233
16234
16235
16236
16237
16238
16239
16240
16241
16242
16243
16244
16245
16246
16247
16248
16249
16250
16251
16252
16253
16254
16255
16256
16257
16258
16259
16260
16261
16262
16263
16264
16265
16266
16267
16268
16269
16270
16271
16272
16273
16274
16275
16276
16277
16278
16279
16280
16281
16282
16283
16284
16285
16286
16287
16288
16289
16290
16291
16292
16293
16294
16295
16296
16297
16298
16299
16300
16301
16302
16303
16304
16305
16306
16307
16308
16309
16310
16311
16312
16313
16314
16315
16316
16317
16318
16319
16320
16321
16322
16323
16324
16325
16326
16327
16328
16329
16330
16331
16332
16333
16334
16335
16336
16337
16338
16339
16340
16341
16342
16343
16344
16345
16346
16347
16348
16349
16350
16351
16352
16353
16354
16355
16356
16357
16358
16359
16360
16361
16362
16363
16364
16365
16366
16367
16368
16369
16370
16371
16372
16373
16374
16375
16376
16377
16378
16379
16380
16381
16382
16383
16384
16385
16386
16387
16388
16389
16390
16391
16392
16393
16394
16395
16396
16397
16398
16399
16400
16401
16402
16403
16404
16405
16406
16407
16408
16409
16410
16411
16412
16413
16414
16415
16416
16417
16418
16419
16420
16421
16422
16423
16424
16425
16426
16427
16428
16429
16430
16431
16432
16433
16434
16435
16436
16437
16438
16439
16440
16441
16442
16443
16444
16445
16446
16447
16448
16449
16450
16451
16452
16453
16454
16455
16456
16457
16458
16459
16460
16461
16462
16463
16464
16465
16466
16467
16468
16469
16470
16471
16472
16473
16474
16475
16476
16477
16478
16479
16480
16481
16482
16483
16484
16485
16486
16487
16488
16489
16490
16491
16492
16493
16494
16495
16496
16497
16498
16499
16500
16501
16502
16503
16504
16505
16506
16507
16508
16509
16510
16511
16512
16513
16514
16515
16516
16517
16518
16519
16520
16521
16522
16523
16524
16525
16526
16527
16528
16529
16530
16531
16532
16533
16534
16535
16536
16537
16538
16539
16540
16541
16542
16543
16544
16545
16546
16547
16548
16549
16550
16551
16552
16553
16554
16555
16556
16557
16558
16559
16560
16561
16562
16563
16564
16565
16566
16567
16568
16569
16570
16571
16572
16573
16574
16575
16576
16577
16578
16579
16580
16581
16582
16583
16584
16585
16586
16587
16588
16589
16590
16591
16592
16593
16594
16595
16596
16597
16598
16599
16600
16601
16602
16603
16604
16605
16606
16607
16608
16609
16610
16611
16612
16613
16614
16615
16616
16617
16618
16619
16620
16621
16622
16623
16624
16625
16626
16627
16628
16629
16630
16631
16632
16633
16634
16635
16636
16637
16638
16639
16640
16641
16642
16643
16644
16645
16646
16647
16648
16649
16650
16651
16652
16653
16654
16655
16656
16657
16658
16659
16660
16661
16662
16663
16664
16665
16666
16667
16668
16669
16670
16671
16672
16673
16674
16675
16676
16677
16678
16679
16680
16681
16682
16683
16684
16685
16686
16687
16688
16689
16690
16691
16692
16693
16694
16695
16696
16697
16698
16699
16700
16701
16702
16703
16704
16705
16706
16707
16708
16709
16710
16711
16712
16713
16714
16715
16716
16717
16718
16719
16720
16721
16722
16723
16724
16725
16726
16727
16728
16729
16730
16731
16732
16733
16734
16735
16736
16737
16738
16739
16740
16741
16742
16743
16744
16745
16746
16747
16748
16749
16750
16751
16752
16753
16754
16755
16756
16757
16758
16759
16760
16761
16762
16763
16764
16765
16766
16767
16768
16769
16770
16771
16772
16773
16774
16775
16776
16777
16778
16779
16780
16781
16782
16783
16784
16785
16786
16787
16788
16789
16790
16791
16792
16793
16794
16795
16796
16797
16798
16799
16800
16801
16802
16803
16804
16805
16806
16807
16808
16809
16810
16811
16812
16813
16814
16815
16816
16817
16818
16819
16820
16821
16822
16823
16824
16825
16826
16827
16828
16829
16830
16831
16832
16833
16834
16835
16836
16837
16838
16839
16840
16841
16842
16843
16844
16845
16846
16847
16848
16849
16850
16851
16852
16853
16854
16855
16856
16857
16858
16859
16860
16861
16862
16863
16864
16865
16866
16867
16868
16869
16870
16871
16872
16873
16874
16875
16876
16877
16878
16879
16880
16881
16882
16883
16884
16885
16886
16887
16888
16889
16890
16891
16892
16893
16894
16895
16896
16897
16898
16899
16900
16901
16902
16903
16904
16905
16906
16907
16908
16909
16910
16911
16912
16913
16914
16915
16916
16917
16918
16919
16920
16921
16922
16923
16924
16925
16926
16927
16928
16929
16930
16931
16932
16933
16934
16935
16936
16937
16938
16939
16940
16941
16942
16943
16944
16945
16946
16947
16948
16949
16950
16951
16952
16953
16954
16955
16956
16957
16958
16959
16960
16961
16962
16963
16964
16965
16966
16967
16968
16969
16970
16971
16972
16973
16974
16975
16976
16977
16978
16979
16980
16981
16982
16983
16984
16985
16986
16987
16988
16989
16990
16991
16992
16993
16994
16995
16996
16997
16998
16999
17000
17001
17002
17003
17004
17005
17006
17007
17008
17009
17010
17011
17012
17013
17014
17015
17016
17017
17018
17019
17020
17021
17022
17023
17024
17025
17026
17027
17028
17029
17030
17031
17032
17033
17034
17035
17036
17037
17038
17039
17040
17041
17042
17043
17044
17045
17046
17047
17048
17049
17050
17051
17052
17053
17054
17055
17056
17057
17058
17059
17060
17061
17062
17063
17064
17065
17066
17067
17068
17069
17070
17071
17072
17073
17074
17075
17076
17077
17078
17079
17080
17081
17082
17083
17084
17085
17086
17087
17088
17089
17090
17091
17092
17093
17094
17095
17096
17097
17098
17099
17100
17101
17102
17103
17104
17105
17106
17107
17108
17109
17110
17111
17112
17113
17114
17115
17116
17117
17118
17119
17120
17121
17122
17123
17124
17125
17126
17127
17128
17129
17130
17131
17132
17133
17134
17135
17136
17137
17138
17139
17140
17141
17142
17143
17144
17145
17146
17147
17148
17149
17150
17151
17152
17153
17154
17155
17156
17157
17158
17159
17160
17161
17162
17163
17164
17165
17166
17167
17168
17169
17170
17171
17172
17173
17174
17175
17176
17177
17178
17179
17180
17181
17182
17183
17184
17185
17186
17187
17188
17189
17190
17191
17192
17193
17194
17195
17196
17197
17198
17199
17200
17201
17202
17203
17204
17205
17206
17207
17208
17209
17210
17211
17212
17213
17214
17215
17216
17217
17218
17219
17220
17221
17222
17223
17224
17225
17226
17227
17228
17229
17230
17231
17232
17233
17234
17235
17236
17237
17238
17239
17240
17241
17242
17243
17244
17245
17246
17247
17248
17249
17250
17251
17252
17253
17254
17255
17256
17257
17258
17259
17260
17261
17262
17263
17264
17265
17266
17267
17268
17269
17270
17271
17272
17273
17274
17275
17276
17277
17278
17279
17280
17281
17282
17283
17284
17285
17286
17287
17288
17289
17290
17291
17292
17293
17294
17295
17296
17297
17298
17299
17300
17301
17302
17303
17304
17305
17306
17307
17308
17309
17310
17311
17312
17313
17314
17315
17316
17317
17318
17319
17320
17321
17322
17323
17324
17325
17326
17327
17328
17329
17330
17331
17332
17333
17334
17335
17336
17337
17338
17339
17340
17341
17342
17343
17344
17345
17346
17347
17348
17349
17350
17351
17352
17353
17354
17355
17356
17357
17358
17359
17360
17361
17362
17363
17364
17365
17366
17367
17368
17369
17370
17371
17372
17373
17374
17375
17376
17377
17378
17379
17380
17381
17382
17383
17384
17385
17386
17387
17388
17389
17390
17391
17392
17393
17394
17395
17396
17397
17398
17399
17400
17401
17402
17403
17404
17405
17406
17407
17408
17409
17410
17411
17412
17413
17414
17415
17416
17417
17418
17419
17420
17421
17422
17423
17424
17425
17426
17427
17428
17429
17430
17431
17432
17433
17434
17435
17436
17437
17438
17439
17440
17441
17442
17443
17444
17445
17446
17447
17448
17449
17450
17451
17452
17453
17454
17455
17456
17457
17458
17459
17460
17461
17462
17463
17464
17465
17466
17467
17468
17469
17470
17471
17472
17473
17474
17475
17476
17477
17478
17479
17480
17481
17482
17483
17484
17485
17486
17487
17488
17489
17490
17491
17492
17493
17494
17495
17496
17497
17498
17499
17500
17501
17502
17503
17504
17505
17506
17507
17508
17509
17510
17511
17512
17513
17514
17515
17516
17517
17518
17519
17520
17521
17522
17523
17524
17525
17526
17527
17528
17529
17530
17531
17532
17533
17534
17535
17536
17537
17538
17539
17540
17541
17542
17543
17544
17545
17546
17547
17548
17549
17550
17551
17552
17553
17554
17555
17556
17557
17558
17559
17560
17561
17562
17563
17564
17565
17566
17567
17568
17569
17570
17571
17572
17573
17574
17575
17576
17577
17578
17579
17580
17581
17582
17583
17584
17585
17586
17587
17588
17589
17590
17591
17592
17593
17594
17595
17596
17597
17598
17599
17600
17601
17602
17603
17604
17605
17606
17607
17608
17609
17610
17611
17612
17613
17614
17615
17616
17617
17618
17619
17620
17621
17622
17623
17624
17625
17626
17627
17628
17629
17630
17631
17632
17633
17634
17635
17636
17637
17638
17639
17640
17641
17642
17643
17644
17645
17646
17647
17648
17649
17650
17651
17652
17653
17654
17655
17656
17657
17658
17659
17660
17661
17662
17663
17664
17665
17666
17667
17668
17669
17670
17671
17672
17673
17674
17675
17676
17677
17678
17679
17680
17681
17682
17683
17684
17685
17686
17687
17688
17689
17690
17691
17692
17693
17694
17695
17696
17697
17698
17699
17700
17701
17702
17703
17704
17705
17706
17707
17708
17709
17710
17711
17712
17713
17714
17715
17716
17717
17718
17719
17720
17721
17722
17723
17724
17725
17726
17727
17728
17729
17730
17731
17732
17733
17734
17735
17736
17737
17738
17739
17740
17741
17742
17743
17744
17745
17746
17747
17748
17749
17750
17751
17752
17753
17754
17755
17756
17757
17758
17759
17760
17761
17762
17763
17764
17765
17766
17767
17768
17769
17770
17771
17772
17773
17774
17775
17776
17777
17778
17779
17780
17781
17782
17783
17784
17785
17786
17787
17788
17789
17790
17791
17792
17793
17794
17795
17796
17797
17798
17799
17800
17801
17802
17803
17804
17805
17806
17807
17808
17809
17810
17811
17812
17813
17814
17815
17816
17817
17818
17819
17820
17821
17822
17823
17824
17825
17826
17827
17828
17829
17830
17831
17832
17833
17834
17835
17836
17837
17838
17839
17840
17841
17842
17843
17844
17845
17846
17847
17848
17849
17850
17851
17852
17853
17854
17855
17856
17857
17858
17859
17860
17861
17862
17863
17864
17865
17866
17867
17868
17869
17870
17871
17872
17873
17874
17875
17876
17877
17878
17879
17880
17881
17882
17883
17884
17885
17886
17887
17888
17889
17890
17891
17892
17893
17894
17895
17896
17897
17898
17899
17900
17901
17902
17903
17904
17905
17906
17907
17908
17909
17910
17911
17912
17913
17914
17915
17916
17917
17918
17919
17920
17921
17922
17923
17924
17925
17926
17927
17928
17929
17930
17931
17932
17933
17934
17935
17936
17937
17938
17939
17940
17941
17942
17943
17944
17945
17946
17947
17948
17949
17950
17951
17952
17953
17954
17955
17956
17957
17958
17959
17960
17961
17962
17963
17964
17965
17966
17967
17968
17969
17970
17971
17972
17973
17974
17975
17976
17977
17978
17979
17980
17981
17982
17983
17984
17985
17986
17987
17988
17989
17990
17991
17992
17993
17994
17995
17996
17997
17998
17999
18000
18001
18002
18003
18004
18005
18006
18007
18008
18009
18010
18011
18012
18013
18014
18015
18016
18017
18018
18019
18020
18021
18022
18023
18024
18025
18026
18027
18028
18029
18030
18031
18032
18033
18034
18035
18036
18037
18038
18039
18040
18041
18042
18043
18044
18045
18046
18047
18048
18049
18050
18051
18052
18053
18054
18055
18056
18057
18058
18059
18060
18061
18062
18063
18064
18065
18066
18067
18068
18069
18070
18071
18072
18073
18074
18075
18076
18077
18078
18079
18080
18081
18082
18083
18084
18085
18086
18087
18088
18089
18090
18091
18092
18093
18094
18095
18096
18097
18098
18099
18100
18101
18102
18103
18104
18105
18106
18107
18108
18109
18110
18111
18112
18113
18114
18115
18116
18117
18118
18119
18120
18121
18122
18123
18124
18125
18126
18127
18128
18129
18130
18131
18132
18133
18134
18135
18136
18137
18138
18139
18140
18141
18142
18143
18144
18145
18146
18147
18148
18149
18150
18151
18152
18153
18154
18155
18156
18157
18158
18159
18160
18161
18162
18163
18164
18165
18166
18167
18168
18169
18170
18171
18172
18173
18174
18175
18176
18177
18178
18179
18180
18181
18182
18183
18184
18185
18186
18187
18188
18189
18190
18191
18192
18193
18194
18195
18196
18197
18198
18199
18200
18201
18202
18203
18204
18205
18206
18207
18208
18209
18210
18211
18212
18213
18214
18215
18216
18217
18218
18219
18220
18221
18222
18223
18224
18225
18226
18227
18228
18229
18230
18231
18232
18233
18234
18235
18236
18237
18238
18239
18240
18241
18242
18243
18244
18245
18246
18247
18248
18249
18250
18251
18252
18253
18254
18255
18256
18257
18258
18259
18260
18261
18262
18263
18264
18265
18266
18267
18268
18269
18270
18271
18272
18273
18274
18275
18276
18277
18278
18279
18280
18281
18282
18283
18284
Description: Fix syntax issues with Python 3.
Author: Bas Couwenberg <sebastic@debian.org>
Forwarded: not-needed

--- a/tools/contributed/sumopy/sumopy_gui.py
+++ b/tools/contributed/sumopy/sumopy_gui.py
@@ -40,8 +40,8 @@ except:
         wxversion.select("3")
     except:
         #sys.exit('ERROR: wxPython versions 2.8 or 3.x not available.')
-        print 'No wxversion module available, try import default wx version'
-        print 'If wx import shall fail, please install wxPython versions 2.8 or 3.x together with the wxversion module.'
+        print('No wxversion module available, try import default wx version')
+        print('If wx import shall fail, please install wxPython versions 2.8 or 3.x together with the wxversion module.')
         sys.exit(0)
 
 
@@ -65,20 +65,20 @@ from command line:
 use for debugging:
     python sumopy_gui.py --debug > debug.txt 2>&1
 """
-print '                   _                         '
-print '       ____________|______|||___________________      '
-print '      /      _     |              / \  _ _ _ _ _ \     '
-print '     /       |   / | \     v     / _ \ _|_|_|_|_ /     '
-print '     \   __o-o__/  |  \  \ | /  / / \ \     ____/      '
-print '      \        / \|o|/ \  \|/  / / o/\ \   |   _|__/_  '
-print '       \      /  \|o|/  \  |  / / /|  \ \  |  | |      '
-print '   | | | | | /   \|0|/   \ v /  \_/ \_/  \_|    |      '
-print '   | | | | |/_____________\_/____________/ ____/       '
-print '                                         |/             '
-print ''
-print __appname__+' version '+__version__+'\n'+__copyright__
+print('                   _                         ')
+print('       ____________|______|||___________________      ')
+print('      /      _     |              / \  _ _ _ _ _ \     ')
+print('     /       |   / | \     v     / _ \ _|_|_|_|_ /     ')
+print('     \   __o-o__/  |  \  \ | /  / / \ \     ____/      ')
+print('      \        / \|o|/ \  \|/  / / o/\ \   |   _|__/_  ')
+print('       \      /  \|o|/  \  |  / / /|  \ \  |  | |      ')
+print('   | | | | | /   \|0|/   \ v /  \_/ \_/  \_|    |      ')
+print('   | | | | |/_____________\_/____________/ ____/       ')
+print('                                         |/             ')
+print('')
+print(__appname__+' version '+__version__+'\n'+__copyright__)
 
-print '\n  using wx python version', wx.__version__
+print('\n  using wx python version', wx.__version__)
 
 ###############################################################################
 # IMPORTS
--- a/tools/contributed/sumopy/agilepy/lib_base/arrayman.py
+++ b/tools/contributed/sumopy/agilepy/lib_base/arrayman.py
@@ -450,7 +450,7 @@ class IdsArrayConf(ArrayConfMixin, ColCo
         # print 'init_xml',self.attrname,self._tab
         if self._tab.xmltag is not None:
             xmltag_tab, xmltag_item_tab, attrname_id_tab = self._tab.xmltag
-            if (attrname_id_tab is None) | (attrname_id_tab is ''):
+            if (attrname_id_tab is None) | (attrname_id_tab == ''):
                 self._attrconfig_id_tab = None
             else:
                 self._attrconfig_id_tab = getattr(self._tab, attrname_id_tab)  # tab = tabman !
@@ -529,7 +529,7 @@ class IdsArrayConf(ArrayConfMixin, ColCo
         AttrConf.init_postload_internal(self, man, obj)
         # print 'IdsConf.init_postload_internal',self.attrname,self.get_value().dtype,self.get_value().dtype == np.int64
         if self.get_value().dtype == np.int64:
-            print 'WARNING in init_postload_internal: convert ids array to 32 bit'
+            print('WARNING in init_postload_internal: convert ids array to 32 bit')
             self.set_value(np.array(self.get_value(), dtype=np.int32))
         # if self._is_child:
         #    print '  make sure children get initialized'
@@ -1226,7 +1226,7 @@ class ArrayObjman(Arrayman, TableMixin):
         # this should no longer happen in the future as ind and ids
         # have been formatted propperly
         if attrman._inds.dtype != np.int32:
-            print 'WARNING: 64 bit ids and inds...will adjust to 32 bit'
+            print('WARNING: 64 bit ids and inds...will adjust to 32 bit')
             attrman._inds = np.array(attrman._inds, dtype=np.int32)
             attrman._ids = np.array(attrman._ids, dtype=np.int32)
 
--- a/tools/contributed/sumopy/agilepy/lib_base/classman.py
+++ b/tools/contributed/sumopy/agilepy/lib_base/classman.py
@@ -86,7 +86,7 @@ def save_obj(obj, filename, is_not_save_
     try:
         f = open(filename, 'wb')
     except:
-        print 'WARNING in save: could not open', filename
+        print('WARNING in save: could not open', filename)
         return False
 
     if is_not_save_parent:
@@ -110,7 +110,7 @@ def load_obj(filename, parent=None, is_t
     Filename may also include absolute or relative path.
     If operation fails a None object is returned.
     """
-    print 'load_obj', filename
+    print('load_obj', filename)
 
     if is_throw_error:
         f = open(filename, 'rb')
@@ -118,7 +118,7 @@ def load_obj(filename, parent=None, is_t
         try:
             f = open(filename, 'rb')
         except:
-            print 'WARNING in load_obj: could not open', filename
+            print('WARNING in load_obj: could not open', filename)
             return None
 
     # try:
@@ -680,7 +680,7 @@ class AttrConf:
         # print '  self.__dict__=\n',self.__dict__.keys()
         if self._is_saved:
             # this message indicates a loop!!
-            print 'WARNING in __getstate__: Attribute already saved:', self.get_obj().format_ident_abs(), self.attrname
+            print('WARNING in __getstate__: Attribute already saved:', self.get_obj().format_ident_abs(), self.attrname)
         state = {}
         for attr in self.__dict__.keys():
 
@@ -874,7 +874,7 @@ class ObjConf(AttrConf):
                     # print '    found object',self.get_value().get_ident_abs()
                     state['_ident_value'] = self.get_value().get_ident_abs()
                 else:
-                    print 'WARNING in ObjConf._getstate_specific', self.attrname, 'lost linked object'
+                    print('WARNING in ObjConf._getstate_specific', self.attrname, 'lost linked object')
                     state['_ident_value'] = []
                 # print '  ',
 
@@ -924,7 +924,7 @@ class ObjConf(AttrConf):
                 # print '  linkobj',linkobj.ident
                 self.set_value(linkobj)
             else:
-                print 'WARNING in ObjConf._getstate_specific', self.attrname, 'lost linked object'
+                print('WARNING in ObjConf._getstate_specific', self.attrname, 'lost linked object')
                 self.set_value(BaseObjman('lost_object'))
 
     # def get_valueobj(self):
@@ -1452,7 +1452,7 @@ class IdsConf(ColConf):
 
             # necessary?? see ObjMan.write_xml
             xmltag_tab, xmltag_item_tab, attrname_id_tab = self._tab.xmltag
-            if (attrname_id_tab is None) | (attrname_id_tab is ''):
+            if (attrname_id_tab is None) | (attrname_id_tab == ''):
                 self._attrconfig_id_tab = None
             else:
                 self._attrconfig_id_tab = getattr(self._tab, attrname_id_tab)  # tab = tabman !
@@ -2050,7 +2050,7 @@ class Attrsman:
                         show_parentesis), sep, attrconf.format_value()))
 
     def print_attrs(self, show_unit=True, show_parentesis=False, attrconfigs=None):
-        print 'Attributes of', self._obj._name, 'ident_abs=', self._obj.get_ident_abs()
+        print('Attributes of', self._obj._name, 'ident_abs=', self._obj.get_ident_abs())
         if attrconfigs is None:
             attrconfigs = self.get_configs(structs=STRUCTS_SCALAR)
 
@@ -2099,7 +2099,7 @@ class Attrsman:
         #    print 'WARNING in Attrsman.__getstate__',self,'attrname missing','id',id(self),'id obj',id(self._obj)
 
         if not hasattr(self, '_obj'):
-            print 'WARNING: unknown obj in attrman', self, type(self)
+            print('WARNING: unknown obj in attrman', self, type(self))
             # print '  dir',dir(self)
             # if hasattr(self,'attrname'):
             #    print '    No attrman but attribute',self.attrname
@@ -2412,7 +2412,7 @@ class Tabman(Attrsman):
 
         for _id in ids:
             for attrconf in self.get_configs(structs=STRUCTS_COL):
-                print '  %s[%d] =\t %s' % (attrconf.attrname, _id, attrconf.format_value(_id, show_unit=True))
+                print('  %s[%d] =\t %s' % (attrconf.attrname, _id, attrconf.format_value(_id, show_unit=True)))
 
     def write_csv(self, fd, sep=',', ids=None,
                   attrconfigs=None,
@@ -2681,7 +2681,7 @@ class BaseObjman:
         """
         Export scalars to file feed in csv format.
         """
-        print 'BaseObjman.export_csv', filepath, "*"+sep+"*", 'attrconfigs', attrconfigs, self.get_attrsman()
+        print('BaseObjman.export_csv', filepath, "*"+sep+"*", 'attrconfigs', attrconfigs, self.get_attrsman())
         fd = open(filepath, 'w')
 
         # header
@@ -2887,7 +2887,7 @@ class BaseObjman:
         Called after set state.
         Link internal states and call constant settings.
         """
-        print 'BaseObjman.init_postload_internal', self.ident, 'parent:'
+        print('BaseObjman.init_postload_internal', self.ident, 'parent:')
         # if parent is not None:
         #    print parent.ident
         # else:
@@ -2995,7 +2995,7 @@ class TableMixin(BaseObjman):
             self._is_saved = True
 
         else:
-            print 'WARNING in __getstate__: object %s already saved' % self.ident
+            print('WARNING in __getstate__: object %s already saved' % self.ident)
         return state
 
     def __setstate__(self, state):
@@ -3063,7 +3063,7 @@ class TableMixin(BaseObjman):
         """
         Export scalars to file feed in csv format.
         """
-        print 'TableMixin.export_csv', filepath, "*"+sep+"*"  # ,'attrconfigs',attrconfigs,self.get_attrsman()
+        print('TableMixin.export_csv', filepath, "*"+sep+"*")  # ,'attrconfigs',attrconfigs,self.get_attrsman()
         fd = open(filepath, 'w')
 
         # header
--- a/tools/contributed/sumopy/agilepy/lib_base/exports.py
+++ b/tools/contributed/sumopy/agilepy/lib_base/exports.py
@@ -36,7 +36,7 @@ try:
 
 
 except:
-    print 'WARNING: No Exel export possible. Install openpyxl python package.'
+    print('WARNING: No Exel export possible. Install openpyxl python package.')
     IS_EXCEL = False
 
 # if 'Workbook' in dir():
@@ -45,14 +45,14 @@ except:
 # else:
 #    IS_EXCEL = False
 
-print 'IS_EXCEL', IS_EXCEL
+print('IS_EXCEL', IS_EXCEL)
 
 
 def export_excel(filepath, obj, ids=None, attrconfigs=None,  groupnames=None,
                  is_header=True, is_ident=False, is_timestamp=True,
                  show_parentesis=True, name_id='ID', is_export_not_save=True):
 
-    print 'export_excel'  # ,attrconfigs,'groupnames',groupnames,
+    print('export_excel')  # ,attrconfigs,'groupnames',groupnames,
 
     wb = Workbook()
     if (wb.worksheets) >= 1:
@@ -141,7 +141,7 @@ class CsvExporter(Process):
     def __init__(self,  obj, ident='csvexporter', name='CSV exporter',
                  info='Export data from a CSV file into object',
                  logger=None, **kwargs):
-        print 'CsvExporter.__init__'
+        print('CsvExporter.__init__')
         self._init_common(ident,
                           parent=obj,
                           name=name,
@@ -187,7 +187,7 @@ class CsvExporter(Process):
         #                    ))
 
     def do(self):
-        print 'CsvExporter.do',
+        print('CsvExporter.do',)
         obj = self.parent
         attrsman = self.get_attrsman()
         sep = self.sep
--- a/tools/contributed/sumopy/agilepy/lib_base/geometry.py
+++ b/tools/contributed/sumopy/agilepy/lib_base/geometry.py
@@ -629,7 +629,7 @@ def anglediffs(a1, a2, deg=False):
     out : np.ndarray
         The difference between a1 and a2
     """
-    print 'anglediffs', a1, a2
+    print('anglediffs', a1, a2)
     return wrapanglediffs(a1 - a2, deg=deg)
 
 
@@ -704,6 +704,6 @@ def is_point_within_polygon(pos, shape):
 if __name__ == '__main__':
     a1 = 0.0
     a2 = +0.1
-    print 'a1', a1/np.pi*180
-    print 'a2', a2/np.pi*180
-    print 'anglediff(a1, a2)', anglediff(a1, a2)/np.pi*180
+    print('a1', a1/np.pi*180)
+    print('a2', a2/np.pi*180)
+    print('anglediff(a1, a2)', anglediff(a1, a2)/np.pi*180)
--- a/tools/contributed/sumopy/agilepy/lib_base/imports.py
+++ b/tools/contributed/sumopy/agilepy/lib_base/imports.py
@@ -31,7 +31,7 @@ class CsvImporter(Process):
     def __init__(self,  obj, ident='csvimporter', name='CSV importer',
                  info='Import data from a CSV file into object',
                  logger=None, **kwargs):
-        print 'CsvImporter.__init__'
+        print('CsvImporter.__init__')
         self._init_common(ident,
                           parent=obj,
                           name=name,
@@ -78,7 +78,7 @@ class CsvImporter(Process):
         return 'colname_'+attrname
 
     def do(self):
-        print 'CsvImporter.do',
+        print('CsvImporter.do',)
         obj = self.parent
         attrsman = self.get_attrsman()
         sep = self.sep
--- a/tools/contributed/sumopy/agilepy/lib_base/logger.py
+++ b/tools/contributed/sumopy/agilepy/lib_base/logger.py
@@ -36,7 +36,7 @@ class Logger:
             self._logfile = open(self._filepath, 'w')
             self._logfile.write(ttext+'\n')
         if self._is_stdout:
-            print text
+            print(text)
 
     def add_callback(self, function, key='message'):
         self._callbacks[key] = function
@@ -68,7 +68,7 @@ class Logger:
         # elif type(data)==types.StringType:
         #    print data
         if self._is_stdout:
-            print text
+            print(text)
 
     def stop(self, text="End logging."):
 
@@ -79,4 +79,4 @@ class Logger:
             self._logfile = None
 
         if self._is_stdout:
-            print text
+            print(text)
--- a/tools/contributed/sumopy/agilepy/lib_base/processes.py
+++ b/tools/contributed/sumopy/agilepy/lib_base/processes.py
@@ -162,7 +162,7 @@ class Process(cm.BaseObjman):
         try:
             f = open(filepath, 'wb')
         except:
-            print 'WARNING in save: could not open', filepath
+            print('WARNING in save: could not open', filepath)
             return False
 
         # print '  before',is_not_save_parent,parent,obj.parent
@@ -173,7 +173,7 @@ class Process(cm.BaseObjman):
         try:
             f = open(filepath, 'rb')
         except:
-            print 'WARNING in load_options: could not open', filepath
+            print('WARNING in load_options: could not open', filepath)
             return None
 
         # try:
@@ -314,14 +314,14 @@ class CmlMixin:
         setattr(self, option, default)
 
     def get_options(self):
-        print '\nget_options'
+        print('\nget_options')
         options = Options()
         for attrconfig in self.get_attrsman().get_configs(is_all=True):
             if self.optiongroupname in attrconfig.groupnames:
-                print '  option', attrconfig.attrname, attrconfig.groupnames, 'is path', attrconfig.get_metatype() in self.pathmetatypes, 'has cmlmap', hasattr(attrconfig, 'cmlvaluemap')
+                print('  option', attrconfig.attrname, attrconfig.groupnames, 'is path', attrconfig.get_metatype() in self.pathmetatypes, 'has cmlmap', hasattr(attrconfig, 'cmlvaluemap'))
                 is_enabled = True
                 if hasattr(attrconfig, 'is_enabled'):
-                    print ' is_enabled=', attrconfig.is_enabled(self), attrconfig.get_value()
+                    print(' is_enabled=', attrconfig.is_enabled(self), attrconfig.get_value())
                     is_enabled = attrconfig.is_enabled(self)
                 if is_enabled:  # disabeled options are simply not added
                     if hasattr(attrconfig, 'cmlvaluemap'):
@@ -335,10 +335,10 @@ class CmlMixin:
         return options
 
     def print_options(self):
-        print 'Options of process ident:', self.ident
-        print ' Keywordoptions:'
+        print('Options of process ident:', self.ident)
+        print(' Keywordoptions:')
         for attrconfig in self.get_attrsman().get_configs(filtergroupnames=[self.optiongroupname]):
-            print '  ', attrconfig.attrname, '=', attrconfig.get_value()
+            print('  ', attrconfig.attrname, '=', attrconfig.get_value())
 
     def reset_cml(self, cml):
         self._command = cml
@@ -352,7 +352,7 @@ class CmlMixin:
         # if self.workdirpath is not None
         options = self.get_options()
         optionstr = options.get_optionstring()
-        print 'get_cml command', self._command, 'workdirpath', self.workdirpath
+        print('get_cml command', self._command, 'workdirpath', self.workdirpath)
         if True:  # self.workdirpath is None:
             if is_without_command:
                 cml = optionstr
@@ -380,8 +380,8 @@ class CmlMixin:
 
         attrsman.pid.set(self._subprocess.pid)
         attrsman.status.set('running')
-        print 'run_cml cml=', cml
-        print '  pid = ', self.pid, 'cwd', wd
+        print('run_cml cml=', cml)
+        print('  pid = ', self.pid, 'cwd', wd)
         if not self.is_run_background:
             self._subprocess.wait()
             # if self.workdirpath is not None:
--- a/tools/contributed/sumopy/agilepy/lib_base/test_classman_classes.py
+++ b/tools/contributed/sumopy/agilepy/lib_base/test_classman_classes.py
@@ -27,31 +27,31 @@ import xmlman as xm
 
 
 def on_event_delattr(attrconfig):
-    print 'EVENT: Attribute', attrconfig.attrname, 'will be deleted!!'
+    print('EVENT: Attribute', attrconfig.attrname, 'will be deleted!!')
 
 
 def on_event_setattr(attrconfig):
-    print 'EVENT: Attribute', attrconfig.attrname, 'has been set to a new value', attrconfig.format_value()
+    print('EVENT: Attribute', attrconfig.attrname, 'has been set to a new value', attrconfig.format_value())
 
 
 def on_event_getattr(attrconfig):
-    print 'EVENT: Attribute', attrconfig.attrname, 'has been retrieved the value', attrconfig.format_value()
+    print('EVENT: Attribute', attrconfig.attrname, 'has been retrieved the value', attrconfig.format_value())
 
 
 def on_event_additem(attrconfig, keys):
-    print 'EVENT: Attribute', attrconfig.attrname, ':added keys:', keys
+    print('EVENT: Attribute', attrconfig.attrname, ':added keys:', keys)
 
 
 def on_event_delitem(attrconfig, keys):
-    print 'EVENT: Attribute', attrconfig.attrname, ':delete keys:', keys
+    print('EVENT: Attribute', attrconfig.attrname, ':delete keys:', keys)
 
 
 def on_event_setitem(attrconfig, keys):
-    print 'EVENT: Attribute', attrconfig.attrname, ':set keys:', keys
+    print('EVENT: Attribute', attrconfig.attrname, ':set keys:', keys)
 
 
 def on_event_getitem(attrconfig, keys):
-    print 'EVENT: Attribute', attrconfig.attrname, ':get keys:', keys
+    print('EVENT: Attribute', attrconfig.attrname, ':get keys:', keys)
 
 
 class Segments(ArrayObjman):
@@ -125,7 +125,7 @@ class Polylines (ArrayObjman):
                 ]
         """
         vertices = []
-        print 'draw', self.ident
+        print('draw', self.ident)
         for i in xrange(1, len(pointvertices)):
             vertices.append([pointvertices[i-1], pointvertices[i]])
         n_vert = len(vertices)
@@ -133,7 +133,7 @@ class Polylines (ArrayObjman):
         cod = []
         #import string
         clist = np.array(['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p'], np.object)
-        print '  ', len(vertices), clist[:len(vertices)]
+        print('  ', len(vertices), clist[:len(vertices)])
         ids = self.segments.value.suggest_ids(len(vertices))
         ids_segs = self.segments.value.add_rows(ids=ids, vertices=vertices, ids_parent=n_vert*[_id], ids_ref=clist[ids])
         self.ids_segments[_id] = list(ids_segs)  # put here list, otherwise numpy thinks it is a numeric array
@@ -300,7 +300,7 @@ class TestClass(BaseObjman):
         """
         True if position greater than thhreshold.
         """
-        print 'on_is_pos_ok', self.x > self.x_thresh
+        print('on_is_pos_ok', self.x > self.x_thresh)
         return self.x > self.x_thresh
 
 
@@ -331,7 +331,7 @@ class TestClass2(BaseObjman):
         self.child1 = attrsman.add(ObjConf(TestClass('child1', self))
                                    )
 
-        print 'TestClass2.child1', self.child1
+        print('TestClass2.child1', self.child1)
 
         self.child3 = attrsman.add(ObjConf(TestClass3('child3', self))
                                    )
@@ -368,7 +368,7 @@ class TestTabman(BaseObjman):
         attrsman.add_rows(5)
         attrsman.streetname[3] = 'ssss'
         attrsman.streetname[[1, 2]] = ['aa', 55]
-        print 'test get', attrsman.streetname[[1, 2]]
+        print('test get', attrsman.streetname[[1, 2]])
         # self.streetname[1]+='zzz'
         attrsman.del_rows([1, 3])
         attrsman.del_row(5)
@@ -485,9 +485,9 @@ class TestTableObjMan(TableObjman):
         """
         True if position greater than thhreshold.
         """
-        print 'on_del_row', id_row
+        print('on_del_row', id_row)
         self.del_row(id_row)
-        print '  ids after del', self.get_ids()
+        print('  ids after del', self.get_ids())
 
 
 class TestTableObjManNocols(TableObjman):
--- a/tools/contributed/sumopy/agilepy/lib_base/test_classman_save.py
+++ b/tools/contributed/sumopy/agilepy/lib_base/test_classman_save.py
@@ -105,17 +105,17 @@ if 0 | is_all:
     # save/load
     save_obj(lines, 'test_lines.obj')
     del lines
-    print '\nreload'+60*'.'
+    print('\nreload'+60*'.')
     lines = load_obj('test_lines.obj')
     lines.print_attrs()
 
-    print 'direct access vertex=\n', lines.vertices.value
-    print 'direct access polygons=\n', lines.polygons.value
-    print 'id for index bb22=', lines.ids_sumo.get_id_from_index('bb22')
-    print 'ids for index bb22,cc333=', lines.ids_sumo.get_ids_from_indices(['bb22', 'cc333'])
+    print('direct access vertex=\n', lines.vertices.value)
+    print('direct access polygons=\n', lines.polygons.value)
+    print('id for index bb22=', lines.ids_sumo.get_id_from_index('bb22'))
+    print('ids for index bb22,cc333=', lines.ids_sumo.get_ids_from_indices(['bb22', 'cc333']))
     lines.del_row(2)
     lines.print_attrs()
-    print 'id for index bb22=', lines.ids_sumo.get_id_from_index('cc333')
+    print('id for index bb22=', lines.ids_sumo.get_id_from_index('cc333'))
 
 if 0 | is_all:
     class Lines(ArrayObjman):
@@ -166,19 +166,19 @@ if 0 | is_all:
     # lines.add_rows(3)
     lines.add_rows(3, vertices=vertices, polygons=polygons)
     lines.print_attrs()
-    print 'direct access vertex=\n', lines.vertices.value
-    print 'direct access polygons=\n', lines.polygons.value
+    print('direct access vertex=\n', lines.vertices.value)
+    print('direct access polygons=\n', lines.polygons.value)
 
     # save/load
     save_obj(lines, 'test_lines.obj')
     del lines
-    print '\nreload'+60*'.'
+    print('\nreload'+60*'.')
     lines = load_obj('test_lines.obj')
 
     # print
     lines.print_attrs()
-    print 'direct access vertex=\n', lines.vertices.value
-    print 'direct access polygons=\n', lines.polygons.value
+    print('direct access vertex=\n', lines.vertices.value)
+    print('direct access polygons=\n', lines.polygons.value)
 
     vertices2 = [
         [[0.0, 0.0, 0.0], [0.2, 0.0, 0.0]],  # 0
@@ -325,9 +325,9 @@ if 0 | is_all:
     demand.get_attrsman().print_attrs()
     odintervals.print_attrs()
     for id_odmodes in odintervals.get_ids():
-        print '\nMODE:'
+        print('\nMODE:')
         odintervals.odmodes[id_odmodes].print_attrs()
-        print '\nTRIPS:'
+        print('\nTRIPS:')
         for id_odtrips in odmodes.get_ids():
             odmodes.odtrips[id_odtrips].print_attrs()
 
@@ -335,16 +335,16 @@ if 0 | is_all:
     # save/load
     save_obj(demand, 'test_demand_array.obj')
     del demand
-    print '\nreload'+60*'.'
+    print('\nreload'+60*'.')
     demand = load_obj('test_demand_array.obj')
 
     # print
     demand.get_attrsman().print_attrs()
     odintervals.print_attrs()
     for id_odmodes in odintervals.get_ids():
-        print '\nMODE:'
+        print('\nMODE:')
         odintervals.odmodes[id_odmodes].print_attrs()
-        print '\nTRIPS:'
+        print('\nTRIPS:')
         for id_odtrips in odmodes.get_ids():
             odmodes.odtrips[id_odtrips].print_attrs()
 
@@ -457,25 +457,25 @@ if 0 | is_all:  # OLD BROKEN??!!
     demand.get_attrsman().print_attrs()
     odintervals.print_attrs()
     for id_odmodes in odintervals.get_ids():
-        print '\nMODE:'
+        print('\nMODE:')
         odintervals.odmodes[id_odmodes].print_attrs()
-        print '\nTRIPS:'
+        print('\nTRIPS:')
         for id_odtrips in odmodes.get_ids():
             odmodes.odtrips[id_odtrips].print_attrs()
 
     # save/load
     save_obj(demand, 'test_demand.obj')
     del demand
-    print '\nreload'+60*'.'
+    print('\nreload'+60*'.')
     demand = load_obj('test_demand.obj')
 
     # print
     demand.get_attrsman().print_attrs()
     odintervals.print_attrs()
     for id_odmodes in odintervals.get_ids():
-        print '\nMODE:'
+        print('\nMODE:')
         odintervals.odmodes[id_odmodes].print_attrs()
-        print '\nTRIPS:'
+        print('\nTRIPS:')
         for id_odtrips in odmodes.get_ids():
             odmodes.odtrips[id_odtrips].print_attrs()
 
@@ -534,7 +534,7 @@ if 0 | is_all:  # OK
     net.nodes.print_attrs()
     save_obj(net, 'test_net.obj')
     del net
-    print '\nreload'+60*'.'
+    print('\nreload'+60*'.')
     net_new = load_obj('test_net.obj')
     net_new.get_attrsman().print_attrs()
     net_new.edges.print_attrs()
@@ -564,23 +564,23 @@ if 0 | is_all:
                   streetname=['a', 'bb', 'ccc', 'dddd'],
                   )
 
-    print 'direct access: tab1.surname.value', tab1.surname.value
-    print 'direct access: tab1.streetname.value', tab1.streetname.value
+    print('direct access: tab1.surname.value', tab1.surname.value)
+    print('direct access: tab1.streetname.value', tab1.streetname.value)
     tab1.print_attrs()
 
     save_obj(tab1, 'test_tab.obj')
     del tab1
-    print '\nreload'+60*'.'
+    print('\nreload'+60*'.')
     tab1_new = load_obj('test_tab.obj')
     tab1_new.print_attrs()
-    print 'direct access: tab1_new.surname.value', tab1_new.surname.value
-    print 'direct access: tab1_new.streetname.value', tab1_new.streetname.value
+    print('direct access: tab1_new.surname.value', tab1_new.surname.value)
+    print('direct access: tab1_new.streetname.value', tab1_new.streetname.value)
 if 0 | is_all:
     tab1 = TableObjman('tab1')
-    print '\ntab1.ident', tab1.ident
+    print('\ntab1.ident', tab1.ident)
 
     tab2 = TableObjman('tab2', parent=tab1)
-    print '\ntab2.ident', tab2.ident
+    print('\ntab2.ident', tab2.ident)
 
     # TODO: seperate attrname from linked obj ident because restrictive and makes problems with multiple tab destinations
     # this should be possible ...following the path of attrnames of absident
@@ -620,24 +620,24 @@ if 0 | is_all:
 
     save_obj(tab1, 'test_tab.obj')
     del tab1
-    print '\nreload'+60*'.'
+    print('\nreload'+60*'.')
     tab1_new = load_obj('test_tab.obj')
 
     tab1_new.print_attrs()
     tab2_new = tab1_new.tab2.get_valueobj()
     tab2_new.print_attrs()
-    print tab2_new.get_ident_abs()
+    print(tab2_new.get_ident_abs())
 
 
 if False | is_all:  # False:#True:
     obj = TestTabman()
 
-    print 'obj.ident', obj.ident
+    print('obj.ident', obj.ident)
 
     obj.attrsman.print_attrs()
     save_obj(obj, 'test_obj.obj')
     del obj
-    print '\nreload'+60*'.'
+    print('\nreload'+60*'.')
     obj_new = load_obj('test_obj.obj')
     obj_new.attrsman.print_attrs()
     # streetname
@@ -648,7 +648,7 @@ if False | is_all:  # False:#True:
 if 0 | is_all:  # False:#True:  ###!!!!!!!!!!!!!!!!check this : failed to reload!!
     obj = TestTableObjMan()
 
-    print 'obj.ident', obj.ident
+    print('obj.ident', obj.ident)
 
     obj.x.set(1.0/3)
     # obj.is_pos_ok.set(True)
@@ -656,7 +656,7 @@ if 0 | is_all:  # False:#True:  ###!!!!!
     obj.print_attrs()
     save_obj(obj, 'test_obj.obj')
     del obj
-    print '\nreload'+60*'.'
+    print('\nreload'+60*'.')
     obj_new = load_obj('test_obj.obj')
     obj_new.x.set(2.0/3)
     obj_new.print_attrs()
@@ -667,12 +667,12 @@ if 0 | is_all:  # False:#True:  ###!!!!!
     #
 
 if 0 | is_all:
-    print 'TestTableObjMan export'
+    print('TestTableObjMan export')
     obj = TestTableObjMan()
     obj.get_attrsman().print_attrs()
     xm.write_obj_to_xml(obj, 'test_obj.xml')
     del obj
-    print '\nreload'+60*'.'
+    print('\nreload'+60*'.')
     obj_new = load_obj('test_obj.obj')
     obj_new.get_attrsman().print_attrs()
     # sys.exit()
@@ -689,7 +689,7 @@ if 0 | is_all:
     save_obj(obj2, 'test_obj2.obj')
     xm.write_obj_to_xml(obj2, 'test_obj2.xml')
     del obj2
-    print '\nreload'+60*'.'
+    print('\nreload'+60*'.')
     obj2_new = load_obj('test_obj2.obj')
     obj2_new.get_attrsman().print_attrs()
 
@@ -699,9 +699,9 @@ if 0 | is_all:
 
 if 0 | is_all:  # False:#True:
     obj = TestClass()
-    print 'obj.ident', obj.ident
+    print('obj.ident', obj.ident)
 
-    print 'This is the value of the attribute: obj.x=', obj.x
+    print('This is the value of the attribute: obj.x=', obj.x)
     # print 'This is the configuration instance of the attribute x',obj.attrsman.x
     obj.get_attrsman().print_attrs()
     # obj.get_attrsman().x.plugin.add_event(EVTSET,on_event_setattr)
@@ -712,16 +712,16 @@ if 0 | is_all:  # False:#True:
     # print 'Test func...',obj.attrsman.testfunc.get()
     # obj.get_attrsman().testfunc.add_event(EVTGET,on_event_getattr)
     # obj.get_attrsman().testfunc.get()
-    print 'obj.get_attrsman().x.get()', obj.get_attrsman().x.get(), 'is_modified', obj.is_modified()
+    print('obj.get_attrsman().x.get()', obj.get_attrsman().x.get(), 'is_modified', obj.is_modified())
     obj.get_attrsman().x.set(1.0)
-    print 'obj.get_attrsman().x.get()', obj.get_attrsman().x.get(), 'is_modified', obj.is_modified()
+    print('obj.get_attrsman().x.get()', obj.get_attrsman().x.get(), 'is_modified', obj.is_modified())
 
     # obj.attrsman.delete('x')
     obj.get_attrsman().print_attrs()
     save_obj(obj, 'test_obj.obj')
     xm.write_obj_to_xml(obj, 'test_obj.xml')
     del obj
-    print '\nreload'+60*'.'
+    print('\nreload'+60*'.')
     obj_new = load_obj('test_obj.obj')
     obj_new.get_attrsman().print_attrs()
     # print 'obj.get_attrsman().x.get_formatted()=',obj.get_attrsman().x.get_formatted()
@@ -729,12 +729,12 @@ if 0 | is_all:  # False:#True:
 
 if 1 | is_all:
     save_obj(drawing, 'test_drawing.obj')
-    print '\nreload'+60*'.'
+    print('\nreload'+60*'.')
     obj_new = load_obj('test_drawing.obj')
     obj_new.get_attrsman().print_attrs()
 
     obj_new.collections.print_attrs()
 
     tab_check, ids_check = obj_new.collections.tab_id_lists[1][1]
-    print '  check tab, ids=', tab_check, ids_check
+    print('  check tab, ids=', tab_check, ids_check)
     tab_check.print_attrs()
--- a/tools/contributed/sumopy/agilepy/lib_base/test_classman_tables.py
+++ b/tools/contributed/sumopy/agilepy/lib_base/test_classman_tables.py
@@ -25,7 +25,7 @@ is_all = 0
 if 1 | is_all:
     pass
 if 1 | is_all:
-    print 'Lines, Poly example'
+    print('Lines, Poly example')
 
     ###########################################################################
     # Instance creation
@@ -54,17 +54,17 @@ if 1 | is_all:
     # lines.add_rows(3)
     lines.add_rows(3, vertices=vertices, polygons=polygons, ids_sumo=ids_sumo)
     lines.print_attrs()
-    print '\n  indexmap', lines.ids_sumo.get_indexmap()
-    print 'direct access vertex=\n', lines.vertices.value
-    print 'id for index bb22=', lines.ids_sumo.get_id_from_index('bb22')
-    print 'ids for index bb22,cc333=', lines.ids_sumo.get_ids_from_indices(['bb22', 'cc333'])
+    print('\n  indexmap', lines.ids_sumo.get_indexmap())
+    print('direct access vertex=\n', lines.vertices.value)
+    print('id for index bb22=', lines.ids_sumo.get_id_from_index('bb22'))
+    print('ids for index bb22,cc333=', lines.ids_sumo.get_ids_from_indices(['bb22', 'cc333']))
     # lines.del_row(2)
     lines.print_attrs()
-    print 'id for index bb22=', lines.ids_sumo.get_id_from_index('cc333')
+    print('id for index bb22=', lines.ids_sumo.get_id_from_index('cc333'))
 
     lines.ids_sumo[2] = 'xy'
 
-    print '\n  indexmap', lines.ids_sumo.get_indexmap()
+    print('\n  indexmap', lines.ids_sumo.get_indexmap())
     lines.print_attrs()
 if 0 | is_all:
     class Lines(TableObjman):
@@ -124,13 +124,13 @@ if 0 | is_all:
     # lines.add_rows(3)
     lines.add_rows(3, vertices=vertices, polygons=polygons, ids_sumo=ids_sumo)
     lines.print_attrs()
-    print 'direct access vertex=\n', lines.vertices.value
-    print 'direct access polygons=\n', lines.polygons.value
-    print 'id for index bb22=', lines.ids_sumo.get_id_from_index('bb22')
-    print 'ids for index bb22,cc333=', lines.ids_sumo.get_ids_from_indices(['bb22', 'cc333'])
+    print('direct access vertex=\n', lines.vertices.value)
+    print('direct access polygons=\n', lines.polygons.value)
+    print('id for index bb22=', lines.ids_sumo.get_id_from_index('bb22'))
+    print('ids for index bb22,cc333=', lines.ids_sumo.get_ids_from_indices(['bb22', 'cc333']))
     lines.del_row(2)
     lines.print_attrs()
-    print 'id for index bb22=', lines.ids_sumo.get_id_from_index('cc333')
+    print('id for index bb22=', lines.ids_sumo.get_id_from_index('cc333'))
 if 0 | is_all:
     class Lines(ArrayObjman):
 
@@ -180,8 +180,8 @@ if 0 | is_all:
     # lines.add_rows(3)
     lines.add_rows(3, vertices=vertices, polygons=polygons)
     lines.print_attrs()
-    print 'direct access vertex=\n', lines.vertices.value
-    print 'direct access polygons=\n', lines.polygons.value
+    print('direct access vertex=\n', lines.vertices.value)
+    print('direct access polygons=\n', lines.polygons.value)
 
 if 0 | is_all:
     class ZonesTab(ArrayObjman):
@@ -292,9 +292,9 @@ if 0 | is_all:
     odintervals.print_attrs()
 
     for id_odmodes in odintervals.get_ids():
-        print '\nMODE:'
+        print('\nMODE:')
         odintervals.odmodes[id_odmodes].print_attrs()
-        print '\nTRIPS:'
+        print('\nTRIPS:')
         for id_odtrips in odmodes.get_ids():
             odmodes.odtrips[id_odtrips].print_attrs()
 
@@ -408,9 +408,9 @@ if 0 | is_all:
     odintervals.print_attrs()
 
     for id_odmodes in odintervals.get_ids():
-        print '\nMODE:'
+        print('\nMODE:')
         odintervals.odmodes[id_odmodes].print_attrs()
-        print '\nTRIPS:'
+        print('\nTRIPS:')
         for id_odtrips in odmodes.get_ids():
             odmodes.odtrips[id_odtrips].print_attrs()
 
@@ -483,16 +483,16 @@ if 0 | is_all:
                   streetname=['a', 'bb', 'ccc', 'dddd'],
                   )
 
-    print 'direct access: tab1.surname.value', tab1.surname.value
+    print('direct access: tab1.surname.value', tab1.surname.value)
     tab1.print_attrs()
 
 if 0 | is_all:
 
     tab1 = TableObjman('tab1')
-    print '\ntab1.ident', tab1.ident
+    print('\ntab1.ident', tab1.ident)
 
     tab2 = TableObjman('tab2', parent=tab1)
-    print '\ntab2.ident', tab2.ident
+    print('\ntab2.ident', tab2.ident)
 
     # TODO: seperate attrname from linked obj ident because restrictive and makes problems with multiple tab destinations
     # this should be possible ...following the path of attrnames of absident
@@ -534,7 +534,7 @@ if 0 | is_all:
 if 0 | is_all:
     obj = TestTabman()
 
-    print '\nobj.ident', obj.ident
+    print('\nobj.ident', obj.ident)
 
     # streetname
     # print 'This is the value of the attribute: obj.streetname=',obj.streetname
@@ -545,7 +545,7 @@ if 0 | is_all:
 if 0 | is_all:
     obj = TestTableObjMan()
 
-    print '\nobj.ident', obj.ident
+    print('\nobj.ident', obj.ident)
 
     # streetname
     # print 'This is the value of the attribute: obj.streetname=',obj.streetname
--- a/tools/contributed/sumopy/agilepy/lib_base/xmlman.py
+++ b/tools/contributed/sumopy/agilepy/lib_base/xmlman.py
@@ -31,7 +31,7 @@ def write_obj_to_xml(obj, filepath,
     try:
         fd = open(filepath, 'w')
     except:
-        print 'WARNING in write_obj_to_xml: could not open', filepath
+        print('WARNING in write_obj_to_xml: could not open', filepath)
         return False
     fd.write('<?xml version="1.0" encoding="%s"?>\n' % encoding)
     indent = 0
--- a/tools/contributed/sumopy/agilepy/lib_misc/docgen.py
+++ b/tools/contributed/sumopy/agilepy/lib_misc/docgen.py
@@ -400,7 +400,7 @@ class Document:
 
     def include_graphics(self, filename, options=None, is_centered=True,
                          method='matplotlib', label=None, caption=None, envoptions='h!'):
-        print 'include_graphics ', filename
+        print('include_graphics ', filename)
         path_file = path.join(self.workdir, filename)
         if options is None:
             options = 'width = \\textwidth'
@@ -459,7 +459,7 @@ class Document:
             self.f.write("""\\end{document}\n""")
         self.f.close()
         if self.is_compile:
-            print 'compile latex ', self.path_file
+            print('compile latex ', self.path_file)
             system('pdflatex ' + self.path_file)
 
 
--- a/tools/contributed/sumopy/agilepy/lib_wx/mainframe.py
+++ b/tools/contributed/sumopy/agilepy/lib_wx/mainframe.py
@@ -392,12 +392,12 @@ class AgileMainframe(AgileToolbarFrameMi
         #    event.Skip()
 
     def on_save(self, event):
-        print 'save it!!'
+        print('save it!!')
 
     def on_open(self, event):
         """Open a document"""
         #wildcards = CreateWildCards() + "All files (*.*)|*.*"
-        print 'open it!!'
+        print('open it!!')
 
     def destroy(self):
         """Destroy this object"""
@@ -408,7 +408,7 @@ class AgileMainframe(AgileToolbarFrameMi
 
     def on_close(self, event):
         # self.Close(True)
-        print 'Mainframe.on_close'
+        print('Mainframe.on_close')
         # pass
         self.destroy()
 
--- a/tools/contributed/sumopy/agilepy/lib_wx/objpanel.py
+++ b/tools/contributed/sumopy/agilepy/lib_wx/objpanel.py
@@ -910,7 +910,7 @@ class ChoiceWidgetContainer(WidgetContai
             #ind = self._choicenames.index(value)
             ind = self._choicevalues.index(val)
         except:
-            print 'WARNING in ChoiceWidgetContainer.set_widgetvalue: %s with value "%s" not in choice list' % (self._attrconf.attrname, val)
+            print('WARNING in ChoiceWidgetContainer.set_widgetvalue: %s with value "%s" not in choice list' % (self._attrconf.attrname, val))
             return
         # print '  ind',ind,self.valuewidget
         if self._attrconf.is_writable():
@@ -2268,7 +2268,7 @@ class TableGrid(AttrBase, gridlib.PyGrid
                     attrconf[id] = value
                 else:
                     # TODO: for other types, like color or arrays, this must be done beforehand
-                    print 'WARNING in SetValue: cannot write to this type:', tt
+                    print('WARNING in SetValue: cannot write to this type:', tt)
             else:
                 # readonly
                 pass
@@ -2692,7 +2692,7 @@ class TabPanel(AttrBase, gridlib.Grid):
         if dlg.ShowModal() == wx.ID_OK:
             # This returns a Python list of files that were selected.
             path = dlg.GetPath()
-            print 'on_export_csv', type(path), path
+            print('on_export_csv', type(path), path)
             if type(path) in STRINGTYPES:
                 self.tab.export_csv(path, sep=',',
                                     attrconfigs=self.GetTable().get_valueconfigs(),
@@ -2914,7 +2914,7 @@ class TabPanel(AttrBase, gridlib.Grid):
         table = self.GetTable()
         id, attrconf = table.get_id_attrconf(event.GetRow(), event.GetCol())
         #miniframe=DataMiniFrame( self, table.obj, id =id, attrs = [attr])
-        print 'on_edit_cell_miniframe EventObject=', id, attrconf
+        print('on_edit_cell_miniframe EventObject=', id, attrconf)
         dlg = ObjPanelDialog(self, table.obj, id, attrconfigs=[attrconf], size=(350, 200),
                              #style = wxCAPTION | wxSYSTEM_MENU | wxTHICK_FRAME
                              func_apply=self.func_apply,
@@ -2984,7 +2984,7 @@ class TabPanel(AttrBase, gridlib.Grid):
         evt.Skip()
 
     def OnRightDown(self, event):
-        print "hello", self.GetSelectedRows()
+        print("hello", self.GetSelectedRows())
 
     def apply(self):
         """
@@ -4315,7 +4315,7 @@ class NaviPanelMixin:
         event.Skip()
 
     def on_export_excel(self, event):
-        print 'on_export_excel'
+        print('on_export_excel')
         obj = self.objpanel.get_obj()
 
         #dirpath = self.get_scenario().get_workdirpath()
@@ -4334,7 +4334,7 @@ class NaviPanelMixin:
             return
 
     def on_export_csv(self, event):
-        print 'on_export_csv'
+        print('on_export_csv')
         obj = self.objpanel.get_obj()
 
         #dirpath = self.get_scenario().get_workdirpath()
@@ -4678,7 +4678,7 @@ if __name__ == '__main__':
     if n_test == 0:
         # simple scalar parameters, no table
         obj = TestClass()
-        print 'obj.ident', obj.ident
+        print('obj.ident', obj.ident)
 
     elif n_test == 1:
         obj = TestTableObjMan()
@@ -4699,7 +4699,7 @@ if __name__ == '__main__':
         obj = drawing
     elif n_test == -5:
         save_obj(drawing, 'test_drawing.obj')
-        print '\nreload'+60*'.'
+        print('\nreload'+60*'.')
         obj = load_obj('test_drawing.obj')
         obj.get_attrsman().print_attrs()
 
--- a/tools/contributed/sumopy/agilepy/lib_wx/ogleditor.py
+++ b/tools/contributed/sumopy/agilepy/lib_wx/ogleditor.py
@@ -44,7 +44,7 @@ if __name__ == '__main__':
     use for debugging
     python ogleditor.py --debug > debug.txt 2>&1
     """
-    print __copyright__
+    print(__copyright__)
 
 ###############################################################################
 # IMPORTS
@@ -63,7 +63,7 @@ try:
     import numpy as np
 
 except ImportError:
-    raise ImportError, "Required dependencies numpy or OpenGL not present"
+    raise ImportError("Required dependencies numpy or OpenGL not present")
 
 if __name__ == '__main__':
     try:
@@ -447,7 +447,7 @@ class SelectToolMixin(BaseTool):
             # calculate detectwidth based on current resolution
             self.detectwidth = self._canvas.get_resolution()*self.detectpix
 
-        print 'pick_all', self.detectwidth, self.detectpix, self._canvas.get_resolution()
+        print('pick_all', self.detectwidth, self.detectpix, self._canvas.get_resolution())
 
         self._idcounter = 0
         is_draw = False
@@ -1420,7 +1420,7 @@ class StretchTool(HandleTool):
         """
         Definively execute operation on currently selected drawobjects.
         """
-        print 'Stretch', self.is_tool_allowed_on_selection()
+        print('Stretch', self.is_tool_allowed_on_selection())
         if self.is_tool_allowed_on_selection():
             if not self.is_animated:
                 return self.begin_animation(event)
@@ -4274,7 +4274,7 @@ class OGLnavcanvas(wx.Panel):
         event.Skip()
 
     def on_test(self, event=None):
-        print 'this is a test'
+        print('this is a test')
 
 
 class OGLcanvas(glcanvas.GLCanvas):
@@ -4523,7 +4523,7 @@ class OGLcanvas(glcanvas.GLCanvas):
             self.OnDraw(*args, **kwargs)
             # print 'draw',self.lastx,self.lasty,self.x,self.y
         except:
-            print 'WARNING in draw: unable to set context'
+            print('WARNING in draw: unable to set context')
 
     def set_drawing(self, drawing):
         if self._drawing != drawing:
@@ -4884,7 +4884,7 @@ class OGleditor(wx.Panel):
         #wx.EVT_SIZE(self, self.on_size)
 
     def on_test(self, event=None, drawing=None):
-        print '\non_test'
+        print('\non_test')
 
         if drawing is None:
             drawing = OGLdrawing()
@@ -5016,7 +5016,7 @@ class OGleditor(wx.Panel):
                 [[0.0, -2.0, 0.0], [-2.0, -2.0, 0.0], [-2.0, 0.0, 0.0]],  # 1 red
             ]
 
-            print '  vertices_polygon\n', vertices_poly
+            print('  vertices_polygon\n', vertices_poly)
             polygons.add_drawobjs(vertices_poly,
                                   colors_poly)
             polygons.add_drawobj([[5.0, -2.0, 0.0], [3.0, -2.0, 0.0], [3.0, 0.0, 0.0]],
@@ -5169,7 +5169,7 @@ if __name__ == '__main__':
             #                    shortkey='Ctrl+t',info='Draw test objects')
 
         def on_test(self, event=None):
-            print '\non_test'
+            print('\non_test')
             vertices = np.array([
                 [[0.0, 0.0, 0.0], [0.2, 0.0, 0.0]],  # 0 green
                 [[0.0, 0.0, 0.0], [0.0, 0.9, 0.0]],  # 1 red
@@ -5309,7 +5309,7 @@ if __name__ == '__main__':
                     [[0.0, -2.0, 0.0], [-2.0, -2.0, 0.0], [-2.0, 0.0, 0.0]],  # 1 red
                 ]
 
-                print '  vertices_polygon\n', vertices_poly
+                print('  vertices_polygon\n', vertices_poly)
                 polygons.add_drawobjs(vertices_poly,
                                       colors_poly)
                 polygons.add_drawobj([[5.0, -2.0, 0.0], [3.0, -2.0, 0.0], [3.0, 0.0, 0.0]],
--- a/tools/contributed/sumopy/agilepy/lib_wx/processdialog.py
+++ b/tools/contributed/sumopy/agilepy/lib_wx/processdialog.py
@@ -392,7 +392,7 @@ class ProcessDialogInteractive(ProcessDi
             # print 'call step'
             self.process.step()
         else:
-            print '  Simulation finished'
+            print('  Simulation finished')
             self.timer.Stop()
 
     def on_stop(self, event=None):
@@ -451,7 +451,7 @@ class ProcessDialogInteractive(ProcessDi
         # self.Update()
 
     def write_message(self, text, **kwargs):
-        print 'write_message', text
+        print('write_message', text)
         self.statusbar.write_message(text)
 
     def make_browser(self):
--- a/tools/contributed/sumopy/agilepy/lib_wx/test_app.py
+++ b/tools/contributed/sumopy/agilepy/lib_wx/test_app.py
@@ -31,11 +31,11 @@ if __name__ == '__main__':
     except:
         APPDIR = os.path.dirname(os.path.abspath(sys.argv[0]))
     AGILEDIR = os.path.join(APPDIR, '..')
-    print 'APPDIR,AGILEDIR', APPDIR, AGILEDIR
+    print('APPDIR,AGILEDIR', APPDIR, AGILEDIR)
     sys.path.append(AGILEDIR)
     libpaths = [AGILEDIR, os.path.join(AGILEDIR, "lib_base"), os.path.join(AGILEDIR, "lib_wx"), ]
     for libpath in libpaths:
-        print '  libpath=', libpath
+        print('  libpath=', libpath)
         lp = os.path.abspath(libpath)
         if not lp in sys.path:
             # print ' append',lp
@@ -108,15 +108,15 @@ class MyApp(wx.App):
                                            shortkey='Ctrl+s', info='save it out')
 
     def on_save(self, event):
-        print 'save it!!'
+        print('save it!!')
 
     def on_open(self, event):
         """Open a document"""
         #wildcards = CreateWildCards() + "All files (*.*)|*.*"
-        print 'open it!!'
+        print('open it!!')
 
     def on_test(self, event=None):
-        print '\non_test'
+        print('\non_test')
         vertices = np.array([
             [[0.0, 0.0, 0.0], [0.2, 0.0, 0.0]],  # 0 green
             [[0.0, 0.0, 0.0], [0.0, 0.9, 0.0]],  # 1 red
@@ -202,7 +202,7 @@ class MyApp(wx.App):
                 [[0.0, -2.0, 0.0], [-2.0, -2.0, 0.0], [-2.0, 0.0, 0.0]],  # 1 red
             ], np.object)
 
-            print '  vertices_polygon\n', vertices_poly
+            print('  vertices_polygon\n', vertices_poly)
             polygons.add_drawobjs(vertices_poly,
                                   colors_poly)
             drawing.add_drawobj(polygons)
--- a/tools/contributed/sumopy/agilepy/lib_wx/test_glcanvas.py
+++ b/tools/contributed/sumopy/agilepy/lib_wx/test_glcanvas.py
@@ -45,7 +45,7 @@ try:
     import numpy as np
 
 except ImportError:
-    raise ImportError, "Required dependency OpenGL not present"
+    raise ImportError("Required dependency OpenGL not present")
 
 import sys
 import os
@@ -309,8 +309,8 @@ class BaseTool(cm.BaseObjman):
         """
         Called from options panel.
         """
-        print 'set_options', self.ident
-        print '  event=', event
+        print('set_options', self.ident)
+        print('  event=', event)
         pass
 
     def set_statusbar(self, key, info):
@@ -496,12 +496,12 @@ class ToolPalett(wx.Panel):
     def on_select(self, event):
 
         _id = event.GetEventObject().GetId()
-        print '\n on_select', _id, self._id  # ,self._id_to_tool[_id]
+        print('\n on_select', _id, self._id)  # ,self._id_to_tool[_id]
         if _id != self._id:
             if self._id_to_tool.has_key(_id):
 
                 (tool, button) = self._id_to_tool[_id]
-                print '  new tool', tool.get_name()
+                print('  new tool', tool.get_name())
                 self.unselect()
                 self._id = _id
                 self.GetParent().set_options(tool)
@@ -525,7 +525,7 @@ class ToolPalett(wx.Panel):
         """
         Select explicitelt a tool.
         """
-        print '\n select', id, self._id, self._id_to_tool
+        print('\n select', id, self._id, self._id_to_tool)
 
         if id != self._id:
             if self._id_to_tool.has_key(id):
@@ -805,7 +805,7 @@ class WxGLTest_orig(glcanvas.GLCanvas):
         y = event.GetY()
 
     def OnDestroy(self, event):
-        print "Destroying Window"
+        print("Destroying Window")
 
 
 class Lines:
@@ -982,7 +982,7 @@ class GLFrame(wx.Frame):
                  size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE,
                  name='frame', mainframe=None):
 
-        print '\n\nGLFrame!!'
+        print('\n\nGLFrame!!')
         if mainframe is None:
             self._mainframe = parent
         else:
@@ -1893,7 +1893,7 @@ class TestMainframe(AgileToolbarFrameMix
         return view
 
     def on_size(self, event=None):
-        print 'Mainframe.on_size'
+        print('Mainframe.on_size')
         # self.tc.SetSize(self.GetSize())
         # self.tc.SetSize(self.GetSize())
         # self._viewtabs.SetSize(self.GetSize())
@@ -1908,12 +1908,12 @@ class TestMainframe(AgileToolbarFrameMix
             event.Skip()
 
     def on_save(self, event):
-        print 'save it!!'
+        print('save it!!')
 
     def on_open(self, event):
         """Open a document"""
         #wildcards = CreateWildCards() + "All files (*.*)|*.*"
-        print 'open it!!'
+        print('open it!!')
 
     def destroy(self):
         """Destroy this object"""
--- a/tools/contributed/sumopy/agilepy/lib_wx/test_notebook.py
+++ b/tools/contributed/sumopy/agilepy/lib_wx/test_notebook.py
@@ -111,14 +111,14 @@ class NestedNotebookDemo(wx.Notebook):
         old = event.GetOldSelection()
         new = event.GetSelection()
         sel = self.GetSelection()
-        print 'OnPageChanged,  old:%d, new:%d, sel:%d\n' % (old, new, sel)
+        print('OnPageChanged,  old:%d, new:%d, sel:%d\n' % (old, new, sel))
         event.Skip()
 
     def OnPageChanging(self, event):
         old = event.GetOldSelection()
         new = event.GetSelection()
         sel = self.GetSelection()
-        print 'OnPageChanging, old:%d, new:%d, sel:%d\n' % (old, new, sel)
+        print('OnPageChanging, old:%d, new:%d, sel:%d\n' % (old, new, sel))
         event.Skip()
 
 
--- a/tools/contributed/sumopy/agilepy/lib_wx/wxmisc.py
+++ b/tools/contributed/sumopy/agilepy/lib_wx/wxmisc.py
@@ -145,7 +145,7 @@ class AgileToolbarMixin:
             self.toolbar.EnableTool(self._tools[key], enable)
 
         else:
-            print 'enable_tool: no tool named:', key
+            print('enable_tool: no tool named:', key)
 
     def del_tool(self, key):
         if self._tools.has_key(key):
@@ -157,7 +157,7 @@ class AgileToolbarMixin:
             # causes it to render (more or less, that is).
             self.toolbar.Realize()
         else:
-            print 'del_tool: no tool named:', key
+            print('del_tool: no tool named:', key)
 
 
 class AgileToolbarFrameMixin(AgileToolbarMixin):
@@ -217,7 +217,7 @@ class AgileMenuMixin:
                 else:
                     return None, None, -1
             else:
-                print 'WARNING in get_menu: invalid menu key', key, 'in path'
+                print('WARNING in get_menu: invalid menu key', key, 'in path')
                 return None, None, -1
 
         return val[0], val[1], val[2]
@@ -340,7 +340,7 @@ class AgileMenuMixin:
             menu_dict[key] = (item, id)
             return item, id
         else:
-            print 'WARNING: in append_item: invalid menu path', menupath
+            print('WARNING: in append_item: invalid menu path', menupath)
             return None, None
 
     def _create_item(self, key, menu, function=None, **args):
@@ -657,7 +657,7 @@ class KeyHandler:
         """
         # print 'on_key_up'
         self.del_keypress()
-        print '  key_pressed', self.key_pressed
+        print('  key_pressed', self.key_pressed)
 
     def del_keypress(self):
         """
@@ -872,7 +872,7 @@ def get_bitmap(name, size=22):
     try:
         return imgImages.catalog[name].getBitmap()
     except:
-        print 'WARNING in get_bitmap: failed to return image', name
+        print('WARNING in get_bitmap: failed to return image', name)
         return wx.NullBitmap
 
 
--- a/tools/contributed/sumopy/coremodules/demand/__init__.py
+++ b/tools/contributed/sumopy/coremodules/demand/__init__.py
@@ -18,7 +18,7 @@
 
 __version__ = "0.0"
 
-print 'init', __name__
+print('init', __name__)
 
 
 def get_wxgui():
--- a/tools/contributed/sumopy/coremodules/demand/demand.py
+++ b/tools/contributed/sumopy/coremodules/demand/demand.py
@@ -69,7 +69,7 @@ except:
 
 class Demand(cm.BaseObjman):
     def __init__(self, scenario=None, net=None, zones=None, name='Demand', info='Transport demand', **kwargs):
-        print 'Demand.__init__', name, kwargs
+        print('Demand.__init__', name, kwargs)
 
         # we need a network from somewhere
         if net is None:
@@ -98,7 +98,7 @@ class Demand(cm.BaseObjman):
         attrsman = self.get_attrsman()
 
         scenario = self.parent
-        print 'Demand._init_attributes', scenario
+        print('Demand._init_attributes', scenario)
 
         if scenario is not None:
             self.detectorflows = attrsman.add(cm.ObjConf(detectorflows.Detectorflows('detectorflows', self),
@@ -193,7 +193,7 @@ class Demand(cm.BaseObjman):
             if demandobject is not None:
                 demandobjects_clean.append(demandobject)
             else:
-                print 'WARNING in get_demandobjects: found None as object', attrname
+                print('WARNING in get_demandobjects: found None as object', attrname)
                 self.get_attrsman().delete(attrname)
         return demandobjects_clean
 
@@ -226,15 +226,15 @@ class Demand(cm.BaseObjman):
 
         if filepath is None:
             filepath = self.get_routefilepath()
-        print 'import_routes_xml', filepath, demandobjects
+        print('import_routes_xml', filepath, demandobjects)
         try:
             fd = open(filepath, 'r')
         except:
-            print 'WARNING in import_routes_xml: could not open', filepath
+            print('WARNING in import_routes_xml: could not open', filepath)
             return False
 
         for demandobj in demandobjects:
-            print '   try to import routes from demandobj', demandobj
+            print('   try to import routes from demandobj', demandobj)
             demandobj.import_routes_xml(filepath,
                                         is_clear_trips=is_clear_trips,
                                         is_generate_ids=is_generate_ids,
@@ -259,11 +259,11 @@ class Demand(cm.BaseObjman):
 
         if filepath is None:
             filepath = self.get_routefilepath()
-        print 'export_routes_xml', filepath, demandobjects
+        print('export_routes_xml', filepath, demandobjects)
         try:
             fd = open(filepath, 'w')
         except:
-            print 'WARNING in export_routes_xml: could not open', filepath
+            print('WARNING in export_routes_xml: could not open', filepath)
             return False
 
         fd.write('<?xml version="1.0" encoding="%s"?>\n' % encoding)
@@ -277,11 +277,11 @@ class Demand(cm.BaseObjman):
 
         ids_vtype = set()
         for exportobj in demandobjects:
-            print '  exportobj', exportobj
+            print('  exportobj', exportobj)
             times, funcs, ids = exportobj.get_writexmlinfo(is_route=is_route,
                                                            is_plain=is_plain,
                                                            is_exclude_pedestrians=is_exclude_pedestrians)
-            print '    n_trips', len(times), 'has vtypes', hasattr(exportobj, 'get_vtypes')
+            print('    n_trips', len(times), 'has vtypes', hasattr(exportobj, 'get_vtypes'))
             if len(times) > 0:
                 times_begin = np.concatenate((times_begin, times), 0)
                 writefuncs = np.concatenate((writefuncs, funcs), 0)
@@ -630,7 +630,7 @@ class Trips(DemandobjMixin, am.ArrayObjm
         """
         Simple fastest path routing using duarouter.
         """
-        print 'duaroute'
+        print('duaroute')
         exectime_start = time.clock()
 
         #routesattrname = self.get_routesattrname(routesindex)
@@ -661,7 +661,7 @@ class Trips(DemandobjMixin, am.ArrayObjm
                                    is_overwrite_only=True,
                                    is_add=False)
 
-            print '  exectime', time.clock()-exectime_start
+            print('  exectime', time.clock()-exectime_start)
             return routefilepath
 
         else:
@@ -677,7 +677,7 @@ class Trips(DemandobjMixin, am.ArrayObjm
         """
         Fastest path python router.
         """
-        print 'route is_check_lanes', is_check_lanes
+        print('route is_check_lanes', is_check_lanes)
         # TODO: if too mant vtypes, better go through id_modes
         exectime_start = time.clock()
 
@@ -697,7 +697,7 @@ class Trips(DemandobjMixin, am.ArrayObjm
             # no routing for pedestrians
             if id_mode != net.modes.get_id_mode('pedestrian'):
                 ids_trip_vtype = self.get_trips_for_vtype(id_vtype)
-                print '  id_vtype, id_mode', id_vtype, id_mode  # ,ids_trip_vtype
+                print('  id_vtype, id_mode', id_vtype, id_mode)  # ,ids_trip_vtype
 
                 weights = edges.get_times(id_mode=id_mode,
                                           speed_max=vtypes.speeds_max[id_vtype],
@@ -741,7 +741,7 @@ class Trips(DemandobjMixin, am.ArrayObjm
         else:
             self.add_routes(ids_trip, ids_route)
 
-        print '  exectime', time.clock()-exectime_start
+        print('  exectime', time.clock()-exectime_start)
 
         if is_del_disconnected:
             self.del_rows(ids_trip_disconnected)
@@ -774,7 +774,7 @@ class Trips(DemandobjMixin, am.ArrayObjm
         """
         Import trips from another scenario.
         """
-        print 'import_trips_from_scenario', scenario2.ident
+        print('import_trips_from_scenario', scenario2.ident)
         if not is_pyproj:
             print("WARNING in import_trips_from_scenario: pyproj module not installed")
             return None
@@ -841,7 +841,7 @@ class Trips(DemandobjMixin, am.ArrayObjm
         proj_params2 = str(net2.get_projparams())
 
         if (proj_params == '!') | (proj_params2 == '!'):
-            print 'WARNING in import_trips_from_scenario: unknown projections, use only offsets.', proj_params, proj_params2
+            print('WARNING in import_trips_from_scenario: unknown projections, use only offsets.', proj_params, proj_params2)
             is_proj = False
 
         elif proj_params == proj_params2:
@@ -867,16 +867,16 @@ class Trips(DemandobjMixin, am.ArrayObjm
 
         for id_mode in ids_modeset:
             # make_segment_edge_map for all edges of this mode
-            print '  make segment_edge_map for mode', id_mode
+            print('  make segment_edge_map for mode', id_mode)
             ids_edge_access, inds_lane_access = edges.select_accessible_mode(id_mode)
-            print '    found accessible edges', len(ids_edge_access), len(edges.get_ids())
+            print('    found accessible edges', len(ids_edge_access), len(edges.get_ids()))
             # dict(zip(ids_edge,inds_lane))
             edges.make_segment_edge_map(ids_edge_access)
 
             # select trips with id_mode
             ind_trips = np.flatnonzero(ids_mode == id_mode)
 
-            print '  number of trips for this mode:', len(ind_trips)
+            print('  number of trips for this mode:', len(ind_trips))
             for id_trip, id_edge_depart2, id_edge_arrival2 in zip(ids_trips[ind_trips],
                                                                   demand2.trips.ids_edge_depart[ids_trip2[ind_trips]],
                                                                   demand2.trips.ids_edge_arrival[ids_trip2[ind_trips]]
@@ -905,7 +905,7 @@ class Trips(DemandobjMixin, am.ArrayObjm
                 # check eucledian distance
                 #d = edges.get_dist_point_to_edge(coord, id_edge_depart)
                 # print '    id_edge_depart,d,id_mode',id_edge_depart,d,id_mode
-                print '    id_edge_depart', id_edge_depart, id_edge_depart in ids_edge_access
+                print('    id_edge_depart', id_edge_depart, id_edge_depart in ids_edge_access)
 
                 ids_edge_depart[id_trip] = id_edge_depart
 
@@ -931,7 +931,7 @@ class Trips(DemandobjMixin, am.ArrayObjm
 
                 # check eucledian distance
                 #d = edges.get_dist_point_to_edge(coord, id_edge_arrival)
-                print '    id_edge_arrival', id_edge_arrival, id_edge_arrival in ids_edge_access
+                print('    id_edge_arrival', id_edge_arrival, id_edge_arrival in ids_edge_access)
 
                 ids_edge_arrival[id_trip] = id_edge_arrival
 
@@ -969,7 +969,7 @@ class Trips(DemandobjMixin, am.ArrayObjm
         return id_trip
 
     def make_trips(self, ids_vtype, is_generate_ids=True, **kwargs):
-        print 'make_trips len(ids_vtype) =', len(ids_vtype)
+        print('make_trips len(ids_vtype) =', len(ids_vtype))
         # print '  kwargs=',kwargs
         ids_trip = self.add_rows(n=len(ids_vtype),
                                  ids_vtype=ids_vtype,
@@ -1002,28 +1002,28 @@ class Trips(DemandobjMixin, am.ArrayObjm
 
         is_generate_ids: depricated, fully controlled by ids_trip
         """
-        print 'make_routes is_generate_ids', ids_trip is None, 'is_add', is_add
+        print('make_routes is_generate_ids', ids_trip is None, 'is_add', is_add)
         # print '  ids_trip',ids_trip
 
         if ids_trip is None:  # is_generate_ids = is_generate_ids,
-            print '  generate new trip IDs'
+            print('  generate new trip IDs')
             ids_trip = self.make_trips(ids_vtype, is_generate_ids=is_generate_ids,  **kwargs)
             is_generate_ids = True
         else:
             if not is_add:
-                print '  replace current route and create if not existent'
+                print('  replace current route and create if not existent')
                 ids_routes = self.ids_route_current[ids_trip]
                 inds_new = np.flatnonzero(ids_routes == -1)
                 # print '  inds_new',inds_new
                 if len(inds_new) > 0:
-                    print '  complete %d non pre-existant route ids of %d trips' % (len(inds_new), len(ids_trip))
+                    print('  complete %d non pre-existant route ids of %d trips' % (len(inds_new), len(ids_trip)))
                     # create new routes
                     ids_routes[inds_new] = self.routes.get_value().add_rows(n=len(inds_new),
                                                                             ids_trip=ids_trip[inds_new],
                                                                             #ids_edges = routes[inds_new],
                                                                             )
                 else:
-                    print '  all new routes have pre-existing routes'
+                    print('  all new routes have pre-existing routes')
             else:
                 # make new route IDs
                 ids_routes = self.routes.get_value().add_rows(n=len(ids_trip),
@@ -1032,14 +1032,14 @@ class Trips(DemandobjMixin, am.ArrayObjm
                                                               )
 
             is_generate_ids = False
-            print '  set new routes to routes database', len(ids_routes), 'routes set'
+            print('  set new routes to routes database', len(ids_routes), 'routes set')
             self.routes.get_value().ids_edges[ids_routes] = routes
 
             if not is_add:
-                print '  replace current route IDs', len(inds_new), 'routes replaced'
+                print('  replace current route IDs', len(inds_new), 'routes replaced')
                 self.ids_route_current[ids_trip[inds_new]] = ids_routes[inds_new]
             else:
-                print '  add new route IDs to alternatives', len(ids_trip), 'routes added'
+                print('  add new route IDs to alternatives', len(ids_trip), 'routes added')
                 self.add_routes(ids_trip, ids_routes)
 
             # if np.any(ids_routes == -1):
@@ -1047,7 +1047,7 @@ class Trips(DemandobjMixin, am.ArrayObjm
 
         # print '  ids_trip =',ids_trip
         if is_generate_ids:
-            print '  generate new route IDs'
+            print('  generate new route IDs')
             ids_routes = self.routes.get_value().add_rows(n=len(ids_trip),
                                                           ids_trip=ids_trip,
                                                           #ids_edges = routes,
@@ -1056,10 +1056,10 @@ class Trips(DemandobjMixin, am.ArrayObjm
 
             # print '    ids_routes',ids_routes
             if not is_add:
-                print '  set new current routes'
+                print('  set new current routes')
                 self.ids_route_current[ids_trip] = ids_routes
             else:
-                print '  add new route IDs to alternatives'
+                print('  add new route IDs to alternatives')
                 self.add_routes(ids_trip, ids_routes)
 
         # no!:self.ids_routes[ids_trip] = ids_routes.reshape((-1,1)).tolist()# this makes an array of lists
@@ -1093,11 +1093,11 @@ class Trips(DemandobjMixin, am.ArrayObjm
         """
         if filepath is None:
             filepath = self.get_tripfilepath()
-        print 'export_trips_xml', filepath
+        print('export_trips_xml', filepath)
         try:
             fd = open(filepath, 'w')
         except:
-            print 'WARNING in write_obj_to_xml: could not open', filepath
+            print('WARNING in write_obj_to_xml: could not open', filepath)
             return False
 
         xmltag, xmltag_item, attrname_id = self.xmltag
@@ -1315,7 +1315,7 @@ class Trips(DemandobjMixin, am.ArrayObjm
     def import_routes_xml(self, filepath,  is_clear_trips=False,
                           is_generate_ids=True, is_add=False,
                           is_overwrite_only=False):
-        print 'import_routes_xml from %s generate new routes %s, clear trips %s add trips %s' % (filepath, is_generate_ids, is_clear_trips, is_add)
+        print('import_routes_xml from %s generate new routes %s, clear trips %s add trips %s' % (filepath, is_generate_ids, is_clear_trips, is_add))
         if is_clear_trips:
             self.clear_trips()
 
@@ -1324,28 +1324,28 @@ class Trips(DemandobjMixin, am.ArrayObjm
         reader = RouteReader(self, counter)
         try:
             parse(filepath, reader)
-            print '  call insert_routes', is_generate_ids, 'is_add', is_add, 'is_overwrite_only', is_overwrite_only
+            print('  call insert_routes', is_generate_ids, 'is_add', is_add, 'is_overwrite_only', is_overwrite_only)
             reader.insert_routes(is_generate_ids=is_generate_ids,
                                  is_add=is_add, is_overwrite_only=is_overwrite_only)
         except KeyError:
-            print >> sys.stderr, "Error: Problems with reading routes!"
+            print("Error: Problems with reading routes!", file=sys.stderr)
             raise
 
     def import_trips_xml(self, filepath,  is_clear_trips=False, is_generate_ids=True):
-        print 'import_trips_xml from %s generate own trip ' % (filepath)
+        print('import_trips_xml from %s generate own trip ' % (filepath))
         if is_clear_trips:
             self.clear_trips()
 
         counter = TripCounter()
         parse(filepath, counter)
         reader = TripReader(self, counter.n_trip)
-        print '  n_trip=', counter.n_trip
+        print('  n_trip=', counter.n_trip)
 
         try:
             parse(filepath, reader)
             reader.insert_trips(is_generate_ids=is_generate_ids)
         except KeyError:
-            print >> sys.stderr, "Error: Problems with reading trips!"
+            print("Error: Problems with reading trips!", file=sys.stderr)
             raise
 
     def config_results(self, results):
@@ -1509,7 +1509,7 @@ class TaxiGenerator(Process):
             #id_orig = self.ids_orig[id_od]
             #id_dest = self.ids_dest[id_od]
 
-            print '  check id_zone', id_zone
+            print('  check id_zone', id_zone)
             ids_edges_orig_raw = zones.ids_edges_orig[id_zone]
 
             #prob_edges_orig_raw = zones.probs_edges_orig[id_orig]
@@ -1534,7 +1534,7 @@ class TaxiGenerator(Process):
 
             n_edges_orig = len(ids_edges_orig)
 
-            print '\n    found', n_edges_orig, 'valid zone edges'
+            print('\n    found', n_edges_orig, 'valid zone edges')
 
         # now create taxi trips
         if (n_edges_orig > 0) & (tripnumber > 0):
@@ -1549,7 +1549,7 @@ class TaxiGenerator(Process):
             # debug
             if 0:
                 for id_edge, prob in zip(ids_edges_orig, edgeprops):
-                    print '      orig id_edge', id_edge, 'has prob', prob
+                    print('      orig id_edge', id_edge, 'has prob', prob)
 
             for d in xrange(int(tripnumber+0.5)):
                 # print '      ------------'
@@ -1601,11 +1601,11 @@ class TaxiGenerator(Process):
 
                 n_trips_generated += 1
 
-            print '  n_trips_generated', n_trips_generated, 'of', self.n_taxi
+            print('  n_trips_generated', n_trips_generated, 'of', self.n_taxi)
             return True
 
         else:
-            print '  no taxi created n_edges_orig', n_edges_orig, 'tripnumber', tripnumber
+            print('  no taxi created n_edges_orig', n_edges_orig, 'tripnumber', tripnumber)
             return False
 
     def do(self):
--- a/tools/contributed/sumopy/coremodules/demand/demandbase.py
+++ b/tools/contributed/sumopy/coremodules/demand/demandbase.py
@@ -735,7 +735,7 @@ class RouteReader(TripReader):
                 }
 
     def insert_routes(self, is_generate_ids=True, is_add=False, is_overwrite_only=False):
-        print 'TripReader.make_routes is_generate_ids', is_generate_ids, 'is_add', is_add, 'is_overwrite_only', is_overwrite_only
+        print('TripReader.make_routes is_generate_ids', is_generate_ids, 'is_add', is_add, 'is_overwrite_only', is_overwrite_only)
 
         # self._trips is scenario trip database
         # self.ids_sumo is a list of SUMO IDs read from xml file
--- a/tools/contributed/sumopy/coremodules/demand/detectorflows.py
+++ b/tools/contributed/sumopy/coremodules/demand/detectorflows.py
@@ -35,7 +35,7 @@ class Detectorflows(cm.BaseObjman):
     def __init__(self, ident='detectorflows', demand=None,  name='Detector flows',
                  info='Flows measured by detectors, which can be used to generate vehicle routes using the DFRouter.',
                  **kwargs):
-        print 'Detectorflows.__init__', name, kwargs
+        print('Detectorflows.__init__', name, kwargs)
 
         self._init_objman(ident=ident,
                           parent=demand,
@@ -197,7 +197,7 @@ class Detectors(am.ArrayObjman):
 
         ids = self.get_ids()
         for id_detect, point, phi in zip(ids, self.coords[ids], self.directions[ids]/180.0*np.pi+np.pi/2.0):
-            print '  Detector id_detect', id_detect, 'point', point
+            print('  Detector id_detect', id_detect, 'point', point)
             ids_edge_target, dists = get_closest_edge(point,  n_best=n_targetedge,
                                                       d_max=d_max,
                                                       is_ending=True,
@@ -206,15 +206,15 @@ class Detectors(am.ArrayObjman):
                                                       accesslevels=accesslevels
                                                       )
 
-            print '    ids_edge_target', ids_edge_target
-            print '    dists', dists
+            print('    ids_edge_target', ids_edge_target)
+            print('    dists', dists)
 
             if is_check_direction:
                 id_edge_found = -1
                 i = 0
                 n = len(ids_edge_target)
                 while (id_edge_found < 0) & (i < n):
-                    print '    check ids_edge', ids_edge_target[i], dists[i]
+                    print('    check ids_edge', ids_edge_target[i], dists[i])
                     dist_point_edge, segment = get_dist_point_to_edge(point, ids_edge_target[i],
                                                                       is_ending=True,
                                                                       is_detect_initial=False,
@@ -235,9 +235,9 @@ class Detectors(am.ArrayObjman):
             if id_edge_found >= 0:
                 # select lane
                 ids_lane = edges.ids_lanes[id_edge_found]
-                print '  id_edge_found', id_edge_found, 'ids_lane', edges.ids_lanes[id_edge_found]
+                print('  id_edge_found', id_edge_found, 'ids_lane', edges.ids_lanes[id_edge_found])
                 ids_lane_access = ids_lane[lanes.get_laneindexes_allowed(ids_lane, id_mode)]
-                print '  ids_lane_access', ids_lane_access
+                print('  ids_lane_access', ids_lane_access)
 
                 if len(ids_lane_access) > 0:
                     if is_edgedetectors:
@@ -253,7 +253,7 @@ class Detectors(am.ArrayObjman):
         #    <detectorDefinition id="<DETECTOR_ID>" lane="<LANE_ID>" pos="<POS>"/>
         #    ... further detectors ...
         # </detectors>
-        print 'Detectors.write_xml'
+        print('Detectors.write_xml')
         fd.write(xm.begin('detectors', indent))
 
         ids = self.get_ids()
@@ -265,7 +265,7 @@ class Detectors(am.ArrayObjman):
             self.positions[ids],
         ):
 
-            print '  write id_detector', id_detector, 'ids_lane', ids_lane
+            print('  write id_detector', id_detector, 'ids_lane', ids_lane)
             if ids_lane is not None:
                 ind_lane = 0
                 for id_lane in ids_lane:
@@ -397,7 +397,7 @@ class Flowmeasurements(am.ArrayObjman):
 
         f.write('Detector'+sep+'Time'+sep+'qPKW'+sep+'qLKW'+sep+'vPKW'+sep+'vLKW'+'\n')
         #ids_flow = self.select_ids(self.flows_passenger.get_value()>=0)
-        print '  flows_passenger', self.flows_passenger.get_value()
+        print('  flows_passenger', self.flows_passenger.get_value())
         ids_flow = self.get_ids()
         for id_detector, t, flow_passenger, flow_heavyduty, speed_passenger, speed_heavyduty in \
             zip(
@@ -410,7 +410,7 @@ class Flowmeasurements(am.ArrayObjman):
 
             ids_lane = detectors.ids_lanes[id_detector]
             if (ids_lane is not None) & (flow_passenger >= 0):
-                print '  id_detector', id_detector, 't', t, 'flow_passenger', flow_passenger, len(ids_lane)
+                print('  id_detector', id_detector, 't', t, 'flow_passenger', flow_passenger, len(ids_lane))
 
                 n_lane = len(ids_lane)
                 for ind_lane, passengerflow_lane, heavyflow_lane in\
@@ -529,7 +529,7 @@ class Flowmeasurements(am.ArrayObjman):
         # myDet1;0;10;2;100;80
         # ... further entries ...
 
-        print 'import_csv', filepath
+        print('import_csv', filepath)
         ind_col = 0
         cols = f.readline().strip()
         ind_col = 0
@@ -652,14 +652,14 @@ class Flowmeasurements(am.ArrayObjman):
         scenario.net.export_netxml()
 
         ids_mode = self.get_modes()
-        print 'turnflows_to_routes', ids_mode  # scenario.net.modes.get_ids()
-        print '  cmloptions', cmloptions
+        print('turnflows_to_routes', ids_mode)  # scenario.net.modes.get_ids()
+        print('  cmloptions', cmloptions)
 
         # route for all modes and read in routes
         for id_mode in ids_mode:
             # write flow and turns xml file for this mode
             time_start, time_end = self.export_flows_and_turns(flowfilepath, turnfilepath, id_mode)
-            print '  time_start, time_end =', time_start, time_end
+            print('  time_start, time_end =', time_start, time_end)
             if time_end > time_start:  # means there exist some flows for this mode
                 cmd = 'jtrrouter --route-files=%s --turn-ratio-files=%s --net-file=%s --output-file=%s --begin %s --end %s %s'\
                     % (P+flowfilepath+P,
@@ -677,7 +677,7 @@ class Flowmeasurements(am.ArrayObjman):
                         os.remove(routefilepath)
 
             else:
-                print 'jtrroute: no flows generated for id_mode', id_mode
+                print('jtrroute: no flows generated for id_mode', id_mode)
 
         # self.simfiles.set_modified_data('rou',True)
         # self.simfiles.set_modified_data('trip',True)
@@ -686,7 +686,7 @@ class Flowmeasurements(am.ArrayObjman):
 
 class DetectorMatcher(Process):
     def __init__(self, ident, detectors,  logger=None, **kwargs):
-        print 'DetectorMatcher.__init__'
+        print('DetectorMatcher.__init__')
 
         # TODO: let this be independent, link to it or child??
 
@@ -708,7 +708,7 @@ class DetectorMatcher(Process):
                                                  info='Matched lanes must be accessible at least for this mode.',
                                                  ))
 
-        print 'net.modes.names.get_indexmap().keys()', net.modes.names.get_indexmap().keys(),  self.modename
+        print('net.modes.names.get_indexmap().keys()', net.modes.names.get_indexmap().keys(),  self.modename)
 
         self.is_edgedetectors = attrsman.add(cm.AttrConf('is_edgedetectors', kwargs.get('is_edgedetectors', False),
                                                          groupnames=['options'],
@@ -756,7 +756,7 @@ class DetectorMatcher(Process):
                                               ))
 
     def do(self):
-        print 'DetectorMatcher.do'
+        print('DetectorMatcher.do')
         self.parent.match_detectors_to_lane(modename=self.modename,
                                             is_edgedetectors=self.is_edgedetectors,
                                             is_check_direction=self.is_check_direction,
@@ -946,8 +946,8 @@ class DFRouter(CmlMixin, Process):
         if self.is_export_network:
             scenario.net.export_netxml()
 
-        print 'DFRouter.do'
-        print '  cmloptions', cmloptions
+        print('DFRouter.do')
+        print('  cmloptions', cmloptions)
 
         # dfrouter --net-file bonet190614_ms_dflows.net --routes-output bonet190614_ms_dflows.rou.xml --emitters-output vehicles.xml --detector-files detectors.xml --measure-files bonet190614_ms_dflows.dflows2.csv
         cmd = cmloptions + ' --net-file %s --detector-files %s --measure-files %s --routes-output %s --emitters-output %s'\
--- a/tools/contributed/sumopy/coremodules/demand/origin_to_destination.py
+++ b/tools/contributed/sumopy/coremodules/demand/origin_to_destination.py
@@ -277,7 +277,7 @@ class OdTrips(am.ArrayObjman):
             self.del_row(id_row)
 
     def on_add_row(self, id_row=None):
-        print 'on_add_row'
+        print('on_add_row')
         if len(self) > 0:
 
             # copy previous
@@ -324,7 +324,7 @@ class OdTrips(am.ArrayObjman):
         """
         Generates trips in demand.trip table.
         """
-        print 'generate_trips', time_start, time_end, 'id_mode_primary', id_mode_primary, 'id_mode_fallback', id_mode_fallback
+        print('generate_trips', time_start, time_end, 'id_mode_primary', id_mode_primary, 'id_mode_fallback', id_mode_fallback)
         id_mode_ped = MODES['pedestrian']
         zones = self.get_zones()
         edges = self.get_edges()
@@ -352,7 +352,7 @@ class OdTrips(am.ArrayObjman):
         # in case there is a secondary mode, the secondary mode is chosen
         ids_vtype_mode_primary, prob_vtype_mode_primary = demand.vtypes.select_by_mode(
             id_mode_primary, is_share=True)
-        print '  ids_vtype_mode_primary', ids_vtype_mode_primary, prob_vtype_mode_primary
+        print('  ids_vtype_mode_primary', ids_vtype_mode_primary, prob_vtype_mode_primary)
         n_vtypes_primary = len(ids_vtype_mode_primary)
 
         n_vtypes_fallback = 0
@@ -368,7 +368,7 @@ class OdTrips(am.ArrayObjman):
             is_fallback = False
         # print '  n_vtypes_primary',n_vtypes_primary,'n_vtypes_fallback',n_vtypes_fallback,'is_fallback',is_fallback
         if n_vtypes_primary == 0:
-            print 'WARNING: no vehicle types for this mode with ID', id_mode_primary
+            print('WARNING: no vehicle types for this mode with ID', id_mode_primary)
             return False
 
         ids_od = self.get_ids()
@@ -378,7 +378,7 @@ class OdTrips(am.ArrayObjman):
                 np.array(self.tripnumbers[ids_od]+random.rand(len(ids_od)), dtype=np.int32),
                 ):
 
-            print '  generate', tripnumber, ' trips from id_orig', id_orig, 'to id_dest', id_dest
+            print('  generate', tripnumber, ' trips from id_orig', id_orig, 'to id_dest', id_dest)
 
             ids_edge_orig, weights_orig = self.get_zone_edgeinfo(
                 id_mode_primary, id_orig, n_edges_min_length, n_edges_max_length, priority_max, speed_max)
@@ -414,9 +414,9 @@ class OdTrips(am.ArrayObjman):
 
                     n_trips_generated += 1
 
-        print '  -----'
-        print '  n_trips_generated', n_trips_generated
-        print '  n_trips_failed', np.sum(self.tripnumbers[ids_od])-n_trips_generated
+        print('  -----')
+        print('  n_trips_generated', n_trips_generated)
+        print('  n_trips_failed', np.sum(self.tripnumbers[ids_od])-n_trips_generated)
         return True
 
     def add_od_trips(self, scale, names_orig, names_dest, tripnumbers,
@@ -428,7 +428,7 @@ class OdTrips(am.ArrayObjman):
         is_filter_cross = len(ids_zone_cross_filter) > 0
         is_dist_min = dist_min > 0
         is_dist_max = dist_max > 0
-        print 'OdTrips.add_od_trips', is_filter_orig, is_filter_dest, is_filter_cross
+        print('OdTrips.add_od_trips', is_filter_orig, is_filter_dest, is_filter_cross)
         # print '  filter',ids_zone_orig_filter,ids_zone_dest_filter
         # print '  scale, names_orig, names_dest, tripnumbers',scale, names_orig, names_dest, tripnumbers,len(tripnumbers)
         zones = self.get_zones()
@@ -477,15 +477,15 @@ class OdTrips(am.ArrayObjman):
                 else:
                     n_trips_scale_fin = int(n_trips_scale_int + 1)
                 # -----
-                print '      add from', name_orig, 'to', name_dest, 'tripnumber', n_trips_scale_fin
+                print('      add from', name_orig, 'to', name_dest, 'tripnumber', n_trips_scale_fin)
 
                 self.add_row(ids_orig=id_zone_orig,
                              ids_dest=id_zone_dest,
                              tripnumbers=n_trips_scale_fin)  # prima c'era (tripnumbers = scale*tripnumber)
             else:
                 if not ((zones.ids_sumo.has_index(name_orig)) & (zones.ids_sumo.has_index(name_dest))):
-                    print '  WARNING: zone named %s or %s not known' % (
-                        name_orig, name_dest)
+                    print('  WARNING: zone named %s or %s not known' % (
+                        name_orig, name_dest))
                     # print '  zones indexmap', zones.get_indexmap()
                     # print '  ids_sumo', zones.ids_sumo.get_value()
                     # print '  ids_sumo._index_to_id', zones.ids_sumo._index_to_id
@@ -678,7 +678,7 @@ class OdIntervals(am.ArrayObjman):
         """
         Export flows to Amitran format that defines the demand per OD pair in time slices for every vehicle type.
         """
-        print 'export_amitranxml', filepath, len(self)
+        print('export_amitranxml', filepath, len(self))
 
         if len(self) == 0:
             return None
@@ -689,7 +689,7 @@ class OdIntervals(am.ArrayObjman):
         try:
             fd = open(filepath, 'w')
         except:
-            print 'WARNING in export_sumoxml: could not open', filepath
+            print('WARNING in export_sumoxml: could not open', filepath)
             return False
 
         indent = 0
@@ -745,7 +745,7 @@ class OdIntervals(am.ArrayObjman):
         """
         Export flows to SUMO xml file formate.
         """
-        print 'export_sumoxml', filepath, len(self)
+        print('export_sumoxml', filepath, len(self))
         if len(self) == 0:
             return None
 
@@ -755,7 +755,7 @@ class OdIntervals(am.ArrayObjman):
         try:
             fd = open(filepath, 'w')
         except:
-            print 'WARNING in export_sumoxml: could not open', filepath
+            print('WARNING in export_sumoxml: could not open', filepath)
             return False
         #xmltag, xmltag_item, attrname_id = self.xmltag
         #fd.write('<?xml version="1.0" encoding="%s"?>\n'%encoding)
--- a/tools/contributed/sumopy/coremodules/demand/origin_to_destination_mpl.py
+++ b/tools/contributed/sumopy/coremodules/demand/origin_to_destination_mpl.py
@@ -33,7 +33,7 @@ from agilepy.lib_base.processes import P
 
 class OdPlots(PlotoptionsMixin, Process):
     def __init__(self, ident, demand, logger=None, **kwargs):
-        print 'OdPlots.__init__'
+        print('OdPlots.__init__')
         self._init_common(ident,
                           parent=demand,
                           name='OD plots',
@@ -155,7 +155,7 @@ class OdPlots(PlotoptionsMixin, Process)
         self.add_save_options(**kwargs)
 
     def show(self):
-        print 'OdPlots.show'
+        print('OdPlots.show')
         # if self.axis  is None:
         scenario = self.parent.get_scenario()
         zones = scenario.landuse.zones
@@ -201,7 +201,7 @@ class OdPlots(PlotoptionsMixin, Process)
             balance[id_zone] = inflows[id_zone] - outflows[id_zone]
             totals[id_zone] = inflows[id_zone] + outflows[id_zone]
             # debug
-            print ' id_zone', id_zone, 'in', inflows[id_zone], 'out', outflows[id_zone], 'balance', balance[id_zone], 'totals', totals[id_zone]
+            print(' id_zone', id_zone, 'in', inflows[id_zone], 'out', outflows[id_zone], 'balance', balance[id_zone], 'totals', totals[id_zone])
 
         unit = self.unit_mapscale
         mapscale = self.get_attrsman().get_config('unit_mapscale').mapscales[unit]
@@ -268,7 +268,7 @@ class OdPlots(PlotoptionsMixin, Process)
             else:
                 cmap = mpl.cm.jet
             patchcollection = PatchCollection(ppatches, cmap=cmap, alpha=self.alpha_zones)
-            print '  values', values
+            print('  values', values)
             patchcollection.set_array(np.array(values, dtype=np.float32))
 
             ax.add_collection(patchcollection)
@@ -298,7 +298,7 @@ class OdPlots(PlotoptionsMixin, Process)
                 #    text = str(int(flow))
                 # else:
                 #    text = ''
-                print '  x1, y1', x1, y1, 'x2, y2', x2, y2
+                print('  x1, y1', x1, y1, 'x2, y2', x2, y2)
                 if id_zone_orig != id_zone_dest:
                     patch = FancyArrow(x1*mapscale, y1*mapscale, (x2-x1)*mapscale, (y2-y1)*mapscale,
                                        width=width,
--- a/tools/contributed/sumopy/coremodules/demand/origin_to_destination_wxgui.py
+++ b/tools/contributed/sumopy/coremodules/demand/origin_to_destination_wxgui.py
@@ -31,7 +31,7 @@ import origin_to_destination as od
 
 class OdCommonMixin:
     def add_odoptions_common(self, modes=None, activitytypes=None, **kwargs):
-        print 'add_odoptions_common', modes
+        print('add_odoptions_common', modes)
         self.add(am.AttrConf('t_start', kwargs.get('t_start', 0),
                              groupnames=['options'],
                              perm='rw',
@@ -205,7 +205,7 @@ class OdFlowsWxGuiMixin:
             # This returns a Python list of files that were selected.
             path = dlg.GetPath()
             # print 'You selected %d files:' % len(paths)
-            if path is not "":
+            if path != "":
                 self._demand.odintervals.export_sumoxml(path)
 
         dlg.Destroy()
@@ -234,7 +234,7 @@ class OdFlowsWxGuiMixin:
             # This returns a Python list of files that were selected.
             path = dlg.GetPath()
             # print 'You selected %d files:' % len(paths)
-            if path is not "":
+            if path != "":
                 self._demand.odintervals.export_amitranxml(path)
 
         dlg.Destroy()
@@ -630,7 +630,7 @@ class AddOdWizzard(OdCommonMixin, am.Arr
         """
         Add demand to scenario.
         """
-        print 'AddOdm.add_demand'
+        print('AddOdm.add_demand')
         # print '   ids_zone_orig_filter',self.ids_zone_orig_filter.get_value()
         # print '   ids_zone_dest_filter',self.ids_zone_dest_filter.get_value()
         odintervals = self.parent
@@ -677,11 +677,11 @@ class AddOdWizzard(OdCommonMixin, am.Arr
                                  tripnumbers=int(tripnumbers_str)
                                  )
                 else:
-                    print 'WARNING: unknown zonename in line %d of file %s' % (i_line, filepath)
+                    print('WARNING: unknown zonename in line %d of file %s' % (i_line, filepath))
 
             else:
                 if len(cols) != 0:
-                    print 'WARNING: inconsistent o,d,trips info in line %d of file %s' % (i_line, filepath)
+                    print('WARNING: inconsistent o,d,trips info in line %d of file %s' % (i_line, filepath))
             i_line += 1
         # self.odtab.print_rows()
         f.close()
--- a/tools/contributed/sumopy/coremodules/demand/publictransportservices.py
+++ b/tools/contributed/sumopy/coremodules/demand/publictransportservices.py
@@ -174,7 +174,7 @@ class PtLines(DemandobjMixin, am.ArrayOb
                     if len(ids_edge) > 0:
                         if id_stopedge not in ids_edge:
                             id_edge = ids_edge[0]
-                            print '  initial stop edge %d of line %d disconnected from route edge %d' % (id_stopedge, id_line, id_edge)
+                            print('  initial stop edge %d of line %d disconnected from route edge %d' % (id_stopedge, id_line, id_edge))
                             # print '    before:',ids_edge
                             if id_mode not in map_mode_to_times:
                                 map_mode_to_times[id_mode] = get_times(id_mode=id_mode,
@@ -188,7 +188,7 @@ class PtLines(DemandobjMixin, am.ArrayOb
 
                             if len(ids_edges_connect) > 0:
                                 if ids_edges_connect[-1] == id_edge:
-                                    print '      prepend connection', ids_edges_connect
+                                    print('      prepend connection', ids_edges_connect)
                                     self.ids_edges[id_line] = ids_edges_connect[:-1] + ids_edge
                                     # print '    after:',self.ids_edges[id_line]
 
@@ -545,23 +545,23 @@ class PtLinks(am.ArrayObjman):
             id_line = self.ids_line[id_link]
             time_interval = self.parent.periods[id_line]
 
-            print ident*' ', 'PtLink:', id_link, 'line', id_line, '(%s)' % (self.parent.linenames[id_line]), 'from stop', self.ids_fromstop[id_link], 'to stop', self.ids_tostop[id_link], 'T=%ds I=%ds' % (self.durations[id_link], time_interval)
+            print(ident*' ', 'PtLink:', id_link, 'line', id_line, '(%s)' % (self.parent.linenames[id_line]), 'from stop', self.ids_fromstop[id_link], 'to stop', self.ids_tostop[id_link], 'T=%ds I=%ds' % (self.durations[id_link], time_interval))
             #id_link_board = self.get_link_board(id_link)
             # print ident*' ',        'check interval: I=%d, I_board=%d, id_link_board=%d'%(time_interval, self.durations[id_link_board], id_link_board),'ids_link_forward',self.ids_links_forward[id_link_board]
 
             if is_edges:
-                print ident*' ', '      ids_edge=', self.get_ids_edge(id_link)
+                print(ident*' ', '      ids_edge=', self.get_ids_edge(id_link))
 
         elif linktype == 'board':
             id_line = self.ids_line[id_link]
-            print ident*' ', 'PtLink:', id_link, 'type', linktype, 'T=%ds' % (self.durations[id_link]), 'line', id_line, '(%s)' % (self.parent.linenames[id_line]), 'at stop', self.ids_fromstop[id_link]
+            print(ident*' ', 'PtLink:', id_link, 'type', linktype, 'T=%ds' % (self.durations[id_link]), 'line', id_line, '(%s)' % (self.parent.linenames[id_line]), 'at stop', self.ids_fromstop[id_link])
 
         elif linktype == 'walk':
-            print ident*' ', 'PtLink:', id_link, 'type', linktype, 'T=%ds' % (self.durations[id_link]), 'from stop', self.ids_fromstop[id_link], 'to stop', self.ids_tostop[id_link]
+            print(ident*' ', 'PtLink:', id_link, 'type', linktype, 'T=%ds' % (self.durations[id_link]), 'from stop', self.ids_fromstop[id_link], 'to stop', self.ids_tostop[id_link])
 
         else:
 
-            print ident*' ', 'PtLink:', id_link, 'type', linktype, 'T=%ds' % (self.durations[id_link]), 'at stop', self.ids_fromstop[id_link]
+            print(ident*' ', 'PtLink:', id_link, 'type', linktype, 'T=%ds' % (self.durations[id_link]), 'at stop', self.ids_fromstop[id_link])
 
         if is_link_forward:
             # print ident*' ','      ids_link_forward=',self.ids_links_forward[id_link]
@@ -609,7 +609,7 @@ class PtLinks(am.ArrayObjman):
         speed_walk_los is the assumed line of sight walking speed
         between two stops
         """
-        print 'build', self.ident, dist_walk_los, speed_walk_los
+        print('build', self.ident, dist_walk_los, speed_walk_los)
 
         id_stop_debug = 459
 
@@ -659,8 +659,8 @@ class PtLinks(am.ArrayObjman):
         ):
             n_edge = len(ids_edge)
             n_stop = len(ids_stop)
-            print 79*'-'
-            print 'Build links of line', linename, 'id_line', id_line, 'n_edge', n_edge, 'n_stop', n_stop
+            print(79*'-')
+            print('Build links of line', linename, 'id_line', id_line, 'n_edge', n_edge, 'n_stop', n_stop)
             if (len(ids_edge) > 1) & (len(ids_stop) > 2):
 
                 # check if all stop edges are on route and in the correct order:
@@ -686,7 +686,7 @@ class PtLinks(am.ArrayObjman):
                             #    print '      ind_edge,id_stopedge_next,ids_edge[ind_edge]',ind_edge,id_stopedge_next,ids_edge[ind_edge],len(ids_edge)
 
                     #is_mismatch =   (ind_edge == (n_edge-1)) & (ind_stop != (n_stop-1))
-                    print '    ind_stop', ind_stop, 'ind_edge', ind_edge, is_mismatch
+                    print('    ind_stop', ind_stop, 'ind_edge', ind_edge, is_mismatch)
                     if is_mismatch:
                         break
 
@@ -710,7 +710,7 @@ class PtLinks(am.ArrayObjman):
                         id_tostop = ids_stop[ind_stop]
 
                         # if id_fromstop == id_stop_debug:
-                        print '    ind_stop', ind_stop, 'id_fromstop,id_tostop', id_fromstop, id_tostop, 'ind_edge', ind_edge
+                        print('    ind_stop', ind_stop, 'id_fromstop,id_tostop', id_fromstop, id_tostop, 'ind_edge', ind_edge)
 
                         # this prevents error in case two successive stops have
                         # (by editing error) the same ID
@@ -719,7 +719,7 @@ class PtLinks(am.ArrayObjman):
                             # compute length and time between  fromstop and tostop
                             while id_stopedge_next != ids_edge[ind_edge]:
                                 # if id_fromstop == id_stop_debug:
-                                print '      ind_edge', ind_edge, ',id_stopedge_next,ids_edge[ind_edge]', id_stopedge_next, ids_edge[ind_edge]
+                                print('      ind_edge', ind_edge, ',id_stopedge_next,ids_edge[ind_edge]', id_stopedge_next, ids_edge[ind_edge])
                                 ind_edge += 1
                                 length_edge = edgelengths[ids_edge[ind_edge]]
                                 length += length_edge
@@ -745,7 +745,7 @@ class PtLinks(am.ArrayObjman):
 
                             # debugging
                             if id_fromstop == id_stop_debug:
-                                print '    append transit link', id_link
+                                print('    append transit link', id_link)
 
                             stoplinks[id_fromstop]['ids_transit_out'].append(id_link)
                             stoplinks[id_tostop]['ids_transit_in'].append(id_link)
@@ -763,8 +763,8 @@ class PtLinks(am.ArrayObjman):
                     self.ids_links_forward[ids_link[i]] = []
 
                 else:
-                    print 'WARNING in line', linename, 'id_line', id_line
-                    print '         stop edges not on route, line will not build.'
+                    print('WARNING in line', linename, 'id_line', id_line)
+                    print('         stop edges not on route, line will not build.')
                     ids_ptlines_failed.append(id_line)
 
         # complete stoplink database
@@ -870,15 +870,15 @@ class PtLinks(am.ArrayObjman):
 
             # debugging
             if id_stop == id_stop_debug:
-                print '    Parameters of id_stop', id_stop
+                print('    Parameters of id_stop', id_stop)
                 for key, val in stoplinks[id_stop].iteritems():
                     if key in ['ids_transit_out', 'ids_transit_in', 'ids_board', 'ids_alight']:
-                        print '    ', key, ':'
+                        print('    ', key, ':')
                         for id_link in val:
                             self.print_link(id_link, ident=6)
 
                     else:
-                        print '    ', key, ':', val
+                        print('    ', key, ':', val)
 
         # connect walk links from one stop to board and transfer
         for id_stop in net.ptstops.get_ids():
@@ -887,32 +887,32 @@ class PtLinks(am.ArrayObjman):
                 self.ids_links_forward[id_walk] = [stoplinks[id_tostop]['id_enter']]
         if 0:
             # debugging
-            print 79*'='
+            print(79*'=')
             ids_link = self.get_ids()
             for id_link, linktype, id_fromstop, id_tostop, id_line, duration, ids_link_forward in zip(
                     ids_link, self.types[ids_link], self.ids_fromstop[ids_link], self.ids_tostop[ids_link], self.ids_line[ids_link], self.durations[ids_link], self.ids_links_forward[ids_link]):
                 if id_fromstop == id_stop_debug:
-                    print '  FROM', id_stop_debug, 'TO', id_tostop
+                    print('  FROM', id_stop_debug, 'TO', id_tostop)
                     self.print_link(id_link, ident=4)
-                    print '      ids_link_forward=', ids_link_forward
+                    print('      ids_link_forward=', ids_link_forward)
 
-            print 79*'='
+            print(79*'=')
             for id_link, linktype, id_fromstop, id_tostop, id_line, duration, ids_link_forward in zip(
                     ids_link, self.types[ids_link], self.ids_fromstop[ids_link], self.ids_tostop[ids_link], self.ids_line[ids_link], self.durations[ids_link], self.ids_links_forward[ids_link]):
 
                 if id_tostop == id_stop_debug:
-                    print '  FROM', id_fromstop, 'TO', id_stop_debug
+                    print('  FROM', id_fromstop, 'TO', id_stop_debug)
                     self.print_link(id_link, ident=4)
-                    print '      ids_link_forward=', ids_link_forward
+                    print('      ids_link_forward=', ids_link_forward)
 
         # debug
-        print 'Number of failed Ptlines', len(ids_ptlines_failed), 'of', len(ptlines)
+        print('Number of failed Ptlines', len(ids_ptlines_failed), 'of', len(ptlines))
         for id_line, linename, period in zip(
             ids_ptlines_failed,
             ptlines.linenames[ids_ptlines_failed],
             ptlines.periods[ids_ptlines_failed],
         ):
-            print '    Failed to build line', linename, 'id_line', id_line, 'period', period, 's'
+            print('    Failed to build line', linename, 'id_line', id_line, 'period', period, 's')
 
         return ids_ptlines_failed
 
@@ -1046,7 +1046,7 @@ class PtLinks(am.ArrayObjman):
                 line = self.parent.linenames[id_line]
             else:
                 line = 'X'
-            print '%4d %06s  fromstop=%3d tostop=%3d %06s' % (id_link, line, id_fromstop, id_tostop, typemap[id_type])
+            print('%4d %06s  fromstop=%3d tostop=%3d %06s' % (id_link, line, id_fromstop, id_tostop, typemap[id_type]))
 
     def route(self, id_fromstop, id_tostop,
               stops_to_enter=None, stops_to_exit=None,
@@ -1060,7 +1060,7 @@ class PtLinks(am.ArrayObjman):
             ids_tostop      : IDs of stops where each stage  ends
             durations       : Duration of each stage in secs
         """
-        print 'route id_fromstop, id_tostop', id_fromstop, id_tostop
+        print('route id_fromstop, id_tostop', id_fromstop, id_tostop)
         if times is None:
             times = self.get_times()
 
@@ -1166,7 +1166,7 @@ class PtLinks(am.ArrayObjman):
 
 class PtLinefilter(Process):
     def __init__(self, ident='ptlinefilter', ptlines=None,  logger=None, **kwargs):
-        print 'PtLinefilter.__init__'
+        print('PtLinefilter.__init__')
 
         # TODO: let this be independent, link to it or child??
 
@@ -1194,7 +1194,7 @@ class PtLinefilter(Process):
                                                     ))
 
     def do(self):
-        print 'PtLinefilter.do'
+        print('PtLinefilter.do')
         # links
         ptlines = self.parent
 
@@ -1215,14 +1215,14 @@ class PtLinefilter(Process):
             elif period > self.period_max:
                 ids_remove.append(id_line)
 
-        print '  Eliminated %d lines:' % (len(ids_remove))
+        print('  Eliminated %d lines:' % (len(ids_remove)))
 
         for id_line, name, ids_stop, period in zip(ids_remove,
                                                    ptlines.linenames[ids_remove],
                                                    ptlines.ids_stops[ids_remove],
                                                    ptlines.periods[ids_remove]
                                                    ):
-            print '    id_line', id_line, 'name', name, 'period', period, 'n_stops', len(ids_stop)
+            print('    id_line', id_line, 'name', name, 'period', period, 'n_stops', len(ids_stop))
 
         ptlines.del_rows(ids_remove)
 
@@ -1231,7 +1231,7 @@ class PtLinefilter(Process):
 
 class PtNetbuilder(Process):
     def __init__(self, ident='ptnetbuilder', ptlinks=None,  logger=None, **kwargs):
-        print 'PtNetbuilder.__init__'
+        print('PtNetbuilder.__init__')
 
         # TODO: let this be independent, link to it or child??
 
@@ -1294,7 +1294,7 @@ class PtNetbuilder(Process):
                                                       ))
 
     def do(self):
-        print 'VehicleProvider.do'
+        print('VehicleProvider.do')
         # links
 
         #virtualpop = self.parent
--- a/tools/contributed/sumopy/coremodules/demand/turnflows.py
+++ b/tools/contributed/sumopy/coremodules/demand/turnflows.py
@@ -259,7 +259,7 @@ class Turns(am.ArrayObjman):
                 self.probabilities[_id] = self.flows[_id] / flows_total[self.ids_fromedge[_id]]
 
     def add_turn(self, id_fromedge, id_toedge, flow):
-        print 'Turns.add_turn'
+        print('Turns.add_turn')
         return self.add_row(ids_fromedge=id_fromedge,
                             ids_toedge=id_toedge,
                             flows=flow,
@@ -321,7 +321,7 @@ class TurnflowModes(am.ArrayObjman):
                           info='Contains for each transport mode an OD trip table.',
                           xmltag=('modesods', 'modeods', 'ids_mode'), **kwargs)
 
-        print 'TurnflowModes.__init__', modes
+        print('TurnflowModes.__init__', modes)
         self.add_col(am.IdsArrayConf('ids_mode', modes,
                                      groupnames=['state'],
                                      choices=MODES,
@@ -330,7 +330,7 @@ class TurnflowModes(am.ArrayObjman):
                                      #xmltag = 'vClass',
                                      info='ID of transport mode.',
                                      ))
-        print '  self.ids_mode.is_index', self.ids_mode.is_index()
+        print('  self.ids_mode.is_index', self.ids_mode.is_index())
 
         self.add_col(cm.ObjsConf('flowtables',
                                  groupnames=['state'],
@@ -366,7 +366,7 @@ class TurnflowModes(am.ArrayObjman):
 
     def add_mode(self, id_mode):
         id_tf_modes = self.add_row(ids_mode=id_mode)
-        print '  add_mode', id_mode, id_tf_modes
+        print('  add_mode', id_mode, id_tf_modes)
 
         flows = Flows((self.flowtables.attrname, id_tf_modes), self, self.edges.get_value())
         self.flowtables[id_tf_modes] = flows
@@ -381,8 +381,8 @@ class TurnflowModes(am.ArrayObjman):
         Sets a demand flows between from-Edge and toEdge pairs for mode where flows is a dictionary
         with (fromEdgeID,toEdgeID) pair as key and number of trips as values.
         """
-        print 'TurnflowModes.add_turnflows', id_mode  # ,flows,kwargs
-        print '  self.ids_mode.is_index()', self.ids_mode.is_index()
+        print('TurnflowModes.add_turnflows', id_mode)  # ,flows,kwargs
+        print('  self.ids_mode.is_index()', self.ids_mode.is_index())
         if self.ids_mode.has_index(id_mode):
             id_tf_modes = self.ids_mode.get_id_from_index(id_mode)
         else:
@@ -394,7 +394,7 @@ class TurnflowModes(am.ArrayObjman):
         """
         Sets turn probability between from-edge and to-edge.
         """
-        print 'TurnflowModes.add_turn', id_mode  # ,turnflow,kwargs
+        print('TurnflowModes.add_turn', id_mode)  # ,turnflow,kwargs
         # if scale!=1.0:
         #    for od in odm.iterkeys():
         #        odm[od] *= scale
@@ -413,7 +413,7 @@ class TurnflowModes(am.ArrayObjman):
         Export flow data of desired mode to xml file.
         Returns list with edge IDs with non zero flows and a flow ID counter.
         """
-        print 'TurnflowModes.export_flows_xml id_mode, id_flow', id_mode, id_flow, self.ids_mode.has_index(id_mode)
+        print('TurnflowModes.export_flows_xml id_mode, id_flow', id_mode, id_flow, self.ids_mode.has_index(id_mode))
         ids_sourceedge = []
 
         if not self.ids_mode.has_index(id_mode):
@@ -432,7 +432,7 @@ class TurnflowModes(am.ArrayObjman):
         #    # TODO: can we put some distributen here?
         #    vtype = vtypes[0]
         for vtype, share in zip(vtypes, shares):
-            print '  write flows for vtype', vtype, share
+            print('  write flows for vtype', vtype, share)
             if self.ids_mode.has_index(id_mode):
                 id_tf_modes = self.ids_mode.get_id_from_index(id_mode)
                 ids_sourceedge, id_flow = self.flowtables[id_tf_modes].export_xml(
@@ -446,7 +446,7 @@ class TurnflowModes(am.ArrayObjman):
         Export flow data of desired mode to xml file.
         Returns list with edge IDs with non zero flows and a flow ID counter.
         """
-        print 'TurnflowModes.export_turns_xml'
+        print('TurnflowModes.export_turns_xml')
 
         if self.ids_mode.has_index(id_mode):
             id_tf_modes = self.ids_mode.get_id_from_index(id_mode)
@@ -502,7 +502,7 @@ class Turnflows(am.ArrayObjman):
         """
         Makes sure that sum of turn probabilities from an edge equals 1.
         """
-        print 'Turnflows.normalize_turnprobabilities'
+        print('Turnflows.normalize_turnprobabilities')
         # for turnflowmode in self.turnflowmodes.get_value():
         #    turnflowmode.normalize_turnprobabilities() # no! it's a dict!!
         # print '  ',self.turnflowmodes.get_value()
@@ -589,9 +589,9 @@ class Turnflows(am.ArrayObjman):
         In the SUMOpy tunflow data structure, each mode has its own 
         flow and turnratio data.
         """
-        print '\n\n'+79*'_'
-        print 'export_flows_and_turns id_mode=', id_mode, 'ids_vtype=', self.parent.vtypes.select_by_mode(id_mode)
-        print '  write flows', flowfilepath
+        print('\n\n'+79*'_')
+        print('export_flows_and_turns id_mode=', id_mode, 'ids_vtype=', self.parent.vtypes.select_by_mode(id_mode))
+        print('  write flows', flowfilepath)
         fd = open(flowfilepath, 'w')
         fd.write(xm.begin('flows', indent))
 
@@ -707,14 +707,14 @@ class Turnflows(am.ArrayObjman):
             scenario.net.export_netxml()
 
         ids_mode = self.get_modes()
-        print 'turnflows_to_routes', ids_mode  # scenario.net.modes.get_ids()
-        print '  cmloptions', cmloptions
+        print('turnflows_to_routes', ids_mode)  # scenario.net.modes.get_ids()
+        print('  cmloptions', cmloptions)
 
         # route for all modes and read in routes
         for id_mode in ids_mode:
             # write flow and turns xml file for this mode
             time_start, time_end = self.export_flows_and_turns(flowfilepath, turnfilepath, id_mode)
-            print '  time_start, time_end =', time_start, time_end
+            print('  time_start, time_end =', time_start, time_end)
 
             if time_end > time_start:  # means there exist some flows for this mode
                 cmd = 'jtrrouter --route-files=%s --turn-ratio-files=%s --net-file=%s --output-file=%s --begin %s --end %s %s'\
@@ -733,7 +733,7 @@ class Turnflows(am.ArrayObjman):
                         os.remove(routefilepath)
 
             else:
-                print 'jtrroute: no flows generated for id_mode', id_mode
+                print('jtrroute: no flows generated for id_mode', id_mode)
 
         # self.simfiles.set_modified_data('rou',True)
         # self.simfiles.set_modified_data('trip',True)
@@ -872,9 +872,9 @@ class TurnflowRouter(db.TripoptionMixin,
         #                )
 
     def do(self):
-        print 'do'
+        print('do')
         cml = self.get_cml(is_without_command=True)  # only options, not the command #
-        print '  cml=', cml
+        print('  cml=', cml)
         self.parent.turnflows_to_routes(is_clear_trips=self.is_clear_trips,
                                         is_export_network=self.is_export_network,
                                         is_make_probabilities=True,
@@ -972,7 +972,7 @@ class TurnflowImporter(Process):
         ids_sumoedge_notexist = []
         pairs_sumoedge_unconnected = []
 
-        print 'import_pat_csv', self.tffilepath
+        print('import_pat_csv', self.tffilepath)
         i_line = 1
         for line in f.readlines():
             cols = line.split(sep)
@@ -1006,12 +1006,12 @@ class TurnflowImporter(Process):
                                                                id_fromedge, id_toedge, turnflow)
 
             else:
-                print 'WARNING: inconsistent row in line %d, file %s' % (i_line, self.tffilepath)
+                print('WARNING: inconsistent row in line %d, file %s' % (i_line, self.tffilepath))
             i_line += 1
         f.close()
         if len(ids_sumoedge_notexist) > 0:
-            print 'WARNING: inexistant edge IDs:', ids_sumoedge_notexist
+            print('WARNING: inexistant edge IDs:', ids_sumoedge_notexist)
         if len(pairs_sumoedge_unconnected) > 0:
-            print 'WARNING: unconnected edge pairs:', pairs_sumoedge_unconnected
+            print('WARNING: unconnected edge pairs:', pairs_sumoedge_unconnected)
 
         return ids_sumoedge_notexist, pairs_sumoedge_unconnected
--- a/tools/contributed/sumopy/coremodules/demand/vehicles.py
+++ b/tools/contributed/sumopy/coremodules/demand/vehicles.py
@@ -117,7 +117,7 @@ ALIGNMMENTS_LAT = ['center', 'left', 'ri
 
 class Electricalprofiles(am.ArrayObjman):
     def __init__(self, ident, parent, **kwargs):
-        print 'Electricalprofiles.__init__'
+        print('Electricalprofiles.__init__')
         self._init_objman(ident=ident,
                           parent=parent,
                           name='Electrical profiles',
@@ -129,7 +129,7 @@ class Electricalprofiles(am.ArrayObjman)
             self.add_profiles_default()
 
     def _init_attributes(self):
-        print 'Electricalprofiles._init_attributes'
+        print('Electricalprofiles._init_attributes')
         self.add_col(SumoIdsConf('profilename', name='Electric profile', perm='rw'))
         self.add_col(am.ArrayConf('capacities_battery', 0.8,
                                   groupnames=['parameters', 'key'],
@@ -189,7 +189,7 @@ class Electricalprofiles(am.ArrayObjman)
 
 class VehicleTypes(am.ArrayObjman):
     def __init__(self, parent, net, is_add_default=True, **kwargs):
-        print 'VehicleTypes.__init__ is_add_default', is_add_default
+        print('VehicleTypes.__init__ is_add_default', is_add_default)
         self._init_objman(ident='vtypes',
                           parent=parent,
                           name='Vehicle Types',
@@ -205,7 +205,7 @@ class VehicleTypes(am.ArrayObjman):
         self.set_version(0.3)
 
     def _init_attributes(self):
-        print 'VehicleTypes._init_attributes', len(self), self.get_ident_abs()
+        print('VehicleTypes._init_attributes', len(self), self.get_ident_abs())
         net = self.parent.get_net()
         demand = self.parent
 
@@ -758,7 +758,7 @@ class VehicleTypes(am.ArrayObjman):
             _id = self.add_row(**row_last)
             # print '  _id',_id
         else:
-            print '  clone last'
+            print('  clone last')
             i = 1
             row_last = self.get_row(self.get_ids()[-1])
             row_last['ids_sumo'] += '_%03d' % i  # important for all indexed attrs!!
@@ -780,7 +780,7 @@ class VehicleTypes(am.ArrayObjman):
             return id_vtype
 
     def add_vtype(self, vtype, **kwargs):
-        print 'add_vtype', vtype, kwargs
+        print('add_vtype', vtype, kwargs)
         if self.ids_sumo.has_index(vtype):
             # vtype already exist
             _id = self.ids_sumo.get_id_from_index(vtype)
@@ -861,7 +861,7 @@ class VehicleTypes(am.ArrayObjman):
         return _id
 
     def add_vtypes_default(self):
-        print 'add_vtypes_default'
+        print('add_vtypes_default')
         # self.del_rows(self.get_ids())
         self.add_vtype('pedestrian',
                        accel=1.5,
@@ -1516,12 +1516,12 @@ class VehicleTypes(am.ArrayObjman):
         # print '  _write_xml_body: done'
 
     def export_xml(self, filepath, encoding='UTF-8'):
-        print 'export_xml to %s' % (filepath)
+        print('export_xml to %s' % (filepath))
 
         try:
             fd = open(filepath, 'w')
         except:
-            print 'WARNING in vtypes.export_xml: could not open', filepath
+            print('WARNING in vtypes.export_xml: could not open', filepath)
             return False
 
         fd.write('<?xml version="1.0" encoding="%s"?>\n' % encoding)
@@ -1539,7 +1539,7 @@ class VehicleTypes(am.ArrayObjman):
     #    attrconfigs_excluded.append('lanechangemodel')
 
     def import_xml(self, filepath):
-        print 'import_xml from %s' % (filepath)
+        print('import_xml from %s' % (filepath))
         reader = VtypeReader(self)
         parse(filepath, reader)
         self.normalize_shares()
--- a/tools/contributed/sumopy/coremodules/demand/virtualpop.py
+++ b/tools/contributed/sumopy/coremodules/demand/virtualpop.py
@@ -1212,7 +1212,7 @@ class WalkStrategy(StrategyMixin):
                 if dist_fac_sqr > max_dist_fac_sqr:
                     preeval[i] = -1
 
-        print '  WalkStrategy.preevaluate', len(np.flatnonzero(preeval >= 0))
+        print('  WalkStrategy.preevaluate', len(np.flatnonzero(preeval >= 0)))
         return preeval
 
     def plan(self, ids_person, logger=None, **kwargs):
@@ -1220,7 +1220,7 @@ class WalkStrategy(StrategyMixin):
         Generates a plan for these person according to this strategie.
         Overriden by specific strategy.
         """
-        print 'WalkStrategy.pan', len(ids_person)
+        print('WalkStrategy.pan', len(ids_person))
         #make_plans_private(self, ids_person = None, mode = 'passenger')
         # routing necessary?
         virtualpop = self.get_virtualpop()
@@ -1258,7 +1258,7 @@ class WalkStrategy(StrategyMixin):
             = virtualpop.get_activities_from_pattern(0, ids_person=ids_person)
 
         if len(ids_person_act) == 0:
-            print 'WARNING in WalkStrategy.plan: no eligible persons found.'
+            print('WARNING in WalkStrategy.plan: no eligible persons found.')
             return False
 
         # temporary maps from ids_person to other parameters
@@ -1277,7 +1277,7 @@ class WalkStrategy(StrategyMixin):
         map_ids_fac_from[ids_person_act] = activities.ids_facility[ids_act_from]
 
         n_plans = len(ids_person_act)
-        print 'TrasitStrategy.plan n_plans=', n_plans
+        print('TrasitStrategy.plan n_plans=', n_plans)
 
         # make initial activity stage
         ids_edge_from = facilities.ids_roadedge_closest[map_ids_fac_from[ids_person_act]]
@@ -1362,8 +1362,8 @@ class WalkStrategy(StrategyMixin):
                 if logger:
                     logger.progress(i/n_pers*100)
                 i += 1.0
-                print 79*'_'
-                print '  id_plan=%d, id_person=%d, ' % (id_plan, id_person)
+                print(79*'_')
+                print('  id_plan=%d, id_person=%d, ' % (id_plan, id_person))
 
                 id_stage_walk1, time = walkstages.append_stage(id_plan, time_from,
                                                                id_edge_from=id_edge_from,
@@ -1473,24 +1473,24 @@ class AutoStrategy(StrategyMixin):
 
         """
         n_pers = len(ids_person)
-        print 'Autostrategy.preevaluate', n_pers, 'persons'
+        print('Autostrategy.preevaluate', n_pers, 'persons')
         persons = self.get_virtualpop()
         preeval = np.zeros(n_pers, dtype=np.int32)
 
         # put -1 for persons without car access
         preeval[persons.ids_iauto[ids_person] == -1] = -1
-        print '  persons having no auto', len(np.flatnonzero(persons.ids_iauto[ids_person] == -1))
+        print('  persons having no auto', len(np.flatnonzero(persons.ids_iauto[ids_person] == -1)))
 
         # put 0 for persons with car but with a different preferred mode
         preeval[(persons.ids_iauto[ids_person] > -1)
                 & (persons.ids_mode_preferred[ids_person] != self._id_mode_auto)] = 0
 
-        print '  persons with car but with a different preferred mode', len(np.flatnonzero((persons.ids_iauto[ids_person] > -1) & (persons.ids_mode_preferred[ids_person] != self._id_mode_auto)))
+        print('  persons with car but with a different preferred mode', len(np.flatnonzero((persons.ids_iauto[ids_person] > -1) & (persons.ids_mode_preferred[ids_person] != self._id_mode_auto))))
 
         # put 2 for persons with car access and who prefer the car
         preeval[(persons.ids_iauto[ids_person] > -1)
                 & (persons.ids_mode_preferred[ids_person] == self._id_mode_auto)] = 2
-        print '  persons  with car access and who prefer the car', len(np.flatnonzero((persons.ids_iauto[ids_person] > -1) & (persons.ids_mode_preferred[ids_person] == self._id_mode_auto)))
+        print('  persons  with car access and who prefer the car', len(np.flatnonzero((persons.ids_iauto[ids_person] > -1) & (persons.ids_mode_preferred[ids_person] == self._id_mode_auto))))
 
         return preeval
 
@@ -1549,7 +1549,7 @@ class AutoStrategy(StrategyMixin):
             = virtualpop.get_activities_from_pattern(0, ids_person=ids_person)
 
         if len(ids_person_act) == 0:
-            print 'WARNING in Autostrategy.plan: no eligible persons found.'
+            print('WARNING in Autostrategy.plan: no eligible persons found.')
             return False
 
         # ok
@@ -1591,7 +1591,7 @@ class AutoStrategy(StrategyMixin):
         map_are_fallback[ids_person_act] = are_fallback
 
         n_plans = len(ids_person_act)
-        print 'AutoStrategy.plan n_plans=', n_plans
+        print('AutoStrategy.plan n_plans=', n_plans)
         # print '  map_ids_parking_from[ids_person_act].shape',map_ids_parking_from[ids_person_act].shape
         # set initial activity
         # this is because the following steps start with travel
@@ -1730,7 +1730,7 @@ class AutoStrategy(StrategyMixin):
                     position_edge_to=pos_edge_parking_from-1.5,  # wait 1.5 m before nose of parked car
                 )
 
-                print '      id_person,id_veh', id_person, id_veh
+                print('      id_person,id_veh', id_person, id_veh)
                 # ride from  car parking to road edge near activity
                 id_stage_car, time, is_fallback = ridestages.append_stage(
                     id_plan,
@@ -1891,24 +1891,24 @@ class BikeStrategy(StrategyMixin):
 
         """
         n_pers = len(ids_person)
-        print 'BikeStrategy.preevaluate', n_pers, 'persons'
+        print('BikeStrategy.preevaluate', n_pers, 'persons')
         persons = self.get_virtualpop()
         preeval = np.zeros(n_pers, dtype=np.int32)
 
         # put -1 for persons without car access
         preeval[persons.ids_ibike[ids_person] == -1] = -1
-        print '  persons having no bike', len(np.flatnonzero(persons.ids_ibike[ids_person] == -1))
+        print('  persons having no bike', len(np.flatnonzero(persons.ids_ibike[ids_person] == -1)))
 
         # put 0 for persons with bike but with a different preferred mode
         preeval[(persons.ids_ibike[ids_person] > -1)
                 & (persons.ids_mode_preferred[ids_person] != self._id_mode_bike)] = 0
 
-        print '  persons with bike but with a different preferred mode', len(np.flatnonzero((persons.ids_ibike[ids_person] > -1) & (persons.ids_mode_preferred[ids_person] != self._id_mode_bike)))
+        print('  persons with bike but with a different preferred mode', len(np.flatnonzero((persons.ids_ibike[ids_person] > -1) & (persons.ids_mode_preferred[ids_person] != self._id_mode_bike))))
 
         # put 2 for persons with bike access and who prefer the bike
         preeval[(persons.ids_ibike[ids_person] > -1)
                 & (persons.ids_mode_preferred[ids_person] == self._id_mode_bike)] = 2
-        print '  persons  with car access and who prefer the car', len(np.flatnonzero((persons.ids_ibike[ids_person] > -1) & (persons.ids_mode_preferred[ids_person] == self._id_mode_bike)))
+        print('  persons  with car access and who prefer the car', len(np.flatnonzero((persons.ids_ibike[ids_person] > -1) & (persons.ids_mode_preferred[ids_person] == self._id_mode_bike))))
 
         return preeval
 
@@ -1993,7 +1993,7 @@ class BikeStrategy(StrategyMixin):
                 pos = 0.5*self.length_edge_min
 
         if id_bikeedge == -1:
-            print 'WARNING in get_edge_bikeaccess no access for', id_edge, self._edges.ids_sumo[id_edge]
+            print('WARNING in get_edge_bikeaccess no access for', id_edge, self._edges.ids_sumo[id_edge])
 
         if is_get_route:
             return id_bikeedge, pos, route
@@ -2175,7 +2175,7 @@ class BikeStrategy(StrategyMixin):
             = virtualpop.get_activities_from_pattern(0, ids_person=ids_person)
 
         if len(ids_person_act) == 0:
-            print 'WARNING in BikeStrategy.plan: no eligible persons found.'
+            print('WARNING in BikeStrategy.plan: no eligible persons found.')
             return False
 
         # ok
@@ -2205,7 +2205,7 @@ class BikeStrategy(StrategyMixin):
         #map_ids_parking_from[ids_person_act] = ids_parking_from
 
         n_plans = len(ids_person_act)
-        print 'BikeStrategy.plan n_plans=', n_plans
+        print('BikeStrategy.plan n_plans=', n_plans)
         # print '  map_ids_parking_from[ids_person_act].shape',map_ids_parking_from[ids_person_act].shape
         # set initial activity
         # this is because the following steps start with travel
@@ -2313,9 +2313,9 @@ class BikeStrategy(StrategyMixin):
                 if logger:
                     logger.progress(i/n_pers*100)
                 i += 1.0
-                print 79*'*'
-                print '  plan id_plan', id_plan, 'time_from', time_from, 'from', id_edge_from, pos_edge_from, 'to', id_edge_to, pos_edge_to
-                print '  id_edge_from', edges.ids_sumo[id_edge_from], 'id_edge_to', edges.ids_sumo[id_edge_to]
+                print(79*'*')
+                print('  plan id_plan', id_plan, 'time_from', time_from, 'from', id_edge_from, pos_edge_from, 'to', id_edge_to, pos_edge_to)
+                print('  id_edge_from', edges.ids_sumo[id_edge_from], 'id_edge_to', edges.ids_sumo[id_edge_to])
 
                 time = self.plan_bikeride(id_plan, time_from, id_veh,
                                           id_edge_from, pos_edge_from,
@@ -2446,14 +2446,14 @@ class TaxiStrategy(StrategyMixin):
         # put 2 for persons with car access and who prefer cars
         preeval[persons.ids_mode_preferred[ids_person] == self._id_mode_taxi] = 2
 
-        print '  TaxiStrategy.preevaluate', len(np.flatnonzero(preeval))
+        print('  TaxiStrategy.preevaluate', len(np.flatnonzero(preeval)))
         return preeval
 
     def get_edge_access(self, id_edge, is_search_backward=False, is_get_route=False, is_star=False, bstar=0, fstar=0, n_iter_acces_max=None):
         # get firts edge allowing bikes and pedestrian, saving route, frontward or backward. You can include bstar or fstar:
         # check only connected links. You can obtain also the route.
         # print 'get_edge_bikeaccess',id_edge, is_search_backward,'id_sumo',self._edges.ids_sumo[id_edge]
-        print 'get_edge_access id_edge', id_edge, 'is_search_backward', is_search_backward, 'n_iter_acces_max', self.n_iter_acces_max
+        print('get_edge_access id_edge', id_edge, 'is_search_backward', is_search_backward, 'n_iter_acces_max', self.n_iter_acces_max)
         if n_iter_acces_max is None:
             n_iter_acces_max = self.n_iter_acces_max
 
@@ -2480,15 +2480,15 @@ class TaxiStrategy(StrategyMixin):
         ids = [id_edge]
         coll_ids = [0]
         route = []
-        print 'start  id_modeedge', id_modeedge, 'n', n, 'n_iter_acces_max', n_iter_acces_max, (id_modeedge < 0), (n < n_iter_acces_max)
+        print('start  id_modeedge', id_modeedge, 'n', n, 'n_iter_acces_max', n_iter_acces_max, (id_modeedge < 0), (n < n_iter_acces_max))
 
         while (id_modeedge < 0) & (n < n_iter_acces_max):
-            print '    while id_modeedge', id_modeedge, 'n', n
+            print('    while id_modeedge', id_modeedge, 'n', n)
             n += 1
 
             ids_new = []
             for id_edge_test, is_long_enough in zip(ids_current, edgelengths[ids_current] > self.length_edge_min):
-                print '    check id', id_edge_test, is_long_enough, 'taxi access', get_accesslevel(id_edge_test, id_mode), 'ped access', get_accesslevel(id_edge_test, id_mode_ped)
+                print('    check id', id_edge_test, is_long_enough, 'taxi access', get_accesslevel(id_edge_test, id_mode), 'ped access', get_accesslevel(id_edge_test, id_mode_ped))
                 if is_long_enough & (get_accesslevel(id_edge_test, id_mode) >= 0) & (get_accesslevel(id_edge_test, id_mode_ped) >= 0):
                     id_modeedge = id_edge_test
 
@@ -2505,7 +2505,7 @@ class TaxiStrategy(StrategyMixin):
                         if is_search_backward is not True:
                             route.reverse()
 
-                    print '    found', id_modeedge, self._edges.ids_sumo[id_modeedge]
+                    print('    found', id_modeedge, self._edges.ids_sumo[id_modeedge])
                     break
                 else:
 
@@ -2532,7 +2532,7 @@ class TaxiStrategy(StrategyMixin):
                 pos = 0.5*self.length_edge_min
 
         if id_modeedge == -1:
-            print 'WARNING in TaxiStrategy.get_edge_access no access at id_edge', id_edge, self._edges.ids_sumo[id_edge]
+            print('WARNING in TaxiStrategy.get_edge_access no access at id_edge', id_edge, self._edges.ids_sumo[id_edge])
 
         if is_get_route:
             return id_modeedge, pos, route
@@ -2553,7 +2553,7 @@ class TaxiStrategy(StrategyMixin):
         id_edge_to_taxi, pos_to_taxi = self.get_edge_access(id_edge_to, is_search_backward=True)
 
         if (dist_from_to < dist_walk_max) | (id_edge_from_taxi == -1) | (id_edge_to_taxi == -1):
-            print '    go by foot because distance is too short or no taxi access', dist_from_to, id_edge_from_taxi, id_edge_to_taxi
+            print('    go by foot because distance is too short or no taxi access', dist_from_to, id_edge_from_taxi, id_edge_to_taxi)
             id_stage_walk1, time = walkstages.append_stage(
                 id_plan, time_from,
                 id_edge_from=id_edge_from,
@@ -2563,12 +2563,12 @@ class TaxiStrategy(StrategyMixin):
             )
 
         else:
-            print '    try to take the taxi'
+            print('    try to take the taxi')
             # print '    id_edge_from_taxi',edges.ids_sumo[id_edge_from_taxi],pos_from_taxi
             # print '    id_edge_to_taxi',edges.ids_sumo[id_edge_to_taxi],pos_to_taxi
 
             if id_edge_from_taxi != id_edge_from:
-                print '    must walk from origin to taxi accessible edge, time_from', time_from
+                print('    must walk from origin to taxi accessible edge, time_from', time_from)
                 # walk to taxi edge
                 id_stage_walk1, time = walkstages.append_stage(
                     id_plan, time_from,
@@ -2579,7 +2579,7 @@ class TaxiStrategy(StrategyMixin):
                 )
 
                 if id_edge_to_taxi != id_edge_to:
-                    print '      must walk from taxi accessible edge to dest, time_from', time
+                    print('      must walk from taxi accessible edge to dest, time_from', time)
                     # take taxi
                     id_stage_taxi, time = ridestages.append_stage(
                         id_plan, time,
@@ -2602,7 +2602,7 @@ class TaxiStrategy(StrategyMixin):
                         )
 
                 else:
-                    print '    ride  taxi from taxi edge to destination', time
+                    print('    ride  taxi from taxi edge to destination', time)
                     # take taxi
                     id_stage_taxi, time = ridestages.append_stage(
                         id_plan, time,
@@ -2615,9 +2615,9 @@ class TaxiStrategy(StrategyMixin):
                         position_edge_to=pos_edge_to,
                     )
             else:
-                print '    take taxi directly from edge of origin', time_from
+                print('    take taxi directly from edge of origin', time_from)
                 if id_edge_to_taxi != id_edge_to:
-                    print '      must walk from taxi accessible destination to destination', time_from
+                    print('      must walk from taxi accessible destination to destination', time_from)
 
                     id_stage_taxi, time = ridestages.append_stage(
                         id_plan, time_from,
@@ -2638,7 +2638,7 @@ class TaxiStrategy(StrategyMixin):
                             position_edge_to=pos_edge_to,
                         )
                 else:
-                    print '    take taxi directly from origin to destination', time_from
+                    print('    take taxi directly from origin to destination', time_from)
                     id_stage_taxi, time = ridestages.append_stage(
                         id_plan, time_from,
                         id_veh=id_veh,
@@ -2654,7 +2654,7 @@ class TaxiStrategy(StrategyMixin):
             # if not, for whatever reason,
             # we walk from origin to destination
             if id_stage_taxi == -1:
-                print '    walk because no ride stage has been planned', time_from
+                print('    walk because no ride stage has been planned', time_from)
                 if id_stage_walk1 == -1:
                     # no walk stage has been planned
                     id_stage_walk1, time = walkstages.append_stage(
@@ -2715,7 +2715,7 @@ class TaxiStrategy(StrategyMixin):
             = virtualpop.get_activities_from_pattern(0, ids_person=ids_person)
 
         if len(ids_person_act) == 0:
-            print 'WARNING in TaxiStrategy.plan: no eligible persons found.'
+            print('WARNING in TaxiStrategy.plan: no eligible persons found.')
             return False
 
         # ok
@@ -2745,7 +2745,7 @@ class TaxiStrategy(StrategyMixin):
         #map_ids_parking_from[ids_person_act] = ids_parking_from
 
         n_plans = len(ids_person_act)
-        print 'TaxiStrategy.plan n_plans=', n_plans
+        print('TaxiStrategy.plan n_plans=', n_plans)
         # print '  map_ids_parking_from[ids_person_act].shape',map_ids_parking_from[ids_person_act].shape
         # set initial activity
         # this is because the following steps start with travel
@@ -2832,9 +2832,9 @@ class TaxiStrategy(StrategyMixin):
                 if logger:
                     logger.progress(i/n_pers*100)
                 i += 1.0
-                print 79*'*'
-                print '  plan id_plan', id_plan, 'time_from', time_from, 'from', id_edge_from, pos_edge_from, 'to', id_edge_to, pos_edge_to
-                print '  id_edge_from', edges.ids_sumo[id_edge_from], 'id_edge_to', edges.ids_sumo[id_edge_to]
+                print(79*'*')
+                print('  plan id_plan', id_plan, 'time_from', time_from, 'from', id_edge_from, pos_edge_from, 'to', id_edge_to, pos_edge_to)
+                print('  id_edge_from', edges.ids_sumo[id_edge_from], 'id_edge_to', edges.ids_sumo[id_edge_to])
 
                 time = self.plan_taxiride(id_plan, time_from, id_veh,
                                           id_edge_from, pos_edge_from,
@@ -2955,24 +2955,24 @@ class MotorcycleStrategy(StrategyMixin):
 
         """
         n_pers = len(ids_person)
-        print 'MotorcycleStrategy.preevaluate', n_pers, 'persons'
+        print('MotorcycleStrategy.preevaluate', n_pers, 'persons')
         persons = self.get_virtualpop()
         preeval = np.zeros(n_pers, dtype=np.int32)
 
         # put -1 for persons without motorcycle access
         preeval[persons.ids_imoto[ids_person] == -1] = -1
-        print '  persons having no motorcycle', len(np.flatnonzero(persons.ids_imoto[ids_person] == -1))
+        print('  persons having no motorcycle', len(np.flatnonzero(persons.ids_imoto[ids_person] == -1)))
 
         # put 0 for persons with motorcycle but with a different preferred mode
         preeval[(persons.ids_imoto[ids_person] > -1)
                 & (persons.ids_mode_preferred[ids_person] != self._id_mode_moto)] = 0
 
-        print '  persons with motorcycle but with a different preferred mode', len(np.flatnonzero((persons.ids_imoto[ids_person] > -1) & (persons.ids_mode_preferred[ids_person] != self._id_mode_moto)))
+        print('  persons with motorcycle but with a different preferred mode', len(np.flatnonzero((persons.ids_imoto[ids_person] > -1) & (persons.ids_mode_preferred[ids_person] != self._id_mode_moto))))
 
         # put 2 for persons with motorcycle access and who prefer the car
         preeval[(persons.ids_imoto[ids_person] > -1)
                 & (persons.ids_mode_preferred[ids_person] == self._id_mode_moto)] = 2
-        print '  persons  with motorcycle access and who prefer the car', len(np.flatnonzero((persons.ids_imoto[ids_person] > -1) & (persons.ids_mode_preferred[ids_person] == self._id_mode_moto)))
+        print('  persons  with motorcycle access and who prefer the car', len(np.flatnonzero((persons.ids_imoto[ids_person] > -1) & (persons.ids_mode_preferred[ids_person] == self._id_mode_moto))))
 
         return preeval
 
@@ -3056,7 +3056,7 @@ class MotorcycleStrategy(StrategyMixin):
                 pos = 0.5*self.length_edge_min
 
         if id_motoedge == -1:
-            print 'WARNING in get_edge_motoaccess no access for', id_edge, self._edges.ids_sumo[id_edge]
+            print('WARNING in get_edge_motoaccess no access for', id_edge, self._edges.ids_sumo[id_edge])
 
         if is_get_route:
             return id_motoedge, pos, route
@@ -3238,7 +3238,7 @@ class MotorcycleStrategy(StrategyMixin):
             = virtualpop.get_activities_from_pattern(0, ids_person=ids_person)
 
         if len(ids_person_act) == 0:
-            print 'WARNING in MotorcycleStrategy.plan: no eligible persons found.'
+            print('WARNING in MotorcycleStrategy.plan: no eligible persons found.')
             return False
 
         # ok
@@ -3268,7 +3268,7 @@ class MotorcycleStrategy(StrategyMixin):
         #map_ids_parking_from[ids_person_act] = ids_parking_from
 
         n_plans = len(ids_person_act)
-        print 'MotorcycleStrategy.plan n_plans=', n_plans
+        print('MotorcycleStrategy.plan n_plans=', n_plans)
         # print '  map_ids_parking_from[ids_person_act].shape',map_ids_parking_from[ids_person_act].shape
         # set initial activity
         # this is because the following steps start with travel
@@ -3376,9 +3376,9 @@ class MotorcycleStrategy(StrategyMixin):
                 if logger:
                     logger.progress(i/n_pers*100)
                 i += 1.0
-                print 79*'*'
-                print '  plan id_plan', id_plan, 'time_from', time_from, 'from', id_edge_from, pos_edge_from, 'to', id_edge_to, pos_edge_to
-                print '  id_edge_from', edges.ids_sumo[id_edge_from], 'id_edge_to', edges.ids_sumo[id_edge_to]
+                print(79*'*')
+                print('  plan id_plan', id_plan, 'time_from', time_from, 'from', id_edge_from, pos_edge_from, 'to', id_edge_to, pos_edge_to)
+                print('  id_edge_from', edges.ids_sumo[id_edge_from], 'id_edge_to', edges.ids_sumo[id_edge_to])
 
                 time = self.plan_motoride(id_plan, time_from, id_veh,
                                           id_edge_from, pos_edge_from,
@@ -3489,7 +3489,7 @@ class TransitStrategy(StrategyMixin):
         # put 2 for persons with car access and who prefer cars
         preeval[persons.ids_mode_preferred[ids_person] == self._id_mode_bus] = 2
 
-        print '  TransitStrategy.preevaluate', len(np.flatnonzero(preeval))
+        print('  TransitStrategy.preevaluate', len(np.flatnonzero(preeval)))
         return preeval
 
     def plan_transit(self, id_plan, time_from,
@@ -3504,14 +3504,14 @@ class TransitStrategy(StrategyMixin):
                      ids_laneedge, ids_stoplane, ptstops):
 
         edges = self.get_scenario().net.edges
-        print 'plan_transit id_plan', id_plan, 'id_edge_from %d (%s)' % (id_edge_from, edges.ids_sumo[id_edge_from]), 'id_edge_to %d (%s)' % (id_edge_to, edges.ids_sumo[id_edge_to])
+        print('plan_transit id_plan', id_plan, 'id_edge_from %d (%s)' % (id_edge_from, edges.ids_sumo[id_edge_from]), 'id_edge_to %d (%s)' % (id_edge_to, edges.ids_sumo[id_edge_to]))
 
         # debug?
         is_debug = False  # id_plan == 14983
 
         if is_debug:
 
-            print '  id_stop_from', id_stop_from, 'id_stop_to', id_stop_to
+            print('  id_stop_from', id_stop_from, 'id_stop_to', id_stop_to)
 
         ptlinks = ptlines.get_ptlinks()
         ptlinktypes = ptlinks.types.choices
@@ -3527,9 +3527,9 @@ class TransitStrategy(StrategyMixin):
             time = time_from
             id_stage_walk1 = None
             if is_debug:
-                print '  no initial walk required.'
-                print '    id_edge_from', id_edge_from, edges.ids_sumo[id_edge_from]
-                print '    pos_edge_from', pos_edge_from
+                print('  no initial walk required.')
+                print('    id_edge_from', id_edge_from, edges.ids_sumo[id_edge_from])
+                print('    pos_edge_from', pos_edge_from)
         else:
             id_stage_walk1, time = walkstages.append_stage(id_plan, time_from,
                                                            id_edge_from=id_edge_from,
@@ -3538,20 +3538,20 @@ class TransitStrategy(StrategyMixin):
                                                            position_edge_to=pos_stop_from,  # -7.0,
                                                            )
             if is_debug:
-                print '  add initial walk stage'
-                print '    id_edge_from', id_edge_from, edges.ids_sumo[id_edge_from]
-                print '    pos_edge_from', pos_edge_from
-                print '     IIIInitial walk'
-                print '    id_stopedge_from', id_stopedge_from, edges.ids_sumo[id_stopedge_from]
-                print '    pos_stop_from', pos_stop_from
+                print('  add initial walk stage')
+                print('    id_edge_from', id_edge_from, edges.ids_sumo[id_edge_from])
+                print('    pos_edge_from', pos_edge_from)
+                print('     IIIInitial walk')
+                print('    id_stopedge_from', id_stopedge_from, edges.ids_sumo[id_stopedge_from])
+                print('    pos_stop_from', pos_stop_from)
 
         if is_debug:
-            print '      TTTransit'
-            print '    id_stopedge_to', id_stopedge_to, edges.ids_sumo[id_stopedge_to]
-            print '    pos_stop_to', pos_stop_to
-            print ' ----------------------------------'
-            print '    id_stop_from', id_stop_from
-            print '    id_stop_to', id_stop_to
+            print('      TTTransit')
+            print('    id_stopedge_to', id_stopedge_to, edges.ids_sumo[id_stopedge_to])
+            print('    pos_stop_to', pos_stop_to)
+            print(' ----------------------------------')
+            print('    id_stop_from', id_stop_from)
+            print('    id_stop_to', id_stop_to)
 
         durations, linktypes, ids_line, ids_fromstop, ids_tostop =\
             ptlinks.route(id_stop_from, id_stop_to,
@@ -3560,12 +3560,12 @@ class TransitStrategy(StrategyMixin):
                           stops_to_exit=stops_to_exit)
 
         if is_debug:
-            print '  routing done. make plan, success', len(linktypes) > 0
+            print('  routing done. make plan, success', len(linktypes) > 0)
 
         if is_debug:
-            print '  ids_line    ', ids_line
-            print '  ids_fromstop', ids_fromstop
-            print '  ids_tostop  ', ids_tostop
+            print('  ids_line    ', ids_line)
+            print('  ids_fromstop', ids_fromstop)
+            print('  ids_tostop  ', ids_tostop)
 
         if (type_transit in linktypes):  # is there any public transport line to take?
 
@@ -3584,7 +3584,7 @@ class TransitStrategy(StrategyMixin):
             # check if initial walk needs to be modified
             if (id_stage_walk1 is not None) & (linktypes[0] == type_walk):
                 if is_debug:
-                    print '    Modify initial walk from stop fromedge %d (%s) toedge %d (%s)' % (id_edge_from, edges.ids_sumo[id_edge_from], ids_stopedge_from[0], edges.ids_sumo[ids_stopedge_from[0]])
+                    print('    Modify initial walk from stop fromedge %d (%s) toedge %d (%s)' % (id_edge_from, edges.ids_sumo[id_edge_from], ids_stopedge_from[0], edges.ids_sumo[ids_stopedge_from[0]]))
 
                 is_initial_walk_done = True
                 time = walkstages.modify_stage(
@@ -3609,16 +3609,16 @@ class TransitStrategy(StrategyMixin):
                         ids_stopedge_to, poss_stop_to,
                         ):
                 if is_debug:
-                    print '    ...........................'
-                    print '    stage for linktype %2d fromedge %s toedge %s' % (linktype, edges.ids_sumo[id_stopedge_from], edges.ids_sumo[id_stopedge_to])
-                    print '        id_stopedge_from,id_stopedge_to', id_stopedge_from, id_stopedge_to
+                    print('    ...........................')
+                    print('    stage for linktype %2d fromedge %s toedge %s' % (linktype, edges.ids_sumo[id_stopedge_from], edges.ids_sumo[id_stopedge_to]))
+                    print('        id_stopedge_from,id_stopedge_to', id_stopedge_from, id_stopedge_to)
 
                 if linktype == type_transit:  # transit!
                     # check if last link type has also been a transit
                     if i > 0:
                         if linktypes[i-1] == type_transit:
                             if is_debug:
-                                print '    add inter-transit walk stage'
+                                print('    add inter-transit walk stage')
                             # introdice a walk stage to be sure that
                             # person gets to the middle of the stop
                             id_stage_transfer, time = walkstages.append_stage(
@@ -3631,7 +3631,7 @@ class TransitStrategy(StrategyMixin):
                             )
 
                     if is_debug:
-                        print '    add transit stage id_line', id_line
+                        print('    add transit stage id_line', id_line)
                     id_stage_transit, time = transitstages.append_stage(
                         id_plan, time,
                         id_line=id_line,
@@ -3644,7 +3644,7 @@ class TransitStrategy(StrategyMixin):
                 elif (linktype == type_walk) & ((i > 0) | (not is_initial_walk_done)):
                     # walk to transfer, no initial walk if done
                     if is_debug:
-                        print '    add walk to transfer'
+                        print('    add walk to transfer')
                     id_stage_transfer, time = walkstages.append_stage(
                         id_plan, time,
                         id_edge_from=id_stopedge_from,
@@ -3658,18 +3658,18 @@ class TransitStrategy(StrategyMixin):
                 else:  # all other link time are no modelld
                     # do not do anything , just add wait time to next stage
                     if is_debug:
-                        print '    do noting add duration', duration
+                        print('    do noting add duration', duration)
                     duration_wait += duration
 
             # walk from final stop to activity
             i = len(linktypes)-1  # last link index
 
             if is_debug:
-                print '  linktypes', linktypes, 'i', i, 'linktypes[i]', linktypes[i], linktypes[i] == type_walk
+                print('  linktypes', linktypes, 'i', i, 'linktypes[i]', linktypes[i], linktypes[i] == type_walk)
 
             if linktypes[i] == type_walk:
                 if is_debug:
-                    print '    Modify final walk from stop fromedge %d (%s) toedge %d (%s)' % (id_stopedge_to, edges.ids_sumo[id_stopedge_to], id_edge_to, edges.ids_sumo[id_edge_to])
+                    print('    Modify final walk from stop fromedge %d (%s) toedge %d (%s)' % (id_stopedge_to, edges.ids_sumo[id_stopedge_to], id_edge_to, edges.ids_sumo[id_edge_to]))
 
                 time = walkstages.modify_stage(
                     id_stage_transfer,
@@ -3681,7 +3681,7 @@ class TransitStrategy(StrategyMixin):
 
             else:
                 if is_debug:
-                    print '    Add final walk stage  fromedge %d (%s) toedge %d (%s)' % (id_stopedge_to, edges.ids_sumo[id_stopedge_to], id_edge_to, edges.ids_sumo[id_edge_to])
+                    print('    Add final walk stage  fromedge %d (%s) toedge %d (%s)' % (id_stopedge_to, edges.ids_sumo[id_stopedge_to], id_edge_to, edges.ids_sumo[id_edge_to]))
 
                 id_stage_walk2, time = walkstages.append_stage(id_plan, time,
                                                                id_edge_from=id_stopedge_to,
@@ -3693,7 +3693,7 @@ class TransitStrategy(StrategyMixin):
         else:
             # there is no public transport line linking these nodes.
             if is_debug:
-                print '  No PT lines used create direct walk stage'
+                print('  No PT lines used create direct walk stage')
 
             if id_stage_walk1 is None:
                 # Create first walk directly from home to activity
@@ -3720,7 +3720,7 @@ class TransitStrategy(StrategyMixin):
         Generates a plan for these person according to this strategie.
         Overriden by specific strategy.
         """
-        print 'TransitStrategy.plan', len(ids_person)
+        print('TransitStrategy.plan', len(ids_person))
         #make_plans_private(self, ids_person = None, mode = 'passenger')
         # routing necessary?
         virtualpop = self.get_virtualpop()
@@ -3752,12 +3752,12 @@ class TransitStrategy(StrategyMixin):
         # print '   demand.virtualpop',demand.virtualpop,dir(demand.virtualpop)
         # print '   demand.trips',demand.trips,dir(demand.trips)
         if len(ptlines) == 0:
-            print 'WARNING in TrasitStrategy.plan: no transit services available. Create public trasit services by connecting stops.'
+            print('WARNING in TrasitStrategy.plan: no transit services available. Create public trasit services by connecting stops.')
             return False
 
         ptlinks = ptlines.get_ptlinks()
         if len(ptlinks) == 0:
-            print 'WARNING in TrasitStrategy.plan: no public transport links. Run methods: "create routes" and "build links" from public trasport services.'
+            print('WARNING in TrasitStrategy.plan: no public transport links. Run methods: "create routes" and "build links" from public trasport services.')
             return False
 
         ptlinktypes = ptlinks.types.choices
@@ -3779,7 +3779,7 @@ class TransitStrategy(StrategyMixin):
             = virtualpop.get_activities_from_pattern(0, ids_person=ids_person)
 
         if len(ids_person_act) == 0:
-            print 'WARNING in TrasitStrategy.plan: no eligible persons found.'
+            print('WARNING in TrasitStrategy.plan: no eligible persons found.')
             return False
 
         # temporary maps from ids_person to other parameters
@@ -3798,7 +3798,7 @@ class TransitStrategy(StrategyMixin):
         map_ids_fac_from[ids_person_act] = activities.ids_facility[ids_act_from]
 
         n_plans = len(ids_person_act)
-        print 'TrasitStrategy.plan n_plans=', n_plans
+        print('TrasitStrategy.plan n_plans=', n_plans)
 
         # make initial activity stage
         ids_edge_from = facilities.ids_roadedge_closest[map_ids_fac_from[ids_person_act]]
@@ -3883,8 +3883,8 @@ class TransitStrategy(StrategyMixin):
                 if logger:
                     logger.progress(i/n_pers*100)
                 i += 1.0
-                print 79*'_'
-                print '  id_plan=%d, id_person=%d, ' % (id_plan, id_person)
+                print(79*'_')
+                print('  id_plan=%d, id_person=%d, ' % (id_plan, id_person))
 
                 time = self.plan_transit(id_plan, time_from,
                                          id_edge_from, pos_edge_from,
@@ -3973,7 +3973,7 @@ class BikeTransitStrategy(BikeStrategy,
         # put 2 for persons with bike access and who prefer bike or bus
         preeval[inds_avail & inds_prefer] = 1
 
-        print '  BikeTransitStrategy.preevaluate', len(np.flatnonzero(preeval))
+        print('  BikeTransitStrategy.preevaluate', len(np.flatnonzero(preeval)))
         return preeval
 
     def plan(self, ids_person, logger=None, **kwargs):
@@ -3981,7 +3981,7 @@ class BikeTransitStrategy(BikeStrategy,
         Generates a plan for these person according to this strategie.
         Overriden by specific strategy.
         """
-        print 'TransitStrategy.plan', len(ids_person)
+        print('TransitStrategy.plan', len(ids_person))
         #make_plans_private(self, ids_person = None, mode = 'passenger')
         # routing necessary?
         virtualpop = self.get_virtualpop()
@@ -4014,7 +4014,7 @@ class BikeTransitStrategy(BikeStrategy,
         # print '   demand.virtualpop',demand.virtualpop,dir(demand.virtualpop)
         # print '   demand.trips',demand.trips,dir(demand.trips)
         if len(ptlines) == 0:
-            print 'WARNING in TrasitStrategy.plan: no transit services available.'
+            print('WARNING in TrasitStrategy.plan: no transit services available.')
             return False
 
         ptlinks = ptlines.get_ptlinks()
@@ -4037,7 +4037,7 @@ class BikeTransitStrategy(BikeStrategy,
             = virtualpop.get_activities_from_pattern(0, ids_person=ids_person)
 
         if len(ids_person_act) == 0:
-            print 'WARNING in TrasitStrategy.plan: no eligible persons found.'
+            print('WARNING in TrasitStrategy.plan: no eligible persons found.')
             return False
 
         # temporary maps from ids_person to other parameters
@@ -4056,7 +4056,7 @@ class BikeTransitStrategy(BikeStrategy,
         map_ids_fac_from[ids_person_act] = activities.ids_facility[ids_act_from]
 
         n_plans = len(ids_person_act)
-        print 'TrasitStrategy.plan n_plans=', n_plans
+        print('TrasitStrategy.plan n_plans=', n_plans)
 
         # make initial activity stage
         ids_edge_from = facilities.ids_roadedge_closest[map_ids_fac_from[ids_person_act]]
@@ -4149,8 +4149,8 @@ class BikeTransitStrategy(BikeStrategy,
                 if logger:
                     logger.progress(i/n_pers*100)
                 i += 1.0
-                print 79*'_'
-                print '  id_plan=%d, id_person=%d, ' % (id_plan, id_person)
+                print(79*'_')
+                print('  id_plan=%d, id_person=%d, ' % (id_plan, id_person))
                 #dist_from_stop_from, dist_stop_to_to
 
                 time = self.plan_bikeride(id_plan, time_from, id_veh,
@@ -4323,14 +4323,14 @@ class Strategies(am.ArrayObjman):
             2  : Strategy uses predomunantly preferred mode
 
         """
-        print 'preevaluate strategies'
+        print('preevaluate strategies')
         ids_strat = self.get_ids()
         n_pers = len(ids_person)
         n_strat = len(ids_strat)
 
         preeval = np.zeros((n_pers, n_strat), dtype=np.int32)
         for i, strategy in zip(range(n_strat), self.strategies[ids_strat]):
-            print '  preevaluate strategiy', strategy.ident
+            print('  preevaluate strategiy', strategy.ident)
             preeval[i, :] = strategy.preevaluate(ids_person)
 
         return ids_strat, preeval
@@ -4437,7 +4437,7 @@ class StageTypeMixin(am.ArrayObjman):
         Returns a vector mapping id_edge to edge travel times
         for given mode id_mode
         """
-        print 'get_times', self._timesmap.keys()
+        print('get_times', self._timesmap.keys())
 
         if not self._timesmap.has_key(id_mode):
             edges = self.get_virtualpop().get_scenario().net.edges
@@ -4452,7 +4452,7 @@ class StageTypeMixin(am.ArrayObjman):
         Returns a vector mapping id_edge to edge distances
         for given mode id_mode
         """
-        print 'get_distances', self._distancesmap.keys()
+        print('get_distances', self._distancesmap.keys())
 
         if not self._distancesmap.has_key(id_mode):
             edges = self.get_virtualpop().get_scenario().net.edges
@@ -4467,7 +4467,7 @@ class StageTypeMixin(am.ArrayObjman):
         Returns a fstar
         for given mode id_mode
         """
-        print 'get_fstar', self._fstarmap.keys()
+        print('get_fstar', self._fstarmap.keys())
 
         if not self._fstarmap.has_key(id_mode):
             edges = self.get_virtualpop().get_scenario().net.edges
@@ -4659,13 +4659,13 @@ class AutorideStages(StageTypeMixin):
 
         If not feasible -1 and start time will be returned.
         """
-        print 'Rides.append_stage id_plan', id_plan, is_fallback
+        print('Rides.append_stage id_plan', id_plan, is_fallback)
 
         route, dist, duration, is_fallback = self.get_route_between_parking(
             id_parking_from, id_parking_to, id_mode,
             is_fallback, id_mode_fallback,)
 
-        print '  after routing: is_fallback', is_fallback, 'route', route
+        print('  after routing: is_fallback', is_fallback, 'route', route)
 
         if (len(route) > 0):  # |(dist > self.dist_ride_min.get_value()): # is there a connection
             # create stage
@@ -4697,7 +4697,7 @@ class AutorideStages(StageTypeMixin):
 
 
         """
-        print 'get_route_between_parking', id_parking_from, id_parking_to, 'is_fallback', is_fallback, 'id_mode_fallback', id_mode_fallback
+        print('get_route_between_parking', id_parking_from, id_parking_to, 'is_fallback', is_fallback, 'id_mode_fallback', id_mode_fallback)
         scenario = self.get_virtualpop().get_scenario()
         edges = scenario.net.edges
         lanes = scenario.net.lanes
@@ -4711,11 +4711,11 @@ class AutorideStages(StageTypeMixin):
         pos_from, pos_to = parking.positions[[id_parking_from, id_parking_to]]
 
         if is_fallback & (id_mode_fallback is not None):
-            print '   use id_mode_fallback', id_mode_fallback
+            print('   use id_mode_fallback', id_mode_fallback)
             id_mode_current = id_mode_fallback
 
         else:
-            print '   use id_mode', id_mode
+            print('   use id_mode', id_mode)
             id_mode_current = id_mode
 
         # print '  id_edge_from, id_edge_to=',id_edge_from, id_edge_to
@@ -4729,7 +4729,7 @@ class AutorideStages(StageTypeMixin):
         if (len(route) == 0) & (not is_fallback) & (id_mode_fallback is not None):
             is_fallback = True
             id_mode_current = id_mode_fallback
-            print '  no route found with normal mode, try fallback', is_fallback
+            print('  no route found with normal mode, try fallback', is_fallback)
             # now retry with fallback
             duration_approx, route = routing.get_mincostroute_edge2edge(
                 id_edge_from,
@@ -4738,7 +4738,7 @@ class AutorideStages(StageTypeMixin):
                 fstar=self.get_fstar(id_mode_current),
             )
             if len(route) > 0:
-                print '  fallback has been successful'
+                print('  fallback has been successful')
 
         # here is a big problem: starting with the successive node of edge_from
         # may result that the first edge of the route is not  connected with edge_from
@@ -4762,7 +4762,7 @@ class AutorideStages(StageTypeMixin):
     #    return str(self.ids_veh[id_stage])+'.'+str(i_ride)
 
     def get_writexmlinfo(self, ids_plan, is_route=True, is_plain=False):
-        print 'AutorideStages.get_writexmlinfo', len(ids_plan), is_route, 'is_plain', is_plain
+        print('AutorideStages.get_writexmlinfo', len(ids_plan), is_route, 'is_plain', is_plain)
         iautos = self.get_virtualpop().get_iautos()
         writefunc = iautos.prepare_write_xml(is_route, is_plain)
 
@@ -4936,7 +4936,7 @@ class BikerideStages(StageTypeMixin):
             return -1, time_start  # no stage creation took place
 
     def get_writexmlinfo(self, ids_plan, is_route=True, is_plain=False):
-        print 'BikerideStages.get_writexmlinfo', len(ids_plan), is_plain
+        print('BikerideStages.get_writexmlinfo', len(ids_plan), is_plain)
         ibikes = self.get_virtualpop().get_ibikes()
         bikewritefunc = ibikes.prepare_write_xml(is_plain=is_plain)
         ids = self.get_ids_from_ids_plan(ids_plan)
@@ -5110,7 +5110,7 @@ class MotorcyclerideStages(StageTypeMixi
             return -1, time_start  # no stage creation took place
 
     def get_writexmlinfo(self, ids_plan, is_route=True, is_plain=False):
-        print 'MotorcyclerideStages.get_writexmlinfo', len(ids_plan), is_plain
+        print('MotorcyclerideStages.get_writexmlinfo', len(ids_plan), is_plain)
         imotos = self.get_virtualpop().get_imotos()
         motowritefunc = imotos.prepare_write_xml(is_plain=is_plain)
         ids = self.get_ids_from_ids_plan(ids_plan)
@@ -5652,7 +5652,7 @@ class Plans(am.ArrayObjman):
         pass
 
     def clear_plans(self):
-        print 'Plans.clear_plans'
+        print('Plans.clear_plans')
         for stagetable in self.get_stagetables():
             # print '  stagetable',stagetable
             stagetable.clear()
@@ -5918,7 +5918,7 @@ class Virtualpopulation(DemandobjMixin,
         self.clear_rows()
 
     def del_persons(self, ids_pers_delete):
-        print 'delete', len(ids_pers_delete), 'persons'
+        print('delete', len(ids_pers_delete), 'persons')
         ids_plans_all = set()
         ids_activity_del = set()
         lists_ids_plan = self.lists_ids_plan[ids_pers_delete]
@@ -5967,7 +5967,7 @@ class Virtualpopulation(DemandobjMixin,
         """
         Clear all individually owned vehicles.
         """
-        print 'clear_ivehicles'
+        print('clear_ivehicles')
         self.get_iautos().clear_vehicles()
         self.get_ibikes().clear_vehicles()
         self.get_imotos().clear_vehicles()
@@ -6098,9 +6098,9 @@ class Virtualpopulation(DemandobjMixin,
 
         """
         tripnumber = int(scale*tripnumber_tot)
-        print 'disaggregate_odflow', time_start, time_end, id_mode, tripnumber
+        print('disaggregate_odflow', time_start, time_end, id_mode, tripnumber)
 
-        print '  id_activitytype_orig,id_activitytype_dest', id_activitytype_orig, id_activitytype_dest
+        print('  id_activitytype_orig,id_activitytype_dest', id_activitytype_orig, id_activitytype_dest)
 
         # print '  probs_orig',sum(probs_fac_orig)#,'\n',probs_fac_orig
         # print '  probs_dest',sum(probs_fac_dest)#,'\n',probs_fac_dest
@@ -6195,7 +6195,7 @@ class Virtualpopulation(DemandobjMixin,
 
             return ids_person
         else:
-            print 'WARNING in disaggregate_odflow: no probabilities', np.sum(probs_fac_orig), np.sum(probs_fac_dest)
+            print('WARNING in disaggregate_odflow: no probabilities', np.sum(probs_fac_orig), np.sum(probs_fac_dest))
 
             return []
 
@@ -6208,7 +6208,7 @@ class Virtualpopulation(DemandobjMixin,
         if  landusetype_orig and landusetype_dest also landuse types
         of facilities of origin and destination are taken into account.
         """
-        print 'create_pop_from_odflows'
+        print('create_pop_from_odflows')
 
         demand = self.parent
         odflowtab = demand.odintervals.generate_odflows()
@@ -6320,7 +6320,7 @@ class Virtualpopulation(DemandobjMixin,
         # return odflowtab
 
     def add_plans(self, ids_person, id_strategy=-1):
-        print 'add_plans n, id_strategy', len(ids_person), id_strategy
+        print('add_plans n, id_strategy', len(ids_person), id_strategy)
         n_plans = len(ids_person)
         # print '  get_plans',self.get_plans()
         # print '  stagetables',self.get_plans().get_stagetables().get_ident_abs()
@@ -6361,7 +6361,7 @@ class Virtualpopulation(DemandobjMixin,
         #        if id_strat_pers
 
         ids_person_preeval = ids_person[inds_preeval]
-        print 'plan_with_strategy', strategy.ident, 'n_pers', len(ids_person_preeval)
+        print('plan_with_strategy', strategy.ident, 'n_pers', len(ids_person_preeval))
 
         # TODO: is_substitute = is_substitute could be an argument to plan()
         # and then passed to the centralized add_plan() method of the VP.
@@ -6453,10 +6453,10 @@ class Virtualpopulation(DemandobjMixin,
         for id_pers, ids_plan in zip(ids_pers, self.lists_ids_plan[ids_pers]):
             if ids_plan is not None:
                 if len(ids_plan) > 0:
-                    print '  id_pers,ids_plan', id_pers, ids_plan
-                    print '  ids_strat, preeval', plans.ids_strategy[ids_plan], preevals[id_pers, plans.ids_strategy[ids_plan]]
+                    print('  id_pers,ids_plan', id_pers, ids_plan)
+                    print('  ids_strat, preeval', plans.ids_strategy[ids_plan], preevals[id_pers, plans.ids_strategy[ids_plan]])
                     inds_sel = np.flatnonzero(preevals[id_pers, plans.ids_strategy[ids_plan]] == preferred)
-                    print '  inds_sel', inds_sel, inds_sel.dtype
+                    print('  inds_sel', inds_sel, inds_sel.dtype)
                     if len(inds_sel) > 0:
                         #ids_plan_sel = np.array(ids_plan)[inds_sel]
                         # print '    ids_plan_sel',ids_plan_sel
@@ -6500,13 +6500,13 @@ class Virtualpopulation(DemandobjMixin,
         """
 
         ids_pers_all = self.get_ids()
-        print 'select_plans_random', len(ids_pers_all), fraction
+        print('select_plans_random', len(ids_pers_all), fraction)
         times_est = self.get_plans().times_est
         # self.ids_plan.reset()
         # ids_mode[random_choice(n,shares/np.sum(shares))]
 
         ids_pers = ids_pers_all[np.random.random(len(ids_pers_all)) > (1.0-fraction)]
-        print '  ids_pers', ids_pers
+        print('  ids_pers', ids_pers)
         for id_pers, ids_plan in zip(ids_pers, self.lists_ids_plan[ids_pers]):
             if len(ids_plan) > 0:
                 # print '  id_pers,ids_plan',id_pers,ids_plan
@@ -6604,7 +6604,7 @@ class Virtualpopulation(DemandobjMixin,
                     self.ids_plan[id_pers] = np.array(ids_plan_exec)[np.argmin(
                         times_exec[ids_plan_exec]+times_rand_exec)]
 
-        print 'were analyzed  %d persons' % (n_analyzed_persons)
+        print('were analyzed  %d persons' % (n_analyzed_persons))
         return True
 
     def select_plans_next(self, fraction=0.1, **kwargs):
@@ -6645,7 +6645,7 @@ class Virtualpopulation(DemandobjMixin,
         plans = self.get_plans()
         ids_pers_all = self.get_ids()
 
-        print 'select_plans_utility_function', len(ids_pers_all)
+        print('select_plans_utility_function', len(ids_pers_all))
 
         ids_pers = ids_pers_all[np.random.random(len(ids_pers_all)) > (1.0-fraction)]
         times_exec = self.get_plans().times_exec
@@ -6710,7 +6710,7 @@ class Virtualpopulation(DemandobjMixin,
 
         Method used to sort trips when exporting to route or trip xml file
         """
-        print 'Virtualpop.get_writexmlinfo is_plain', is_plain
+        print('Virtualpop.get_writexmlinfo is_plain', is_plain)
         plans = self.get_plans()
 
         ids_pers = self.select_ids(self.ids_plan.get_value() >= 0)
@@ -6741,9 +6741,9 @@ class Virtualpopulation(DemandobjMixin,
             writefuncs_pers[:] = self.write_person_xml
 
             # assemble vectors
-            print '  times_depart_pers.shape', times_depart_pers.shape
-            print '  times_depart_bike.shape', times_depart_bike.shape
-            print '  times_depart_auto.shape', times_depart_auto.shape
+            print('  times_depart_pers.shape', times_depart_pers.shape)
+            print('  times_depart_bike.shape', times_depart_bike.shape)
+            print('  times_depart_auto.shape', times_depart_auto.shape)
             times_depart = np.concatenate((times_depart_pers,
                                            times_depart_auto,
                                            times_depart_bike,
@@ -6850,7 +6850,7 @@ class Virtualpopulation(DemandobjMixin,
         """
 
         ids_res = personresults.get_ids()
-        print 'update_results', len(ids_res)
+        print('update_results', len(ids_res))
         ids_person = personresults.ids_person[ids_res]
         ids_plan = self.ids_plan[ids_person]
         self.get_plans().times_exec[ids_plan] = personresults.times_travel_total[ids_res]
@@ -6864,7 +6864,7 @@ class Virtualpopulation(DemandobjMixin,
         """Reads route information of vehicles, and overwrites existing routes in stages.
         Used for example read results from Duaiterate process.
         """
-        print 'Virtualop.import_routes_xml from %s' % (filepath)
+        print('Virtualop.import_routes_xml from %s' % (filepath))
         if is_clear_trips:
             self.clear_trips()
 
@@ -6873,11 +6873,11 @@ class Virtualpopulation(DemandobjMixin,
         reader = RouteReaderVp(self, counter)
         if 1:  # try:
             parse(filepath, reader)
-            print '  call make_routes', is_generate_ids, 'is_add', is_add
+            print('  call make_routes', is_generate_ids, 'is_add', is_add)
             reader.insert_routes(ids_strategy=ids_strategy)
 
         else:  # except KeyError:
-            print >> sys.stderr, "Error: Problems with reading routes!"
+            print("Error: Problems with reading routes!", file=sys.stderr)
             raise
 
 
@@ -6890,7 +6890,7 @@ class DuarouterVp(routing.RouterMixin):
                  is_export_trips=True,
                  logger=None,
                  **kwargs):
-        print 'DuarouterVp.__init__ '
+        print('DuarouterVp.__init__ ')
 
         self._init_common(ident, name='Virtual Population DUA router',
                           parent=virtualpop,
@@ -6908,7 +6908,7 @@ class DuarouterVp(routing.RouterMixin):
         if routefilepaths is None:
             routefilepaths = demand.get_routefilepath()
 
-        print '  default routefilepaths', routefilepaths
+        print('  default routefilepaths', routefilepaths)
         self.add_option('routefilepaths', routefilepaths,
                         groupnames=['files'],
                         cml='--route-files',
@@ -6999,9 +6999,9 @@ class DuarouterVp(routing.RouterMixin):
 
         self.run_cml(cml)
         if self.status == 'success':
-            print '  DUA routing done.'
+            print('  DUA routing done.')
             if os.path.isfile(self.outfilepath):
-                print '  outfile exists, start importing routes'
+                print('  outfile exists, start importing routes')
                 virtualpop.import_routes_xml(self.outfilepath, ids_strategy=self.ids_strategy)
 
                 return True
@@ -7014,7 +7014,7 @@ class RouteReaderVp(RouteReader):
     def insert_routes(self, ids_strategy=None):
 
         virtualpop = self._trips  # parent is called trips here need to be changed
-        print 'RouteReaderVp.insert_routes found %d routes.' % (len(self.ids_sumo))
+        print('RouteReaderVp.insert_routes found %d routes.' % (len(self.ids_sumo)))
         plans = virtualpop.get_plans()
         strategies = virtualpop.get_strategies()
         id_strat_auto = strategies.names.get_id_from_index('auto')
@@ -7034,7 +7034,7 @@ class RouteReaderVp(RouteReader):
                     # print '      before:',stages.ids_edges[id_stage]
                     if stages.ids_edges[id_stage] != ids_edge:
                         n_change_route += 1
-                        print '  route change of id_veh', id_veh, 'id_stage', id_stage
+                        print('  route change of id_veh', id_veh, 'id_stage', id_stage)
                     stages.ids_edges[id_stage] = ids_edge
                     # print '      after :',stages.ids_edges[id_stage]
 
@@ -7048,7 +7048,7 @@ class RouteReaderVp(RouteReader):
                     # print '      before:',stages.ids_edges[id_stage]
                     if stages.ids_edges[id_stage] != ids_edge:
                         n_change_route += 1
-                        print '  route change of id_veh', id_veh, 'id_stage', id_stage
+                        print('  route change of id_veh', id_veh, 'id_stage', id_stage)
                     stages.ids_edges[id_stage] = ids_edge
                     # print '      after :',stages.ids_edges[id_stage]
 
@@ -7062,15 +7062,15 @@ class RouteReaderVp(RouteReader):
                     # print '      before:',stages.ids_edges[id_stage]
                     if stages.ids_edges[id_stage] != ids_edge:
                         n_change_route += 1
-                        print '  route change of id_veh', id_veh, 'id_stage', id_stage
+                        print('  route change of id_veh', id_veh, 'id_stage', id_stage)
                     stages.ids_edges[id_stage] = ids_edge
                     # print '      after :',stages.ids_edges[id_stage]
-        print '  RouteReaderVp: Total number of changed routes:', n_change_route
+        print('  RouteReaderVp: Total number of changed routes:', n_change_route)
 
 
 class PopGenerator(Process):
     def __init__(self, ident='virtualpopgenerator', virtualpop=None,  logger=None, **kwargs):
-        print 'PopFromOdfGenerator.__init__ ', ident, virtualpop
+        print('PopFromOdfGenerator.__init__ ', ident, virtualpop)
 
         # TODO: let this be independent, link to it or child??
         #
@@ -7170,7 +7170,7 @@ class PopGenerator(Process):
         #self.modeshares = attrsman.add( cm.ObjConf(ModeShares('modeshares',self,scenario.net.modes),groupnames = ['options']) )
 
     def do(self):
-        print 'PopGenerator.do'
+        print('PopGenerator.do')
         # links
 
         virtualpop = self.parent
@@ -7343,7 +7343,7 @@ class PopGenerator(Process):
 
 class PopFromOdfGenerator(Process):
     def __init__(self, ident, virtualpop,  logger=None, **kwargs):
-        print 'PopFromOdfGenerator.__init__'
+        print('PopFromOdfGenerator.__init__')
 
         # TODO: let this be independent, link to it or child??
 
@@ -7417,7 +7417,7 @@ class PopFromOdfGenerator(Process):
                                                           ))
 
     def do(self):
-        print 'PopFromOdfGenerator.do'
+        print('PopFromOdfGenerator.do')
         # links
 
         virtualpop = self.parent
@@ -7438,7 +7438,7 @@ class PopFromOdfGenerator(Process):
 
 class Planner(Process):
     def __init__(self, ident='planner', virtualpop=None,  ids_strategy=None, logger=None, **kwargs):
-        print 'Planner.__init__'
+        print('Planner.__init__')
         # TODO: let this be independent, link to it or child??
 
         self._init_common(ident,
@@ -7462,7 +7462,7 @@ class Planner(Process):
         elif ids_strategy is not None:
             ids_strategy_default = ids_strategy
 
-        print '  ids_strategy_default', ids_strategy_default
+        print('  ids_strategy_default', ids_strategy_default)
         self.ids_strategy = attrsman.add(cm.ListConf('ids_strategy', ids_strategy_default,
                                                      groupnames=['options'],
                                                      choices=strategychoices,
@@ -7496,7 +7496,7 @@ class Planner(Process):
                                                              ))
 
     def do(self):
-        print 'Planner.do', len(self.ids_strategy)
+        print('Planner.do', len(self.ids_strategy))
         # links
 
         virtualpop = self.parent
@@ -7511,12 +7511,12 @@ class Planner(Process):
 
         i = 1
         strategies = virtualpop.get_strategies()
-        print '  strategies:', self.ids_strategy, strategies.names[self.ids_strategy]
-        print '             instances', strategies.strategies[self.ids_strategy]
+        print('  strategies:', self.ids_strategy, strategies.names[self.ids_strategy])
+        print('             instances', strategies.strategies[self.ids_strategy])
 
         n_strat = len(self.ids_strategy)
         for id_strategy, strategy in zip(self.ids_strategy, strategies.strategies[self.ids_strategy]):
-            print '  current strategy', strategy, id(strategy)
+            print('  current strategy', strategy, id(strategy))
             logger.w('Plan with '+strategy.get_name()+' (%d/%d)' % (i, n_strat))
             virtualpop.plan_with_strategy(id_strategy, evalcrit=self.evalcrit,
                                           is_plan_no_preferred=self.is_plan_no_preferred,  logger=logger)
@@ -7531,7 +7531,7 @@ class PlanSelector(Process):
                  methodname='plan with shortest estim. time',
                  logger=None, **kwargs):
 
-        print 'PlanSelector.__init__'
+        print('PlanSelector.__init__')
 
         # TODO: let this be independent, link to it or child??
 
@@ -7610,7 +7610,7 @@ class PlanSelector(Process):
                                                  ))
 
     def do(self):
-        print 'Planner.do'
+        print('Planner.do')
         # links
 
         #virtualpop = self.parent
@@ -7624,7 +7624,7 @@ class PlanSelector(Process):
 
 class VehicleProvider(Process):
     def __init__(self, ident='vehicleprovider', virtualpop=None,  logger=None, **kwargs):
-        print 'VehicleProvider.__init__'
+        print('VehicleProvider.__init__')
 
         # TODO: let this be independent, link to it or child??
 
@@ -7667,7 +7667,7 @@ class VehicleProvider(Process):
                                                         ))
 
     def do(self):
-        print 'VehicleProvider.do'
+        print('VehicleProvider.do')
         # links
 
         virtualpop = self.parent
@@ -7699,7 +7699,7 @@ class VehicleProvider(Process):
             ids_pers_assign = np.random.choice(ids_pers_miss, n_need, replace=False)
             ids_iauto = iautos.assign_to_persons(ids_pers_assign)
 
-        print '  created %d autos, target share=%.2f, share = %.2f' % (iautos.get_share(is_abs=True), iautos.get_share(), self.share_autoowner)
+        print('  created %d autos, target share=%.2f, share = %.2f' % (iautos.get_share(is_abs=True), iautos.get_share(), self.share_autoowner))
 
         ids_prefer_bike = virtualpop.select_ids(
             (virtualpop.ids_mode_preferred.get_value() == id_mode_bike) & (virtualpop.ids_ibike.get_value() == -1))
@@ -7713,7 +7713,7 @@ class VehicleProvider(Process):
             ids_pers_assign = np.random.choice(ids_pers_miss, n_need, replace=False)
             ids_ibike = ibikes.assign_to_persons(ids_pers_assign)
 
-        print '  created %d bikes, target share=%.2f, share = %.2f' % (ibikes.get_share(is_abs=True), ibikes.get_share(), self.share_bikeowner)
+        print('  created %d bikes, target share=%.2f, share = %.2f' % (ibikes.get_share(is_abs=True), ibikes.get_share(), self.share_bikeowner))
 
         ids_prefer_moto = virtualpop.select_ids(
             (virtualpop.ids_mode_preferred.get_value() == id_mode_moto) & (virtualpop.ids_imoto.get_value() == -1))
@@ -7726,7 +7726,7 @@ class VehicleProvider(Process):
             ids_pers_assign = np.random.choice(ids_pers_miss, n_need, replace=False)
             ids_imoto = imotos.assign_to_persons(ids_pers_assign)
 
-        print '  created %d moto, target share=%.2f, share = %.2f' % (imotos.get_share(is_abs=True), imotos.get_share(), self.share_motorcycleowner)
+        print('  created %d moto, target share=%.2f, share = %.2f' % (imotos.get_share(is_abs=True), imotos.get_share(), self.share_motorcycleowner))
         return True
 
         # TODO: generate and assign  additional vehicles
--- a/tools/contributed/sumopy/coremodules/demand/virtualpop_results.py
+++ b/tools/contributed/sumopy/coremodules/demand/virtualpop_results.py
@@ -129,7 +129,7 @@ class IterateStatistics(am.ArrayObjman):
         return 'estutils_'+strategy.get_ident()
 
     def add_results(self, scenario, ids_plan_before, ids_plan_after):
-        print 'add_results iteration:', len(self)+1
+        print('add_results iteration:', len(self)+1)
         # print '  ids_plan_before',ids_plan_before
         # print '  ids_plan_after',ids_plan_after
         # print '  changes',np.sum(ids_plan_before != ids_plan_after)
@@ -169,7 +169,7 @@ class IterateStatistics(am.ArrayObjman):
         for id_strat, strategy in zip(ids_strat, strategies.strategies[ids_strat]):
             inds_thisstrat_before = ids_strat_before == id_strat
             inds_thisstrat_after = ids_strat_after == id_strat
-            print '  check', id_strat, strategy, np.sum(inds_thisstrat_before), np.sum(inds_thisstrat_after)
+            print('  check', id_strat, strategy, np.sum(inds_thisstrat_before), np.sum(inds_thisstrat_after))
             stratcountattr = self.get_stratcountattr(strategy)
             getattr(self, stratcountattr)[id_run] = np.sum(inds_thisstrat_after)
 
@@ -266,7 +266,7 @@ class Personresults(am.ArrayObjman):
             self.get_persons().update_results(self)
 
     def import_sumoxml(self, filepath, sumo):
-        print 'Personresults.import_sumoxml', self.get_persons().ident, filepath
+        print('Personresults.import_sumoxml', self.get_persons().ident, filepath)
 
         reader = PersonReader(self.get_persons(), sumo)
         parse(filepath, reader)
--- a/tools/contributed/sumopy/coremodules/demand/virtualpop_results_mpl.py
+++ b/tools/contributed/sumopy/coremodules/demand/virtualpop_results_mpl.py
@@ -40,7 +40,7 @@ class IteratePlotter(PlotoptionsMixin, P
                           name=name,
                           info=info, logger=logger)
 
-        print 'VirtualpopIteratePlotter.__init__', self.parent
+        print('VirtualpopIteratePlotter.__init__', self.parent)
         attrsman = self.get_attrsman()
 
         self.is_strategy_share = attrsman.add(cm.AttrConf('is_strategy_share', kwargs.get('is_strategy_share', True),
@@ -75,7 +75,7 @@ class IteratePlotter(PlotoptionsMixin, P
         self.add_save_options(**kwargs)
 
     def show(self):
-        print 'show'
+        print('show')
         # if self.axis  is None:
         self.init_figures()
         plt.rc('lines', linewidth=self.width_line)
@@ -83,7 +83,7 @@ class IteratePlotter(PlotoptionsMixin, P
         #                    cycler('linestyle', ['-', '--', ':', '-.'])))
 
         for plotattr in self.get_attrsman().get_group('plots'):
-            print '  ', plotattr.attrname, plotattr.get_value()
+            print('  ', plotattr.attrname, plotattr.get_value())
             if plotattr.get_value():
                 plotattr.plotfunction()
 
@@ -103,7 +103,7 @@ class IteratePlotter(PlotoptionsMixin, P
         """
         Plot total est times for each stategy over iterations.
         """
-        print 'plot_strategy_share'
+        print('plot_strategy_share')
         scenario = self.get_scenario()
         simresults = scenario.simulation.results
         vpiterstats = simresults.get_resultobj('vpiterstats')
@@ -126,7 +126,7 @@ class IteratePlotter(PlotoptionsMixin, P
             ident_strat = strategy.get_ident()
             name_strat = strategy.get_name()
             counts = self.get_resultattrconf(vpiterstats.get_stratcountattr(strategy))
-            print '  name_strat', name_strat, 'counts', counts
+            print('  name_strat', name_strat, 'counts', counts)
             if np.any(counts[iters] > 0):
                 ax.plot(iters, 1.0*counts[iters]/trips_tot*100,
                         label=name_strat,
@@ -157,7 +157,7 @@ class IteratePlotter(PlotoptionsMixin, P
 
     def plot_strategy_changes(self):
         """'Plot strategy changes over iterations."""
-        print 'plot_strategy_changes'
+        print('plot_strategy_changes')
         scenario = self.get_scenario()
         simresults = scenario.simulation.results
         vpiterstats = simresults.get_resultobj('vpiterstats')
@@ -188,7 +188,7 @@ class IteratePlotter(PlotoptionsMixin, P
             self.save_fig('fig_changes')
 
     def plot_strategy_time_tot_est(self):
-        print 'plot_strategy_time_tot_est'
+        print('plot_strategy_time_tot_est')
         scenario = self.get_scenario()
         simresults = scenario.simulation.results
         vpiterstats = simresults.get_resultobj('vpiterstats')
@@ -244,7 +244,7 @@ class IteratePlotter(PlotoptionsMixin, P
             self.save_fig('fig_time_tot_est')
 
     def plot_strategy_time_tot(self):
-        print 'plot_strategy_time_tot'
+        print('plot_strategy_time_tot')
         scenario = self.get_scenario()
         simresults = scenario.simulation.results
         vpiterstats = simresults.get_resultobj('vpiterstats')
@@ -307,7 +307,7 @@ class StrategyPlotter(PlotoptionsMixin,
         self._init_common('strategyresultplotter', parent=virtualpop, name=name,
                           info=info, logger=logger)
 
-        print 'StrategyPlotter.__init__', self.parent
+        print('StrategyPlotter.__init__', self.parent)
         attrsman = self.get_attrsman()
 
         self.is_strategy_share = attrsman.add(cm.AttrConf('is_strategy_share', kwargs.get('is_strategy_share', True),
@@ -364,7 +364,7 @@ class StrategyPlotter(PlotoptionsMixin,
         self.add_save_options(**kwargs)
 
     def show(self):
-        print 'show'
+        print('show')
         # if self.axis  is None:
         self.init_figures()
         plt.rc('lines', linewidth=self.width_line)
@@ -372,7 +372,7 @@ class StrategyPlotter(PlotoptionsMixin,
         #                    cycler('linestyle', ['-', '--', ':', '-.'])))
 
         for plotattr in self.get_attrsman().get_group('plots'):
-            print '  ', plotattr.attrname, plotattr.get_value()
+            print('  ', plotattr.attrname, plotattr.get_value())
             if plotattr.get_value():
                 plotattr.plotfunction()
 
@@ -380,7 +380,7 @@ class StrategyPlotter(PlotoptionsMixin,
             show_plot()
 
     def plot_strategy_share(self):
-        print 'plot_strategy_share'
+        print('plot_strategy_share')
         fig = self.create_figure()
         ax = fig.add_subplot(111)
 
@@ -437,7 +437,7 @@ class StrategyPlotter(PlotoptionsMixin,
             self.save_fig('virtualpop_strategy_share_current')
 
     def plot_strategy_times_est(self):
-        print 'plot_strategy_times_est'
+        print('plot_strategy_times_est')
         fig = self.create_figure()
         ax = fig.add_subplot(111)
 
@@ -503,7 +503,7 @@ class StrategyPlotter(PlotoptionsMixin,
         """
         For each strategy plot its estimated travel time factor with respect to the fastest strategy of the same person
         """
-        print 'plot_strategy_timefactors_est'
+        print('plot_strategy_timefactors_est')
         fig = self.create_figure()
         ax = fig.add_subplot(111)
 
@@ -583,7 +583,7 @@ class StrategyPlotter(PlotoptionsMixin,
         """
         For each strategy plot its travel executive time factor with respect to the fastest strategy of the same person
         """
-        print 'plot_strategy_timefactors_est'
+        print('plot_strategy_timefactors_est')
         fig = self.create_figure()
         ax = fig.add_subplot(111)
 
@@ -627,7 +627,7 @@ class StrategyPlotter(PlotoptionsMixin,
                     n_nonexistant += 1
 
         if n_nonexistant > 0:
-            print '  WARNING: only %d of %d  persons have not completed all strategies' % (n_nonexistant, n_pers)
+            print('  WARNING: only %d of %d  persons have not completed all strategies' % (n_nonexistant, n_pers))
         x_min = 0.0
         x_max = 0.0
         for id_strat, timefactors in strategytimefactors.iteritems():
--- a/tools/contributed/sumopy/coremodules/demand/virtualpop_wxgui.py
+++ b/tools/contributed/sumopy/coremodules/demand/virtualpop_wxgui.py
@@ -27,7 +27,7 @@ try:
     import virtualpop_results_mpl as results_mpl
     is_mpl = True  # we have matplotlib support
 except:
-    print "WARNING: python matplotlib package not installed, no matplotlib plots."
+    print("WARNING: python matplotlib package not installed, no matplotlib plots.")
     is_mpl = False
 
 import virtualpop
@@ -199,7 +199,7 @@ class VirtualpopWxGuiMixin:
 
         # this does not return until the dialog is closed.
         #val = dlg.ShowModal()
-        print 'on_create_pop_from_odflows'
+        print('on_create_pop_from_odflows')
         dlg.Show()
         dlg.MakeModal(True)
 
@@ -221,7 +221,7 @@ class VirtualpopWxGuiMixin:
             # print 'You selected %d files:' % len(paths)
             if len(paths) > 0:
                 filepath = paths[0]
-                print 'call import_routes_xml', filepath
+                print('call import_routes_xml', filepath)
                 self._demand.virtualpop.import_routes_xml(filepath)
                 self._mainframe.browse_obj(self._demand.virtualpop.get_plans())
 
@@ -274,7 +274,7 @@ class VirtualpopWxGuiMixin:
 
         # this does not return until the dialog is closed.
         #val = dlg.ShowModal()
-        print 'on_create_pop_from_odflows'
+        print('on_create_pop_from_odflows')
         dlg.Show()
         dlg.MakeModal(True)
 
@@ -300,7 +300,7 @@ class VirtualpopWxGuiMixin:
 
         # this does not return until the dialog is closed.
         #val = dlg.ShowModal()
-        print 'on_provide_vehicles'
+        print('on_provide_vehicles')
         dlg.Show()
         dlg.MakeModal(True)
 
@@ -327,7 +327,7 @@ class VirtualpopWxGuiMixin:
 
         # this does not return until the dialog is closed.
         #val = dlg.ShowModal()
-        print 'on_generate_plan'
+        print('on_generate_plan')
         dlg.Show()
         dlg.MakeModal(True)
         if self.proc.status == 'success':
@@ -444,8 +444,8 @@ class VirtualpopWxGuiMixin:
         scenario = self._demand.parent
 
         vpiterstats = scenario.simulation.results.get_resultobj('vpiterstats')
-        print 'on_plot_iterations  '
-        print ' vpiterstats ', vpiterstats
+        print('on_plot_iterations  ')
+        print(' vpiterstats ', vpiterstats)
         if is_mpl & (vpiterstats is not None):
             resultplotter = results_mpl.IteratePlotter(scenario,
                                                        logger=self._mainframe.get_logger()
--- a/tools/contributed/sumopy/coremodules/landuse/CREATE_ZONES.py
+++ b/tools/contributed/sumopy/coremodules/landuse/CREATE_ZONES.py
@@ -45,22 +45,22 @@ def create_zones(n_zones, x_min, x_max,
 
 # CREATE ZONES by CLUSTER OF POINTS
 
-    print 'k-value cluster'
+    print('k-value cluster')
     # k-value cluster
     # https://docs.scipy.org/doc/scipy/reference/generated/scipy.cluster.vq.kmeans.html
 
     features = np.array(origin_dest_points)
-    print 'features', features
+    print('features', features)
     # Whiten data
     st_dev_x = np.std(features[:][0])
     st_dev_y = np.std(features[:][1])
-    print 'st_dev_x', st_dev_x
-    print 'st_dev_y', st_dev_y
+    print('st_dev_x', st_dev_x)
+    print('st_dev_y', st_dev_y)
 
     whitened = whiten(features)
     # Find 2 clusters in the data
     codebook, distortion = kmeans(features, n_zones)
-    print 'codebook', codebook
+    print('codebook', codebook)
 
     features[:, 0] = features[:, 0]*st_dev_x
     features[:, 1] = features[:, 1]*st_dev_y
@@ -79,8 +79,8 @@ def create_zones(n_zones, x_min, x_max,
     # myscenario.landuse.zones.clear()
     vertices = vor.vertices
     regions = vor.regions
-    print vertices
-    print regions
+    print(vertices)
+    print(regions)
     zone_name = 1
     for region in regions:
         if region != []:
@@ -88,11 +88,11 @@ def create_zones(n_zones, x_min, x_max,
             for vertice in region:
                 shape.append([vertices[vertice][0], vertices[vertice][1], 0.])
                 ids_zone = myscenario.landuse.zones.get_ids()
-                print 'n_zones =', len(ids_zone)
-                print shape
+                print('n_zones =', len(ids_zone))
+                print(shape)
             zone_name += 1
             # np.concatenate(shape).astype(None)
-            print shape
+            print(shape)
             myscenario.landuse.zones.make(zonename='zone_name', coord=np.zeros(
                 3, dtype=np.float32), shape=shape, id_landusetype=6)
     ids_zone = myscenario.landuse.zones.get_ids()
--- a/tools/contributed/sumopy/coremodules/landuse/__init__.py
+++ b/tools/contributed/sumopy/coremodules/landuse/__init__.py
@@ -18,7 +18,7 @@
 
 __version__ = "0.0"
 
-print 'init', __name__
+print('init', __name__)
 
 
 def get_wxgui():
--- a/tools/contributed/sumopy/coremodules/landuse/landuse.py
+++ b/tools/contributed/sumopy/coremodules/landuse/landuse.py
@@ -464,7 +464,7 @@ class Zones(am.ArrayObjman):
         self.areas[id_zone] = find_area(shape)/1000000.0
 
     def identify_zoneedges(self, id_zone):
-        print 'identify_zoneedges of id_zone', id_zone
+        print('identify_zoneedges of id_zone', id_zone)
 
         if len(self.shapes[id_zone]) >= 3:
             # must have at least 3 vertices to be an area
@@ -492,9 +492,9 @@ class Zones(am.ArrayObjman):
 
             # select and determine weights
             self.ids_edges_inside[id_zone] = self.get_edges().get_ids(inds_within)
-            print '  found', len(self.ids_edges_inside[id_zone]), 'edges'
+            print('  found', len(self.ids_edges_inside[id_zone]), 'edges')
             if len(self.ids_edges_inside[id_zone]) == 0:
-                print 'WARNING in identify_zoneedges: no edges found in zone', id_zone
+                print('WARNING in identify_zoneedges: no edges found in zone', id_zone)
 
     def get_zoneedges_by_mode_fast(self, id_zone, id_mode, speed_max=None,
                                    modeconst_excl=0.0, modeconst_mix=0.0,
@@ -552,7 +552,7 @@ class Zones(am.ArrayObjman):
         # todo: rename ids_edges_orig to simply ids_edges
         ids_edge_orig = self.ids_edges_orig[id_zone]
         if ids_edge_orig is None:
-            print 'WARNING: no edges in zone', id_zone, '. Run edge detection first.'
+            print('WARNING: no edges in zone', id_zone, '. Run edge detection first.')
             if is_dict:
                 return {}
             else:
@@ -647,7 +647,7 @@ class Zones(am.ArrayObjman):
             fd.write(xm.end('Placemark', indent + 2))
 
     def write_xml(self, fd=None, indent=0):
-        print 'Zones.write_xml'
+        print('Zones.write_xml')
         net = self.parent.parent.net
         ids_edge_sumo = net.edges.ids_sumo
         ids_zone = self.get_ids()
@@ -715,7 +715,7 @@ class Zones(am.ArrayObjman):
         """
         Export zones to Google kml file formate.
         """
-        print 'export_sumoxml', filepath, len(self)
+        print('export_sumoxml', filepath, len(self))
         if len(self) == 0:
             return None
 
@@ -725,7 +725,7 @@ class Zones(am.ArrayObjman):
         try:
             fd = open(filepath, 'w')
         except:
-            print 'WARNING in write_obj_to_xml: could not open', filepath
+            print('WARNING in write_obj_to_xml: could not open', filepath)
             return False
         #xmltag, xmltag_item, attrname_id = self.xmltag
         fd.write('<?xml version="1.0" encoding="%s"?>\n' % encoding)
@@ -746,7 +746,7 @@ class Zones(am.ArrayObjman):
         """
         Export zones to SUMO xml file formate.
         """
-        print 'export_sumoxml', filepath, len(self)
+        print('export_sumoxml', filepath, len(self))
         if len(self) == 0:
             return None
 
@@ -756,7 +756,7 @@ class Zones(am.ArrayObjman):
         try:
             fd = open(filepath, 'w')
         except:
-            print 'WARNING in export_sumoxml: could not open', filepath
+            print('WARNING in export_sumoxml: could not open', filepath)
             return False
         #xmltag, xmltag_item, attrname_id = self.xmltag
         #fd.write('<?xml version="1.0" encoding="%s"?>\n'%encoding)
@@ -1437,7 +1437,7 @@ class Facilities(am.ArrayObjman):
         The ids_fac is an array that contains the facility ids in correspondence
         to the probability vector.
         """
-        print 'get_departure_probabilities_landuse2 ids_landusetype', ids_landusetype
+        print('get_departure_probabilities_landuse2 ids_landusetype', ids_landusetype)
         probabilities = {}
         zones = self.ids_zone.get_linktab()
         inds_fac = self.get_inds()
@@ -1466,13 +1466,13 @@ class Facilities(am.ArrayObjman):
                 probabilities[id_zone] = utils  # all zero prob
 
             if 0:  # debug
-                print '    sum(probs)', np.sum(probabilities[id_zone])
+                print('    sum(probs)', np.sum(probabilities[id_zone]))
                 if np.sum(probabilities[id_zone]) > 0:
                     ids_fac = self.get_ids(inds_fac)
                     for id_fac, id_landusetype, id_thiszone, prob in zip(ids_fac, self.ids_landusetype[ids_fac], self.ids_zone[ids_fac], probabilities[id_zone]):
                         if (id_thiszone == id_zone):  # & (id_landusetype in ids_landusetype):
                             if prob > 0:
-                                print '        id_fac', id_fac, 'id_landusetype', id_landusetype, 'prob', prob
+                                print('        id_fac', id_fac, 'id_landusetype', id_landusetype, 'prob', prob)
 
         return probabilities, self.get_ids(inds_fac)
 
@@ -1486,14 +1486,14 @@ class Facilities(am.ArrayObjman):
         The ids_fac is an array that contains the facility ids in correspondence
         to the probability vector.
         """
-        print 'get_departure_probabilities_landuse'
+        print('get_departure_probabilities_landuse')
         probabilities = {}
         zones = self.ids_zone.get_linktab()
         inds_fac = self.get_inds()
         for id_zone in zones.get_ids():
             probabilities[id_zone] = {}
             for id_landusetype in set(self.ids_landusetype.value):
-                print '  id_zone,id_landusetype', id_zone, id_landusetype
+                print('  id_zone,id_landusetype', id_zone, id_landusetype)
                 # print '  ids_landusetype',self.ids_landusetype.value[inds_fac]
                 # print '  ids_zone',self.ids_zone.value[inds_fac]
                 # print ''
@@ -1548,7 +1548,7 @@ class Facilities(am.ArrayObjman):
 
     def identify_landuse_from_area(self, ids_fac=None):
         """Determines the landuse of facilities from the landuse of areas in which their are located"""
-        print 'identify_landuse_from_area', ids_fac
+        print('identify_landuse_from_area', ids_fac)
         # TODO:
         landusetypes = self.get_landusetypes()
         ids_area = self.get_ids_area(ids_fac)
@@ -1560,8 +1560,8 @@ class Facilities(am.ArrayObjman):
 
                 if osmkey == 'building.yes':
                     if is_point_in_polygon(coord[:2], np.array(shape, dtype=np.float32)[:, :2], is_use_shapely=IS_SHAPELY):
-                        print '  found id_fac', id_fac, osmkey, 'in id_area', id_area
-                        print '    id_landusetype', self.ids_landusetype[id_fac], 'is_area', landusetypes.are_area[self.ids_landusetype[id_fac]], '->', id_landusetype_fac
+                        print('  found id_fac', id_fac, osmkey, 'in id_area', id_area)
+                        print('    id_landusetype', self.ids_landusetype[id_fac], 'is_area', landusetypes.are_area[self.ids_landusetype[id_fac]], '->', id_landusetype_fac)
                         self.ids_landusetype[id_fac] = id_landusetype_fac
 
     def update_centroid(self, _id):
@@ -1605,7 +1605,7 @@ class Facilities(am.ArrayObjman):
         is closest to the centoid of each facility and the satisfies certain
         conditions.
         """
-        print 'identify_closest_edge'
+        print('identify_closest_edge')
         edges = self.get_edges()
         id_ped = self.get_net().modes.get_id_mode('pedestrian')
         # select edges...if (edges.priorities[id_edge]<=priority_max) & edges.has_sidewalk(id_edge):
@@ -1713,7 +1713,7 @@ class Facilities(am.ArrayObjman):
         self.update(ids)
 
     def import_poly(self, polyfilepath, is_remove_xmlfiles=False, is_clear=True, **kwargs):
-        print 'import_poly from %s ' % (polyfilepath,)
+        print('import_poly from %s ' % (polyfilepath,))
         if is_clear:
             self.clear()
         # let's read first the offset information, which are in the
@@ -1749,7 +1749,7 @@ class Facilities(am.ArrayObjman):
         # self.update()
 
         # timeit
-        print '  exec time=', time.clock() - exectime_start
+        print('  exec time=', time.clock() - exectime_start)
 
         # print '  self.shapes',self.shapes.value
 
@@ -1806,7 +1806,7 @@ class Facilities(am.ArrayObjman):
         """
         Export stops to SUMO stop xml file.
         """
-        print 'export_sumoxml', filepath, len(self)
+        print('export_sumoxml', filepath, len(self))
         if len(self) == 0:
             return None
 
@@ -1816,7 +1816,7 @@ class Facilities(am.ArrayObjman):
         try:
             fd = open(filepath, 'w')
         except:
-            print 'WARNING in write_obj_to_xml: could not open', filepath
+            print('WARNING in write_obj_to_xml: could not open', filepath)
             return False
         #xmltag, xmltag_item, attrname_id = self.xmltag
         fd.write('<?xml version="1.0" encoding="%s"?>\n' % encoding)
@@ -1908,7 +1908,7 @@ class SumoPolyReader(handler.ContentHand
     def get_landuse(self, osmkey):
         keyvec = osmkey.split('.')
         len_keyvec = len(keyvec)
-        print 'get_landuse', len_keyvec, keyvec
+        print('get_landuse', len_keyvec, keyvec)
         #is_match = False
         for id_landusetype in self._ids_landusetype_all:
             # print '    id_landusetype',id_landusetype
@@ -1918,7 +1918,7 @@ class SumoPolyReader(handler.ContentHand
             for osmfilter in self._osmfilters[id_landusetype]:
                 # print '       ?osmfiltervec',osmfilter,osmkey==osmfilter
                 if osmkey == osmfilter:  # exact match of filter
-                    print '      exact', osmkey
+                    print('      exact', osmkey)
                     return id_landusetype
 
         # now check for wildcards
@@ -1931,7 +1931,7 @@ class SumoPolyReader(handler.ContentHand
                 if (len(osmfiltervec) == 2) & (len_keyvec == 2):
                     if osmfiltervec[0] == keyvec[0]:
                         if osmfiltervec[1] == '*':
-                            print '      *', keyvec[0]
+                            print('      *', keyvec[0])
                             return id_landusetype
         return -1
 
@@ -2132,7 +2132,7 @@ class Parking(am.ArrayObjman):
                      is_clear=True,
                      logger=None,
                      **kwargs):
-        print 'make_parking'
+        print('make_parking')
         if is_clear:
             self.clear()
         edges = self.edges.get_value()
@@ -2180,7 +2180,7 @@ class Parking(am.ArrayObjman):
                         ids_parking.append(id_park)
                         pos = pos_offset+(i+1)*length_lot
 
-        print '  created %d parking spaces' % n_parking
+        print('  created %d parking spaces' % n_parking)
         return ids_parking
 
     def clear_booking(self):
@@ -2194,7 +2194,7 @@ class Parking(am.ArrayObjman):
         """
 
         #inds_person = self.persons.get_inds(ids_person)
-        print 'get_closest_parking'
+        print('get_closest_parking')
         ind_parking_closest = self.get_inds()[np.argmin(
             np.sum((coord-self.vertices.value[:, 1, :])**2, 1) + c_spread*lengths*self.lengths.get_value())]
         self.numbers_booking.get_value()[ind_parking_closest] += 1
@@ -2215,7 +2215,7 @@ class Parking(am.ArrayObjman):
 
         # print 'get_closest_parking',n,len(self),'n_retrials',n_retrials
         if len(self) == 0:
-            print 'WARNING in get_closest_parkings: there is no parking.'
+            print('WARNING in get_closest_parkings: there is no parking.')
             return [], []
 
         #parking = self.get_landuse().parking
@@ -2274,8 +2274,8 @@ class Parking(am.ArrayObjman):
                     # print '    fallback n_search',n_search,'is_search',is_search
 
             if is_search:
-                print 'WARNING: inaccessible parking for id_veh', id_veh, 'is_fallback', is_fallback
-                print '  dist=%.1f' % (np.sqrt(dists[ind_parking_closest])), 'id_lane', ids_lane[ind_parking_closest], 'al', lanes.get_accesslevel([ids_lane[ind_parking_closest]], id_mode_fallback)
+                print('WARNING: inaccessible parking for id_veh', id_veh, 'is_fallback', is_fallback)
+                print('  dist=%.1f' % (np.sqrt(dists[ind_parking_closest])), 'id_lane', ids_lane[ind_parking_closest], 'al', lanes.get_accesslevel([ids_lane[ind_parking_closest]], id_mode_fallback))
 
             inds_vehparking[i] = ind_parking_closest
             are_fallback[i] = is_fallback
@@ -2387,11 +2387,11 @@ class Landuse(cm.BaseObjman):
             else:
                 filepath = os.path.join(os.getcwd(), 'landuse.poly.xml')
 
-        print 'export_polyxml', filepath
+        print('export_polyxml', filepath)
         try:
             fd = open(filepath, 'w')
         except:
-            print 'WARNING in export_poly_xml: could not open', filepath
+            print('WARNING in export_poly_xml: could not open', filepath)
             return None
 
         #xmltag, xmltag_item, attrname_id = self.xmltag
@@ -2442,7 +2442,7 @@ class Landuse(cm.BaseObjman):
 
 class FacilityGenerator(Process):
     def __init__(self, ident='facilitygenerator', facilities=None,  logger=None, **kwargs):
-        print 'FacilityGenerator.__init__'
+        print('FacilityGenerator.__init__')
 
         # TODO: let this be independent, link to it or child??
 
@@ -2503,7 +2503,7 @@ class FacilityGenerator(Process):
         #                    ))
 
     def do(self):
-        print self.get_name()+'.do'
+        print(self.get_name()+'.do')
         # links
         facilities = self.parent
         net = facilities.parent.get_net()
@@ -2637,7 +2637,7 @@ class FacilityGenerator(Process):
 
                 # check if positions on parallel shape are closest to
                 # this edge or closer to another edge
-        print '  Done, generated %d facilities' % n_fac
+        print('  Done, generated %d facilities' % n_fac)
         return True
 
     def get_segind_closest_edge(self, p, x1, y1, x2, y2, inds_seg_exclude=None):
@@ -2650,7 +2650,7 @@ class FacilityGenerator(Process):
 
 class ParkingGenerator(Process):
     def __init__(self, ident='parkinggenerator', parking=None,  logger=None, **kwargs):
-        print 'ParkingGenerator.__init__'
+        print('ParkingGenerator.__init__')
 
         # TODO: let this be independent, link to it or child??
 
@@ -2724,7 +2724,7 @@ class ParkingGenerator(Process):
                                                  ))
 
     def do(self):
-        print self.get_name()+'.do'
+        print(self.get_name()+'.do')
         # links
         # print '  self.id_mode',self.id_mode
         # print '  self.get_kwoptions()',self.get_kwoptions()
@@ -2749,7 +2749,7 @@ class OsmPolyImporter(CmlMixin, Process)
                  is_clean_osmfile=True,
                  is_merge=False,
                  logger=None, **kwargs):
-        print 'OsmPolyImporter.__init__', landuse, landuse.parent.get_rootfilename()
+        print('OsmPolyImporter.__init__', landuse, landuse.parent.get_rootfilename())
         self._init_common('osmpolyimporter', name='OSM Poly import',
                           logger=logger,
                           info='Converts a OSM  file to a SUMO Poly file and read facilities into scenario.',
@@ -2945,12 +2945,12 @@ OSM building types are mapped to specifi
         self.run_cml(cml)
         if self.status == 'success':
             if os.path.isfile(self.polyfilepath):
-                print '  OSM->poly.xml successful, start importing xml files'
+                print('  OSM->poly.xml successful, start importing xml files')
                 self._landuse.import_polyxml(self.rootname, self.rootdirpath,
                                              is_clear=not self.is_merge,
                                              type_default=self.type_default,
                                              height_default=self.height_default)
-                print '  import poly in sumopy done.'
+                print('  import poly in sumopy done.')
                 return True
             return False
         else:
--- a/tools/contributed/sumopy/coremodules/landuse/maps.py
+++ b/tools/contributed/sumopy/coremodules/landuse/maps.py
@@ -50,7 +50,7 @@ IS_MAPSUPPORT = True
 try:
     from PIL import ImageFilter, Image, ImageChops, ImagePath, ImageDraw
 except:
-    print "WARNING: Maps requires PIL module."
+    print("WARNING: Maps requires PIL module.")
     IS_MAPSUPPORT = False
 
 try:
@@ -61,7 +61,7 @@ except:
         from mpl_toolkits.basemap import pyproj
 
     except:
-        print "WARNING: Maps requires pyproj module."
+        print("WARNING: Maps requires pyproj module.")
         IS_MAPSUPPORT = False
         # print __doc__
         # raise
@@ -71,7 +71,7 @@ URL_GOOGLEMAP = "https://maps.googleapis
 
 
 def download_googlemap(filepath, bbox, proj, size=640, filetype='gif', maptype='satellite'):
-    print 'download_googlemap', bbox
+    print('download_googlemap', bbox)
     # https://developers.google.com/maps/documentation/static-maps/intro#Paths
     x_sw, y_sw = bbox[0]
     x_ne, y_ne = bbox[1]
@@ -88,7 +88,7 @@ def download_googlemap(filepath, bbox, p
     size_x = size_y = size/2
     url = URL_GOOGLEMAP+"size=%dx%d&visible=%.6f,%.6f|%.6f,%.6f&format=%s&maptype=%s&scale=2"\
         % (size_x, size_y, lat00, lon00, lat11, lon11, filetype.upper(), maptype)
-    print '  url=', url
+    print('  url=', url)
     urllib.urlretrieve(url, filepath)
 
     bbox_lonlat = np.array([[lon00, lat00], [lon11, lat11]])
@@ -96,7 +96,7 @@ def download_googlemap(filepath, bbox, p
 
 
 def download_googlemap_bb(filepath, bbox, proj, apikey, size=640, filetype='gif', maptype='satellite', color="0xff0000ff"):
-    print 'download_googlemap_bb', bbox
+    print('download_googlemap_bb', bbox)
     # https://developers.google.com/maps/documentation/static-maps/intro#Paths
     x_sw, y_sw = bbox[0]
     x_ne, y_ne = bbox[1]
@@ -146,7 +146,7 @@ def download_googlemap_bb(filepath, bbox
 
     # urllib.urlretrieve (URL_GOOGLEMAP+"size=%dx%d&format=%s&maptype=%s&scale=2&path=color:0xff0000ff|weight:1|%.5f,%.5f|%.5f,%.5f|%.5f,%.5f|%.5f,%.5f"\
     #    %(size_x,size_y,filetype,maptype,lat00,lon00, lat11,lon11, lat01,lon01, lat10,lon10), filepath)
-    print '  url=', url
+    print('  url=', url)
     urllib.urlretrieve(url, filepath)
     bbox_lonlat = np.array([[lon00, lat00], [lon11, lat11]])
     return bbox_lonlat
@@ -155,7 +155,7 @@ def download_googlemap_bb(filepath, bbox
 def estimate_angle(filepath):
 
     im = Image.open(filepath).convert("RGB")
-    print 'estimate_angle image', filepath,  "%dx%d" % im.size, im.mode, im.getbands()
+    print('estimate_angle image', filepath,  "%dx%d" % im.size, im.mode, im.getbands())
     imr, img, imb = im.split()
 
     # calculate width and height of bbox in pixel from measured rectangle
@@ -193,7 +193,7 @@ def estimate_angle(filepath):
         # print ' angles[i],matches[i]',angles[i],matches[i]
 
     angle_opt = angles[np.argmax(matches)]
-    print '  angle_opt', angle_opt
+    print('  angle_opt', angle_opt)
 
     ys = np.arange(0, int(0.2*wy), 1)
     matches = np.zeros(len(ys))
@@ -211,7 +211,7 @@ def estimate_angle(filepath):
         # print ' y,matches[y]',y,matches[y]
 
     y_opt = ys[np.argmax(matches)]
-    print '  y_opt', y_opt
+    print('  y_opt', y_opt)
 
     if 0:
         im_bbox = ImageChops.constant(im, 0)
@@ -224,13 +224,13 @@ def estimate_angle(filepath):
 
     # assuming rectangle:
     bbox = [(y_opt, y_opt), (wx-y_opt, y_opt), (wx-y_opt, wy-y_opt), (y_opt, wy-y_opt), (y_opt, y_opt)]
-    print '  bbox', bbox
+    print('  bbox', bbox)
     return -angle_opt, bbox
 
 
 class MapsImporter(Process):
     def __init__(self,  maps, logger=None, **kwargs):
-        print 'MapsImporter.__init__', maps, maps.parent.get_ident()
+        print('MapsImporter.__init__', maps, maps.parent.get_ident())
         self._init_common('mapsimporter', name='Background maps importer',
                           logger=logger,
                           info='Downloads and converts background maps.',
@@ -329,7 +329,7 @@ class MapsImporter(Process):
     def do(self):
         self.update_params()
 
-        print 'MapsImporter.do'
+        print('MapsImporter.do')
         # self._maps.download(maptype = self.maptype, mapserver = self.mapserver,
         #            filetype = 'png', rootfilepath = None,
         #            width_tile = self.width_tile,  size_tile = self.size_tile,
@@ -407,7 +407,7 @@ class Maps(am.ArrayObjman):
                                   ))
 
     def write_decals(self, fd, indent=4,  rootdir=None, delta=np.zeros(3, dtype=np.float32)):
-        print 'write_decals', len(self)
+        print('write_decals', len(self))
         net = self.parent.get_net()
         if rootdir is None:
             rootdir = os.path.dirname(net.parent.get_rootfilepath())
@@ -494,7 +494,7 @@ class Maps(am.ArrayObjman):
         width = bbox_sumo[2]-x0
         height = bbox_sumo[3]-y0
 
-        print 'download to', rootfilepath
+        print('download to', rootfilepath)
 
         #            '+proj=utm +zone=32 +ellps=WGS84 +datum=WGS84 +units=m +no_defs'
         #params_proj="+proj=utm +zone=32 +ellps=WGS84 +datum=WGS84 +units=m +no_defs"
@@ -507,10 +507,10 @@ class Maps(am.ArrayObjman):
 
         nx = int(width/width_tile+0.5)
         ny = int(height/width_tile+0.5)
-        print '  offset', offset
-        print '  bbox_sumo', bbox_sumo
-        print '  width_tile', width_tile, 'm'
-        print '  Will download %dx%d= %d maps' % (nx, ny, nx*ny)
+        print('  offset', offset)
+        print('  bbox_sumo', bbox_sumo)
+        print('  width_tile', width_tile, 'm')
+        print('  Will download %dx%d= %d maps' % (nx, ny, nx*ny))
         #latlon_tile = np.array([(latlon_ne[0]-latlon_sw[0])/ny, (latlon_ne[1]-latlon_sw[1])/nx])
         #filepaths = []
         #centers = []
@@ -530,7 +530,7 @@ class Maps(am.ArrayObjman):
                 # tile in SUMO network coords. These are the saved coords
                 x_tile = x0+ix*width_tile
                 y_tile = y0+iy*width_tile
-                print '  x_tile,y_tile', x_tile, y_tile
+                print('  x_tile,y_tile', x_tile, y_tile)
                 bb = np.array([[x_tile, y_tile], [x_tile+width_tile, y_tile+width_tile]], np.float32)
 
                 # tile in absolute coordinates. Coords used for download
@@ -552,7 +552,7 @@ class Maps(am.ArrayObjman):
                         angle, bbox = estimate_angle(filepath)
                         # sys.exit(0)
                     else:
-                        print 'WARNING in download: no file downloaded from mapserver'
+                        print('WARNING in download: no file downloaded from mapserver')
                         return ids_map
 
                 bbox_tile_lonlat = download_googlemap_bb(filepath, bbox_tile, proj, apikey,
@@ -560,24 +560,24 @@ class Maps(am.ArrayObjman):
                                                          maptype=maptype, color="0x0000000f")
 
                 if os.path.getsize(filepath) < 2000:  # download failed
-                    print 'WARNING in download: no file downloaded from mapserver'
+                    print('WARNING in download: no file downloaded from mapserver')
                     return ids_map
 
-                print '  bbox_tile', bbox_tile
-                print '  bbox_tile_lonlat', bbox_tile_lonlat
+                print('  bbox_tile', bbox_tile)
+                print('  bbox_tile_lonlat', bbox_tile_lonlat)
 
                 im = Image.open(filepath).convert("RGB")
                 if 1:
-                    print '    downloaded image', filepath,  "%dx%d" % im.size, im.mode, im.getbands()
-                    print '      x_sw,y_sw', x_sw, y_sw
-                    print '      x_ne,y_ne', x_ne, y_ne
+                    print('    downloaded image', filepath,  "%dx%d" % im.size, im.mode, im.getbands())
+                    print('      x_sw,y_sw', x_sw, y_sw)
+                    print('      x_ne,y_ne', x_ne, y_ne)
 
                 # print '  start rotation'
                 im_rot = im.rotate(angle)  # gimp 1.62
                 # im_rot.show()
                 region = im_rot.crop([bbox[0][0], bbox[0][1], bbox[2][0], bbox[2][1]])
                 regsize = region.size
-                print '      regsize', regsize
+                print('      regsize', regsize)
                 im_crop = Image.new('RGB', (regsize[0], regsize[1]), (0, 0, 0))
                 im_crop.paste(region, (0, 0, regsize[0], regsize[1]))
                 im_tile = im_crop.resize((1024, 1024))
@@ -588,7 +588,7 @@ class Maps(am.ArrayObjman):
                 im_tile.save(outfilepath, filetype.upper())
 
                 # print '  bb_orig=',bb
-                print '      bb_orig', bb
+                print('      bb_orig', bb)
                 #lon0, lat0 = proj(x_tile-offset[0], y_tile-offset[1])
                 #lon1, lat1 = proj(x_tile+width_tile-offset[0], y_tile+width_tile-offset[1])
 
@@ -800,7 +800,7 @@ class CsvElevationsImport(PlotoptionsMix
                     quote = self.evaluate_quote(longitudes, latitudes, elevations, coord[0], coord[1])
 
                     edges.shapes[id_edge][i] = [coord[0], coord[1], quote]
-                    print edges.shapes[id_edge][i]
+                    print(edges.shapes[id_edge][i])
                     if i > 0 and (quote-quote_pre) > 0:
                         positive_climb += (quote-quote_pre)
                     elif i > 0 and (quote-quote_pre) < 0:
@@ -841,7 +841,7 @@ class CsvElevationsImport(PlotoptionsMix
         dists = np.sqrt(np.sum((np.stack((longitudes, latitudes), axis=-1) - [x_point, y_point])**2, 1))
 
         if is_scipy:
-            print 'use scipy to interpolate'
+            print('use scipy to interpolate')
             #tck = interpolate.splrep(x, y, s=0)
             #xnew = np.linspace(np.min(x), np.max(x), 200)
             #ynew = interpolate.splev(xnew, tck, der=0)
@@ -880,7 +880,7 @@ class CsvElevationsImport(PlotoptionsMix
                 quote = f_inter(x_point, y_point)
             else:
                 quote = elevations[np.argmin(dists)]
-                print 'nearest quote'
+                print('nearest quote')
         else:
 
             nearest_quotes = elevations[(dists < 100)]
@@ -895,7 +895,7 @@ class CsvElevationsImport(PlotoptionsMix
                 quote = numerator/denominator
             else:
                 quote = elevations[np.argmin(dists)]
-                print 'nearest quote'
+                print('nearest quote')
 
         return quote
 
--- a/tools/contributed/sumopy/coremodules/landuse/wxgui.py
+++ b/tools/contributed/sumopy/coremodules/landuse/wxgui.py
@@ -170,7 +170,7 @@ class ZoneDrawings(Polygons):
                                 id_landusetype=id_landusetype)
 
     def on_add_element(self, shapes, ids):
-        print 'on_add_element', shapes.attrname, ids
+        print('on_add_element', shapes.attrname, ids)
         if shapes == self._zones.shapes:
             self._id_target = ids[0]
             self.add_row(_id=self._id_target,
@@ -1112,7 +1112,7 @@ class WxGui(ModuleGui):
 
     def close_process_facilities(self, dlg):
         # called before destroying the process dialog
-        print 'close_process_facilities', self.proc.status
+        print('close_process_facilities', self.proc.status)
         if self.proc.status == 'success':
             self._mainframe.browse_obj(self._landuse.facilities)
             self._is_needs_refresh = True
@@ -1155,7 +1155,7 @@ class WxGui(ModuleGui):
             # This returns a Python list of files that were selected.
             path = dlg.GetPath()
             # print 'You selected %d files:' % len(paths)
-            if path is not "":
+            if path != "":
                 self._landuse.export_polyxml(path)
 
         dlg.Destroy()
--- a/tools/contributed/sumopy/coremodules/misc/__init__.py
+++ b/tools/contributed/sumopy/coremodules/misc/__init__.py
@@ -18,7 +18,7 @@
 
 __version__ = "0.0"
 
-print 'init', __name__
+print('init', __name__)
 
 
 def get_wxgui():
--- a/tools/contributed/sumopy/coremodules/misc/matplottools.py
+++ b/tools/contributed/sumopy/coremodules/misc/matplottools.py
@@ -38,7 +38,7 @@ if 0:  # change backend...makes problems
     gui_env = ['WXAgg', 'GTKAgg', 'Qt4Agg', 'TKAgg', ]
     for gui in gui_env:
         try:
-            print "Try Matplotlib backend:", gui
+            print("Try Matplotlib backend:", gui)
             mpl.use(gui, warn=False, force=True)
             from mpl.patches import Arrow, Circle, Wedge, Polygon, FancyArrow
             from mpl.mpl import PatchCollection
@@ -51,13 +51,13 @@ if 0:  # change backend...makes problems
             break
         except:
             continue
-    print "Using Matplotlib backend", mpl.get_backend()
+    print("Using Matplotlib backend", mpl.get_backend())
 
 
 try:
     import wx
 except:
-    print 'WARNING: no wxwindows support'
+    print('WARNING: no wxwindows support')
 
 
 COLORS = ['#1f77b4', '#aec7e8', '#ff7f0e', '#ffbb78', '#2ca02c',
@@ -282,7 +282,7 @@ def plot_zone(ax, zone_shape, color_zone
         is_fill = True
 
     shape = (np.array(zone_shape)[:, :2]*mapscale).tolist()
-    print shape
+    print(shape)
     ax.add_patch(Polygon(shape,
                          linewidth=width_line,
                          edgecolor=color_outline,
@@ -357,7 +357,7 @@ def plot_edgevalues_lines(ax, ids_result
                                     )
             ax.add_line(line)
 
-            if printformat is not '':
+            if printformat != '':
                 angles_text = np.arctan2(deltay, deltax)+deltaangle_text
                 # print '  angles_text',printformat%value,angles_text/(np.pi)*180,(angles_text>np.pi/2),(angles_text<3*np.pi/2)
                 if (angles_text > np.pi/2) | (angles_text < -np.pi/2):
@@ -445,7 +445,7 @@ def plot_connectionvalues_lines(ax, ids_
                                     )
             ax.add_line(line)
 
-            if printformat is not '':
+            if printformat != '':
                 angles_text = np.arctan2(deltay, deltax)+deltaangle_text
                 # print '  angles_text',printformat%value,angles_text/(np.pi)*180,(angles_text>np.pi/2),(angles_text<3*np.pi/2)
                 if (angles_text > np.pi/2) | (angles_text < -np.pi/2):
@@ -485,7 +485,7 @@ def plot_edgevalues_arrows(ax, ids_resul
                            mapscale=1.0):
 
     # ATTENTION: do not change order of args for backwards compatibility
-    print 'plot_edgevalues_arrows ids_result width_max', width_max
+    print('plot_edgevalues_arrows ids_result width_max', width_max)
     # print '  ids_result',ids_result
     # print '  ids_edge',ids_edge
     if ids_edge is None:
@@ -515,7 +515,7 @@ def plot_edgevalues_arrows(ax, ids_resul
             deltax = x_vec[-1]-x_vec[0]
             deltay = y_vec[-1]-y_vec[0]
 
-            if printformat is not '':
+            if printformat != '':
                 angles_text = np.arctan2(deltay, deltax)+deltaangle_text
                 if (angles_text > np.pi/2) | (angles_text < -np.pi/2):
                     angles_text += np.pi
@@ -574,7 +574,7 @@ def plot_connectionvalues_arrows(ax, ids
                                  mapscale=1.0):
 
     # ATTENTION: do not change order of args for backwards compatibility
-    print 'plot_connectionvalues_arrows ids_result'
+    print('plot_connectionvalues_arrows ids_result')
 
     head_width = headwidthstretch*width_max
     fontsize_ticks = int(0.8*fontsize)
@@ -599,7 +599,7 @@ def plot_connectionvalues_arrows(ax, ids
             deltax = x_vec[-1]-x_vec[0]
             deltay = y_vec[-1]-y_vec[0]
 
-            if printformat is not '':
+            if printformat != '':
                 angles_text = np.arctan2(deltay, deltax)+deltaangle_text
                 if (angles_text > np.pi/2) | (angles_text < -np.pi/2):
                     angles_text += np.pi
@@ -664,7 +664,7 @@ def plot_nodevalues(ax, ids_result=None,
                     mapscale=1.0):
 
     # ATTENTION: do not change order of args for backwards compatibility
-    print 'plot_nodevalues ids_result'
+    print('plot_nodevalues ids_result')
     fontsize_ticks = int(0.8*fontsize)
 
     patches = []
@@ -717,7 +717,7 @@ def plot_pointvalues(ax, x_coords, y_coo
                      ):
 
     # ATTENTION: do not change order of args for backwards compatibility
-    print 'plot_pointvalues ids_result'
+    print('plot_pointvalues ids_result')
     fontsize_ticks = int(0.8*fontsize)
 ##    i = 0
     patches = []
@@ -776,7 +776,7 @@ def get_resultshape_connections(net, id_
     """
     Return resultshape coords for this edge.
     """
-    print 'get_resultshape', 'connections', 'id_connection', id_connection, 'dispacement', dispacement
+    print('get_resultshape', 'connections', 'id_connection', id_connection, 'dispacement', dispacement)
     x0 = net.edges.shapes[net.lanes.ids_edge[net.connections.ids_fromlane[id_connection]]][-1, 0]
     y0 = net.edges.shapes[net.lanes.ids_edge[net.connections.ids_fromlane[id_connection]]][-1, 1]
     x1 = net.edges.shapes[net.lanes.ids_edge[net.connections.ids_tolane[id_connection]]][0, 0]
@@ -785,7 +785,7 @@ def get_resultshape_connections(net, id_
         shape = np.array([[x0, y0, 0.], [x1, y1, 0.]])
     else:
         shape = np.array([[x0, y0, 0.], [x1 + 1., y1 + 1., 0.]])
-        print 'connection', id_connection, 'has no shape'
+        print('connection', id_connection, 'has no shape')
     n_vert = len(shape)
     resultshape = np.zeros(shape.shape, np.float32)
     #laneshapes = np.zeros((n_lanes,n_vert,3), np.float32)
@@ -1231,7 +1231,7 @@ class PlotoptionsMixin:
 
         rootfilepath = self.get_scenario().get_rootfilepath()
         filepath = "%s_%s.%s" % (rootfilepath, figname, self.figformat)
-        print 'save_fig', filepath
+        print('save_fig', filepath)
         plt.savefig(filepath, format=self.figformat,
                     dpi=self.resolution,
                     # orientation='landscape',
@@ -1473,7 +1473,7 @@ class PlotoptionsMixin:
         # axis.set_ylim([y_min,y_max])
 
     def plot_net(self, axis=None, title="", unit='', mapscale=None, is_configure=True):
-        print 'plot_net mapscale', mapscale
+        print('plot_net mapscale', mapscale)
         if mapscale is None:
             unit = self.unit_mapscale
             mapscale = self.get_attrsman().get_config('unit_mapscale').mapscales[unit]
--- a/tools/contributed/sumopy/coremodules/misc/shapeformat.py
+++ b/tools/contributed/sumopy/coremodules/misc/shapeformat.py
@@ -42,10 +42,10 @@ try:
 
 except:
     IS_PROJ = False
-    print 'Import error: in order to run the traces plugin please install the following modules:'
-    print '   mpl_toolkits.basemap and shapely'
-    print 'Please install these modules if you want to use it.'
-    print __doc__
+    print('Import error: in order to run the traces plugin please install the following modules:')
+    print('   mpl_toolkits.basemap and shapely')
+    print('Please install these modules if you want to use it.')
+    print(__doc__)
     raise
 
 
@@ -54,7 +54,7 @@ try:
     IS_GDAL = True
 except:
     IS_GDAL = False
-    print 'WARNING: GDAL module is not installed.'
+    print('WARNING: GDAL module is not installed.')
 
 
 # Value Shape Type
@@ -221,7 +221,7 @@ def get_proj4_from_shapefile(filepath):
                     gcs, proj, date = groups
                     proj4 = '+proj=longlat +datum=%s%s +no_defs' % (proj, date[2:])
     else:
-        print 'WARNING: found no prj file', projfilepath
+        print('WARNING: found no prj file', projfilepath)
     return proj4
     # return "+proj=utm +zone=32 +ellps=WGS84 +datum=WGS84 +units=m +no_defs"
     # return '+proj=longlat +datum=WGS84 +ellps=WGS84 +a=6378137.0 +f=298.257223563 +pm=0.0  +no_defs'
@@ -241,7 +241,7 @@ def get_shapefile(filepath):
 
     shapefilepath = os.path.join(dirname, basename)
 
-    print 'import_shapefile *%s*' % (shapefilepath), type(str(shapefilepath))
+    print('import_shapefile *%s*' % (shapefilepath), type(str(shapefilepath)))
     sf = shapefile.Reader(str(shapefilepath))
 
     return sf
@@ -285,7 +285,7 @@ class ShapefileImporter(Process):
                  logger=None,
                  **kwargs):
 
-        print 'ShapefileImporter.__init__', filepath  # ,projparams_target_default, projparams_shape
+        print('ShapefileImporter.__init__', filepath)  # ,projparams_target_default, projparams_shape
         self._init_common(ident,
                           parent=parent,
                           name=name,
@@ -466,20 +466,20 @@ class ShapefileImporter(Process):
             self._fieldinfo[attrname] = (ind_field-1, default, dtype, digits_fraction)
 
     def get_projections(self):
-        print 'get_projections IS_PROJ', IS_PROJ
-        print 'self.projparams_shape', self.projparams_shape, 'self._projparams_target', self._projparams_target
+        print('get_projections IS_PROJ', IS_PROJ)
+        print('self.projparams_shape', self.projparams_shape, 'self._projparams_target', self._projparams_target)
 
         proj_shape = None
         proj_target = None
 
         if self.is_use_shapeproj & (self.projparams_shape == ''):
-            print '   no shape projection given'
+            print('   no shape projection given')
             self.projparams_shape = get_proj4_from_shapefile(self.filepath)
-            print '     from prj file projparams_shape', self.projparams_shape
+            print('     from prj file projparams_shape', self.projparams_shape)
             if self.projparams_shape == '':
                 # no results from shapefile info, let's try to guess
                 self.projparams_shape = self.guess_shapeproj()
-                print '     from guessing projparams_shape', self.projparams_shape
+                print('     from guessing projparams_shape', self.projparams_shape)
 
         # if self.is_guess_targetproj:
         #        self.projparams_target = self.guess_targetproj()
@@ -490,14 +490,14 @@ class ShapefileImporter(Process):
             if self.is_use_shapeproj:
 
                 try:
-                    print '  use projparams_shape =*%s*' % self.projparams_shape, type(str(self.projparams_shape)), pyproj.Proj(str(self.projparams_shape))
+                    print('  use projparams_shape =*%s*' % self.projparams_shape, type(str(self.projparams_shape)), pyproj.Proj(str(self.projparams_shape)))
                     proj_shape = pyproj.Proj(str(self.projparams_shape))
                 except:
                     proj_shape = None
 
             if self.is_use_targetproj:
                 try:
-                    print '  use projparams_target =*%s*' % self._projparams_target, type(str(self._projparams_target)), pyproj.Proj(str(self._projparams_target))
+                    print('  use projparams_target =*%s*' % self._projparams_target, type(str(self._projparams_target)), pyproj.Proj(str(self._projparams_target)))
                     proj_target = pyproj.Proj(str(self._projparams_target))
                 except:
                     proj_target = None
@@ -538,7 +538,7 @@ class ShapefileImporter(Process):
         return True
 
     def import_shapes(self):
-        print 'import_shapes'
+        print('import_shapes')
 
         shapes = self._sf.shapes()
         shapetype = shapes[3].shapeType
@@ -551,10 +551,10 @@ class ShapefileImporter(Process):
 
         # print '  proj_shape',proj_shape,'proj_target',proj_target
         if self.is_use_shapeproj & (proj_shape is None):
-            print 'WARNING: import_shapes, no shape projection'
+            print('WARNING: import_shapes, no shape projection')
             return [], 0
         if self.is_use_targetproj & (proj_target is None):
-            print 'WARNING: import_shapes, no target projection'
+            print('WARNING: import_shapes, no target projection')
             return [], 0
 
         offset = np.array([0.0, 0.0, 0.0], dtype=np.float32)
@@ -572,7 +572,7 @@ class ShapefileImporter(Process):
         # print '  offset_target',offset_target
         coordsconfig = self._coordsconfig
         ids = coordsconfig.get_manager().add_rows(n_records)
-        print '  n_records', n_records, shapetype
+        print('  n_records', n_records, shapetype)
 
         if (shapetype == 3) | (shapetype == 5):  # poliline = 3, polygon = 5
             for ind_rec, id_attr in zip(xrange(n_records), ids):
@@ -642,7 +642,7 @@ class ShapefileImporter(Process):
         return ids, shapetype
 
     def do(self):
-        print self.ident+'.do'
+        print(self.ident+'.do')
         #fields = self._sf.fields
         #records = self._sf.records()
 
@@ -661,7 +661,7 @@ class ShapefileImporter(Process):
         ids, shapetype = self.import_shapes()
 
         if len(ids) == 0:
-            print 'WARNING: import_shapes failed'
+            print('WARNING: import_shapes failed')
             return False
 
         n_attrs = len(attrconfs)
@@ -669,7 +669,7 @@ class ShapefileImporter(Process):
 
         # import no attributes from table
         if (n_attrs == 0) | (n_records == 0):
-            print 'WARNING: successfully imported no data'
+            print('WARNING: successfully imported no data')
             return True
         shaperecords = self._sf.shapeRecord
 
@@ -693,13 +693,13 @@ class ShapefileImporter(Process):
                     if not np.any(self.inboundaries(np.array(shape, dtype=np.float32))):
                         ids_outside.append(id_shape)
 
-            print '  ids_outside', ids_outside
+            print('  ids_outside', ids_outside)
             self.parent.del_rows(ids_outside)
 
         return True
 
     def import_data(self, shaperecords, ids, attrconfs, shapeinds):
-        print 'import_data'
+        print('import_data')
         n_records = len(ids)
         objecttype = np.dtype(np.object)  # np.dtype(np.zeros(1,dtype = np.object))
         values_invalid = ['NULL', '\n']
@@ -861,7 +861,7 @@ class Shapedata(am.ArrayObjman):
         If no file is given, the the default file path will be selected.
         """
         # https://code.google.com/p/pyshp/
-        print '\nexport_shapefile', filepath
+        print('\nexport_shapefile', filepath)
         #proj_target, offset_target = self.parent.get_proj_offset()
         if len(self) == 0:
             return False
@@ -940,8 +940,8 @@ class Shapedata(am.ArrayObjman):
             prjfile.close()
             return True
         except:
-            print 'WARNING in export_shapefile:\n no projection file written (probably no Internet connection).'
-            print 'Open shapefile with projection: %s.' % self._projparams.get_value()
+            print('WARNING in export_shapefile:\n no projection file written (probably no Internet connection).')
+            print('Open shapefile with projection: %s.' % self._projparams.get_value())
             # raise
             return False
 
@@ -987,7 +987,7 @@ class Shapedata(am.ArrayObjman):
             self.filepath.set_value(filepath)
 
         basefilepath = self.get_basefilepath(filepath)
-        print 'import_shapefile *%s*' % (basefilepath), type(str(basefilepath))
+        print('import_shapefile *%s*' % (basefilepath), type(str(basefilepath)))
         sf = shapefile.Reader(str(basefilepath))
 
         shapes = sf.shapes()
@@ -1029,7 +1029,7 @@ class Shapedata(am.ArrayObjman):
             # use first field as id, but will also be a regular attribute
             id_egde = shape_rec.record[0]
             attrrow = {}
-            print '\n id_egde', id_egde
+            print('\n id_egde', id_egde)
             for i, field in zip(xrange(n), fields[1:]):
                 val = shape_rec.record[i]
                 # print '  ',i,attrnames[i],'>>'+repr(val)+'<<', type(val)
@@ -1084,7 +1084,7 @@ def nodes_to_shapefile(net, filepath, da
     nodetypes = np.zeros(max(map_nodetypes.keys())+1, dtype=np.object)
     nodetypes[map_nodetypes.keys()] = map_nodetypes.values()
 
-    print 'nodes_to_shapefile', filepath
+    print('nodes_to_shapefile', filepath)
 
     for attr in attrlist:
         shapedata.add_field(attr[2:])
@@ -1131,7 +1131,7 @@ def edges_to_shapefile(net, filepath, da
         ('speeds_max', 'val', 'SPEED_MAX', 'N', 6, 3),
     ]
 
-    print 'edges_to_shapefile', filepath
+    print('edges_to_shapefile', filepath)
 
     for attr in attrlist:
         shapedata.add_field(attr[2:])
@@ -1196,7 +1196,7 @@ def facilities_to_shapefile(facilities,
         ('osmkeys', 'val', 'OSMKEY', 'C', 32, 0),
     ]
 
-    print 'facilities_to_shapefile', filepath
+    print('facilities_to_shapefile', filepath)
 
     for attr in attrlist:
         shapedata.add_field(attr[2:])
@@ -1250,7 +1250,7 @@ def zones_to_shapefile(zones, filepath,
         # ('entropies','id','ENTROPY','N',12,5),
     ]
 
-    print 'zones_to_shapefile', filepath
+    print('zones_to_shapefile', filepath)
 
     for attr in attrlist:
         shapedata.add_field(attr[2:])
--- a/tools/contributed/sumopy/coremodules/network/__init__.py
+++ b/tools/contributed/sumopy/coremodules/network/__init__.py
@@ -18,7 +18,7 @@
 
 __version__ = "0.0"
 
-print 'init', __name__
+print('init', __name__)
 
 
 def get_wxgui():
--- a/tools/contributed/sumopy/coremodules/network/netconvert.py
+++ b/tools/contributed/sumopy/coremodules/network/netconvert.py
@@ -852,13 +852,13 @@ class NetConvertMixin(CmlMixin, Process)
         # print 'SumonetImporter.do',cml
         self.run_cml(cml)
         if self.status == 'success':
-            print '  Netconvert done.'
+            print('  Netconvert done.')
             if os.path.isfile(self.netfilepath):
-                print '  sumo.net.xml exists, start generation of xml files'
+                print('  sumo.net.xml exists, start generation of xml files')
                 net.import_netxml(self.netfilepath)
                 if self.is_import_ptstops:
                     if os.path.isfile(ptstopfilepath):
-                        print '  ptfilepath exists, start importing ptstops'
+                        print('  ptfilepath exists, start importing ptstops')
                         net.ptstops.import_sumostops(ptstopfilepath)
 
                 # print '  import in sumopy done.'
@@ -908,7 +908,7 @@ class TlSignalGenerator(NetConvertMixin)
         self.init_options_tls()
 
     def import_tlsxml(self,  is_remove_xmlfiles=False):
-        print 'import_tlsxml'
+        print('import_tlsxml')
         filepath = self.netfilepath
         net = self.parent
         rootname = net.get_rootfilename()
@@ -922,13 +922,13 @@ class TlSignalGenerator(NetConvertMixin)
             + ' --plain-output-prefix '+filepathlist_to_filepathstring(os.path.join(dirname, rootname))
 
         proc = subprocess.Popen(cml, shell=True)
-        print '  run_cml cml=', cml
-        print '  pid = ', proc.pid
+        print('  run_cml cml=', cml)
+        print('  pid = ', proc.pid)
         proc.wait()
         if not proc.returncode:
 
             tlsfilepath = os.path.join(dirname, rootname+'.tll.xml')
-            print '  import_sumotls', tlsfilepath
+            print('  import_sumotls', tlsfilepath)
             net.import_sumotls_to_net(tlsfilepath, is_remove_xmlfiles=is_remove_xmlfiles)
 
             return True
@@ -949,7 +949,7 @@ class TlSignalGenerator(NetConvertMixin)
             + ' --connection-files '+filepathlist_to_filepathstring(filepath_connections)\
             #+' --output-file '+filepathlist_to_filepathstring(filepath)
 
-        print '  cmlbase', cmlbase
+        print('  cmlbase', cmlbase)
         self.reset_cml(cmlbase)
 
         # apply netconvert and reimport
@@ -960,7 +960,7 @@ class TlSignalGenerator(NetConvertMixin)
         # print 'SumonetImporter.do',cml
         self.run_cml(cml)
         if self.status == 'success':
-            print '  Netconvert done.'
+            print('  Netconvert done.')
             if os.path.isfile(self.netfilepath):
                 # print '  sumo.net.xml exists, start generation of xml files'
                 # self.parent.import_netxml(self.netfilepath)
--- a/tools/contributed/sumopy/coremodules/network/netgenerate.py
+++ b/tools/contributed/sumopy/coremodules/network/netgenerate.py
@@ -43,7 +43,7 @@ class NetGenerateMixin(netconvert.NetCon
                                     logger=logger,
                                     cml='netgenerate')
 
-        print 'init_common_netgen', nettype
+        print('init_common_netgen', nettype)
 
         self.add_option('nettype', '--'+nettype,
                         groupnames=['_private'],
--- a/tools/contributed/sumopy/coremodules/network/network.py
+++ b/tools/contributed/sumopy/coremodules/network/network.py
@@ -449,11 +449,11 @@ class TrafficLightSystems(am.ArrayObjman
         if filepath is None:
             filepath = self.parent.get_rootfilepath()+'.tll.xml'
 
-        print 'export_sumoxml', filepath
+        print('export_sumoxml', filepath)
         try:
             fd = open(filepath, 'w')
         except:
-            print 'WARNING in export_sumoxml: could not open', filepath
+            print('WARNING in export_sumoxml: could not open', filepath)
             return False
 
         fd.write('<?xml version="1.0" encoding="%s"?>\n' % encoding)
@@ -715,7 +715,7 @@ class Connections(am.ArrayObjman):
 
     def analyze_connections(self, **kwargs):
 
-        print 'Analyze connections'
+        print('Analyze connections')
 
         network = self.parent
         edges = network.edges
@@ -744,7 +744,7 @@ class Connections(am.ArrayObjman):
             coord_incoming_penultimate = incoming_edge_shape[-2]
             coord_outgoing_first = outgoing_edge_shape[0]
             coord_outgoing_second = outgoing_edge_shape[1]
-            print 'connection', connection
+            print('connection', connection)
             # print 'coord_node:',coord_node, 'coord_incoming:',coord_incoming, 'coord_outgoing:',coord_outgoing
             azimut_incoming = self.get_azimut(coord_incoming_last, coord_incoming_penultimate)
             azimut_outgoing = self.get_azimut(coord_outgoing_first, coord_outgoing_second)
@@ -761,19 +761,19 @@ class Connections(am.ArrayObjman):
             # Right turn
             if np.pi*3/4 <= np.absolute(diff_azimut) and np.absolute(diff_azimut) <= np.pi*5/4:
                 connections.turns_type[connection] = 'crossing'
-                print 'crossing'
+                print('crossing')
                 nodes.n_left_turns[node] += 1
             elif np.absolute(diff_azimut) <= np.pi/18 or np.absolute(diff_azimut) >= np.pi*35/18:
                 connections.turns_type[connection] = 'u_turn'
-                print 'u_turn'
+                print('u_turn')
                 nodes.n_right_turns[node] += 1
             elif (-3*np.pi/4 < diff_azimut and diff_azimut < -np.pi/18) or (5*np.pi/4 < diff_azimut and diff_azimut < np.pi*35/18):
                 connections.turns_type[connection] = 'right_turn'
-                print 'right turn'
+                print('right turn')
                 nodes.n_crossings[node] += 1
             elif (np.pi/18 < diff_azimut and diff_azimut < 3*np.pi/4) or (-np.pi*35/18 < diff_azimut and diff_azimut < -5*np.pi/4):
                 connections.turns_type[connection] = 'left_turn'
-                print 'left turn'
+                print('left turn')
                 nodes.n_u_turns[node] += 1
 
             init_point = incoming_edge_shape[-1]
@@ -807,7 +807,7 @@ class Connections(am.ArrayObjman):
         elif (x_inc-x_nod) < 0 and (y_inc-y_nod) >= 0:
             azimut_incoming = np.pi*3/2 + np.arctan((y_inc-y_nod)/(x_nod-x_inc))
         else:
-            print 'Warning, the two points are the same'
+            print('Warning, the two points are the same')
             # print point1, point2
             azimut_incoming = 0
 
@@ -836,7 +836,7 @@ class Connections(am.ArrayObjman):
         try:
             fd = open(filepath, 'w')
         except:
-            print 'WARNING in export_sumoxml: could not open', filepath
+            print('WARNING in export_sumoxml: could not open', filepath)
             return False
 
         fd.write('<?xml version="1.0" encoding="%s"?>\n' % encoding)
@@ -1091,7 +1091,7 @@ class Lanes(am.ArrayObjman):
         edges = self.parent.edges
 
         ids_lane = edges.ids_lanes[id_edge]
-        print 'reshape_edgelanes id_edge', id_edge, 'id_edge_sumo', edges.ids_sumo[id_edge], len(ids_lane)
+        print('reshape_edgelanes id_edge', id_edge, 'id_edge_sumo', edges.ids_sumo[id_edge], len(ids_lane))
 
         shape = np.array(edges.shapes[id_edge], np.float32)
 
@@ -1153,7 +1153,7 @@ class Lanes(am.ArrayObjman):
                 else:
                     indexes.append(ind)
                 ind += 1
-            print 'WARNING: ignoring mode has no access on footpath'
+            print('WARNING: ignoring mode has no access on footpath')
             return []
 
             # return len(ids_lane)-1
@@ -1199,7 +1199,7 @@ class Lanes(am.ArrayObjman):
 
                 else:
                     return ind
-            print 'WARNING: ignoring mode has no access on footpath'
+            print('WARNING: ignoring mode has no access on footpath')
             return -1
 
             # return len(ids_lane)-1
@@ -1759,7 +1759,7 @@ class Edges(am.ArrayObjman):
             are considered, disregarding the actual connections
 
         """
-        print 'get_fstar id_mode', id_mode, 'is_return_lists', is_return_lists, 'is_return_arrays', is_return_arrays
+        print('get_fstar id_mode', id_mode, 'is_return_lists', is_return_lists, 'is_return_arrays', is_return_arrays)
         #ids_edge = self.get_ids()
         #fstar = np.array(np.zeros(np.max(ids_edge)+1, np.obj))
         fstar = {}
@@ -2017,7 +2017,7 @@ class Edges(am.ArrayObjman):
         If not allowed on a particular edge,
         then the respective edge distance is nan.
         """
-        print 'get_distances id_mode,is_check_lanes,speed_max', id_mode, is_check_lanes, is_precise
+        print('get_distances id_mode,is_check_lanes,speed_max', id_mode, is_check_lanes, is_precise)
         ids_edge = self.get_ids()
         dists = np.zeros(np.max(ids_edge)+1, np.float32)
         #speeds = self.speeds_max[ids_edge]
@@ -2247,7 +2247,7 @@ class Edges(am.ArrayObjman):
             inds = self.get_inds()
         else:
             inds = self.get_inds(ids)
-        print 'make_linevertices', len(inds)
+        print('make_linevertices', len(inds))
 
         linevertices = np.zeros((0, 2, 3), np.float32)
         vertexinds = np.zeros((0, 2), np.int32)
@@ -2518,7 +2518,7 @@ class Edges(am.ArrayObjman):
         try:
             fd = open(filepath, 'w')
         except:
-            print 'WARNING in export_sumoxml: could not open', filepath
+            print('WARNING in export_sumoxml: could not open', filepath)
             return False
         fd.write('<?xml version="1.0" encoding="%s"?>\n' % encoding)
 
@@ -2531,7 +2531,7 @@ class Edges(am.ArrayObjman):
         return True
 
     def export_edgeweights_xml(self, filepath=None, weights=None, time_begin=0, time_end=3600, ident='w1',  encoding='UTF-8'):
-        print 'export_edgeweights_xml', time_begin, time_end, 'filepath', filepath
+        print('export_edgeweights_xml', time_begin, time_end, 'filepath', filepath)
         # <meandata>
         # <interval begin="0" end="7200" id="w1">
         # <edge id="gneE0" traveltime="100"/>
@@ -2545,7 +2545,7 @@ class Edges(am.ArrayObjman):
         try:
             fd = open(filepath, 'w')
         except:
-            print 'WARNING in export_edgeweights_xml: could not open', filepath
+            print('WARNING in export_edgeweights_xml: could not open', filepath)
             return ''
 
         if weights is None:
@@ -2574,7 +2574,7 @@ class Edges(am.ArrayObjman):
         return filepath
 
     def update(self, ids=None, is_update_lanes=False):
-        print 'Edges.update'
+        print('Edges.update')
 
         if ids is None:
             self.widths.value = self.nums_lanes.value * self.widths_lanes_default.value \
@@ -2720,7 +2720,7 @@ class Edges(am.ArrayObjman):
 
     def analyze_edges(self, **kwargs):
         # TODO: this should feed into a temporary field
-        print 'Analyze edges'
+        print('Analyze edges')
         # individuate edge typologies (pedestrian, bike lane, bike/pedestrian,
         # one-way road, 2-way road)
         network = self.parent
@@ -2739,10 +2739,10 @@ class Edges(am.ArrayObjman):
             if len(lanes.ids_mode[id_lanes]) == 1:
                 if lanes.ids_mode[id_lanes] == [id_ped]:
                     pedestrian_edges.append(id_edge)
-                    print 'edge', id_edge, 'ped'
+                    print('edge', id_edge, 'ped')
                 if lanes.ids_mode[id_lanes] == [id_bike]:
                     cycling_edges.append(id_edge)
-                    print 'edge', id_edge, 'cycl'
+                    print('edge', id_edge, 'cycl')
         edges.edge_typology[pedestrian_edges] = 'Pedestrian'
         edges.edge_typology[cycling_edges] = 'bike lane'
 
@@ -2757,14 +2757,14 @@ class Edges(am.ArrayObjman):
             if len(lanes.ids_modes_allow[id_lanes][0]) == 2 and len(id_lanes) == 1:
                 if id_bike in np.array(lanes.ids_modes_allow[id_lanes][0]) and id_ped in np.array(lanes.ids_modes_allow[id_lanes][0]):
                     cycling_ped_edges.append(id_edge)
-                    print 'edge', id_edge, 'cycl_ped'
+                    print('edge', id_edge, 'cycl_ped')
             elif len(id_lanes) == 2:
                 if lanes.ids_mode[id_lanes[0]] == id_bike and lanes.ids_mode[id_lanes[1]] == id_ped:
                     cycling_ped_edges.append(id_edge)
-                    print 'edge', id_edge, 'cycl_ped'
+                    print('edge', id_edge, 'cycl_ped')
                 if lanes.ids_mode[id_lanes[0]] == id_ped and lanes.ids_mode[id_lanes[1]] == id_bike:
                     cycling_ped_edges.append(id_edge)
-                    print 'edge', id_edge, 'cycl_ped'
+                    print('edge', id_edge, 'cycl_ped')
 
         edges.edge_typology[cycling_ped_edges] = 'Bike/Pedestrian'
         ids_edge_car = ids_edge
@@ -3051,7 +3051,7 @@ class Nodes(am.ArrayObjman):
         try:
             fd = open(filepath, 'w')
         except:
-            print 'WARNING in export_sumoxml: could not open', filepath
+            print('WARNING in export_sumoxml: could not open', filepath)
             return False
         fd.write('<?xml version="1.0" encoding="%s"?>\n' % encoding)
         indent = 0
@@ -3116,7 +3116,7 @@ class Nodes(am.ArrayObjman):
 
     def clean(self, is_reshape_edgelanes=False, nodestretchfactor=1.2, n_min_nodeedges=2):
         # is_reshape_edgelanes = False, nodestretchfactor = 2.8
-        print 'Nodes.clean', len(self), 'is_reshape_edgelanes', is_reshape_edgelanes
+        print('Nodes.clean', len(self), 'is_reshape_edgelanes', is_reshape_edgelanes)
 
         edges = self.parent.edges
         lanes = self.parent.lanes
@@ -3242,7 +3242,7 @@ class Nodes(am.ArrayObjman):
 
 class Network(cm.BaseObjman):
     def __init__(self, parent=None, name='Network', **kwargs):
-        print 'Network.__init__', parent, name
+        print('Network.__init__', parent, name)
         self._init_objman(ident='net', parent=parent, name=name,
                           # xmltag = 'net',# no, done by netconvert
                           version=0.1,
@@ -3495,7 +3495,7 @@ class Network(cm.BaseObjman):
         # do other cleanup jobs
 
     def call_netedit(self, filepath=None, is_maps=False, is_poly=True, command='netedit'):
-        print 'call_netedit'
+        print('call_netedit')
         #filepath = self.export_netxml(filepath)
         if filepath is None:
             filepath = self.get_filepath()
@@ -3539,23 +3539,23 @@ class Network(cm.BaseObjman):
                 cml += ' --tllogic-files '+filepathlist_to_filepathstring(filepath_tlss)
 
             proc = subprocess.Popen(cml, shell=True)
-            print '  run_cml cml=', cml
+            print('  run_cml cml=', cml)
             # print '  pid = ',proc.pid
             proc.wait()
             if proc.returncode == 0:
-                print '  ', command, ':success'
+                print('  ', command, ':success')
 
                 return self.import_netxml()
                 # return self.import_xml() # use if netedit exports to plain xml files
             else:
-                print '  ', command, ':error'
+                print('  ', command, ':error')
                 return False
         else:
-            print '  netconvert:error'
+            print('  netconvert:error')
             return False
 
     def call_sumogui(self, filepath=None, is_maps=True, is_poly=True):
-        print 'call_sumogui', filepath, is_maps, is_poly
+        print('call_sumogui', filepath, is_maps, is_poly)
 
         if filepath is None:
             filepath = self.get_filepath()
@@ -3606,8 +3606,8 @@ class Network(cm.BaseObjman):
             + option_addfiles
 
         proc = subprocess.Popen(cml, shell=True)
-        print '  run_cml cml=', cml
-        print '  pid = ', proc.pid
+        print('  run_cml cml=', cml)
+        print('  pid = ', proc.pid)
         proc.wait()
         return proc.returncode
 
@@ -3642,7 +3642,7 @@ class Network(cm.BaseObjman):
         else:
             configfilepath = self.get_rootfilepath()+'.netedit.xml'
 
-        print 'write_guiconfig', configfilepath, is_maps & (maps is not None), maps
+        print('write_guiconfig', configfilepath, is_maps & (maps is not None), maps)
         fd_config = open(configfilepath, 'w')
         for line in fd_template.readlines():
             if line.count('<decals>') == 1:
@@ -3658,7 +3658,7 @@ class Network(cm.BaseObjman):
         return configfilepath
 
     def import_netxml(self, filepath=None, rootname=None, is_clean_nodes=False, is_remove_xmlfiles=False):
-        print 'import_netxml', filepath
+        print('import_netxml', filepath)
 
         if rootname is None:
             rootname = self.get_rootfilename()
@@ -3674,11 +3674,11 @@ class Network(cm.BaseObjman):
                 + ' --sumo-net-file '+filepathlist_to_filepathstring(filepath)\
                 + ' --plain-output-prefix '+filepathlist_to_filepathstring(os.path.join(dirname, rootname))
             proc = subprocess.Popen(cml, shell=True)
-            print '  run_cml cml=', cml
-            print '  pid = ', proc.pid
+            print('  run_cml cml=', cml)
+            print('  pid = ', proc.pid)
             proc.wait()
             if not proc.returncode:
-                print '  modes.names', self.modes.names
+                print('  modes.names', self.modes.names)
                 return self.import_xml(rootname, dirname)
             else:
                 return False
@@ -3698,7 +3698,7 @@ class Network(cm.BaseObjman):
             fd = open(filepath, 'w')
 
         except:
-            print 'WARNING in write_obj_to_xml: could not open', filepath
+            print('WARNING in write_obj_to_xml: could not open', filepath)
             return False
 
         #xmltag, xmltag_item, attrname_id = self.xmltag
@@ -3764,7 +3764,7 @@ class Network(cm.BaseObjman):
         if filepath is None:
             filepath = self.get_filepath()
 
-        print 'Net.export_netxml', filepath
+        print('Net.export_netxml', filepath)
         filepath_edges, filepath_nodes, filepath_connections, filepath_tlss = self.export_painxml(
             filepath=filepath, is_export_tlss=is_export_tlss)
 
@@ -3781,11 +3781,11 @@ class Network(cm.BaseObjman):
 
         if is_netconvert:
             proc = subprocess.Popen(cml, shell=True)
-            print 'run_cml cml=', cml
-            print '  pid = ', proc.pid
+            print('run_cml cml=', cml)
+            print('  pid = ', proc.pid)
             proc.wait()
             if proc.returncode == 0:
-                print '  success'
+                print('  success')
                 if is_return_delta:
                     delta = self._get_delta_netconvert(filepath)
 
@@ -3793,7 +3793,7 @@ class Network(cm.BaseObjman):
                 else:
                     return filepath
             else:
-                print '  success'
+                print('  success')
                 return ''
         else:
             return ''
@@ -3835,7 +3835,7 @@ class Network(cm.BaseObjman):
             oldoffset = self.get_offset()
         else:
             oldoffset = None
-        print 'Network.import_xml oldoffset', oldoffset
+        print('Network.import_xml oldoffset', oldoffset)
         # remove current network
         # print '  remove current network'
         self.clear_net()
@@ -3903,7 +3903,7 @@ class Network(cm.BaseObjman):
             return False
 
     def import_sumonodes(self, filename, is_remove_xmlfiles=False, logger=None, **others):
-        print 'import_sumonodes', filename
+        print('import_sumonodes', filename)
         # print '  parent',self.parent
         self.get_logger().w('import_sumonodes', key='message')
 
@@ -3923,11 +3923,11 @@ class Network(cm.BaseObjman):
         fastreader.write_to_net()
 
         # timeit
-        print '  exec time=', time.clock() - exectime_start
+        print('  exec time=', time.clock() - exectime_start)
         return fastreader
 
     def import_sumoedges(self, filename, is_remove_xmlfiles=False, logger=None, **others):
-        print 'import_sumoedges', filename
+        print('import_sumoedges', filename)
         logger = self.get_logger()
         logger.w('import_sumoedges', key='message')
         # timeit
@@ -3949,7 +3949,7 @@ class Network(cm.BaseObjman):
         if is_remove_xmlfiles:
             os.remove(filename)
         # timeit
-        print '  exec time=', time.clock() - exectime_start
+        print('  exec time=', time.clock() - exectime_start)
 
         # except KeyError:
         #    print >> sys.stderr, "Please mind that the network format has changed in 0.16.0, you may need to update your network!"
@@ -3957,7 +3957,7 @@ class Network(cm.BaseObjman):
         return fastreader
 
     def import_sumoconnections(self, filename, is_remove_xmlfiles=False, logger=None, **others):
-        print 'import_sumoedges', filename
+        print('import_sumoedges', filename)
         logger = self.get_logger()
         logger.w('import_sumoconnections', key='message')
 
@@ -3974,7 +3974,7 @@ class Network(cm.BaseObjman):
 
         # timeit
         exectime_end = time.clock()
-        print '  exec time=', exectime_end - exectime_start
+        print('  exec time=', exectime_end - exectime_start)
         return fastreader
 
     def import_sumotls(self, filename, is_remove_xmlfiles=False, logger=None, **others):
@@ -3982,7 +3982,7 @@ class Network(cm.BaseObjman):
         Import traffic ligh signals from tll.xml file
         as part of a complete import net process.
         """
-        print 'import_sumotls', filename
+        print('import_sumotls', filename)
 
         if logger is None:
             logger = self.get_logger()
@@ -3996,14 +3996,14 @@ class Network(cm.BaseObjman):
 
         # timeit
         exectime_end = time.clock()
-        print '  exec time=', exectime_end - exectime_start
+        print('  exec time=', exectime_end - exectime_start)
         return reader
 
     def import_sumotls_to_net(self, filename, is_remove_xmlfiles=False, logger=None, **others):
         """
         Import traffic ligh signals from tll.xml file into an existing network.
         """
-        print 'import_sumotls_to_net', filename
+        print('import_sumotls_to_net', filename)
 
         # associate nodes with sumo tls ID
         #map_id_node_to_id_tlss_sumo = {}
@@ -4028,7 +4028,7 @@ class Network(cm.BaseObjman):
 
         # timeit
         exectime_end = time.clock()
-        print '  exec time=', exectime_end - exectime_start
+        print('  exec time=', exectime_end - exectime_start)
 
         # reestablish TLS IDs of nodes
 
@@ -4376,7 +4376,7 @@ class SumoNodeReader(handler.ContentHand
             if self._isNew | (version == attrs['version']):
                 self._net.set_version(attrs['version'])
             else:
-                print 'WARNING: merge with incompatible net versions %s versus %s.' % (version, attrs['version'])
+                print('WARNING: merge with incompatible net versions %s versus %s.' % (version, attrs['version']))
 
         elif name == 'location':  # j.s
             # print 'startElement',name,self._isNew
@@ -4423,7 +4423,7 @@ class SumoNodeReader(handler.ContentHand
             else:
                 if attrs.has_key('projParameter'):
                     if self._net.get_projparams() != attrs['projParameter']:
-                        print 'WARNING: merge with incompatible projections %s versus %s.' % (self._net.getprojparams(), attrs['projparams'])
+                        print('WARNING: merge with incompatible projections %s versus %s.' % (self._net.getprojparams(), attrs['projparams']))
 
         elif name == 'node':
             if attrs['id'][0] != ':':  # no internal node
@@ -5094,7 +5094,7 @@ class SumonetMerger(CmlMixin, Process):
 
     def do(self):
         self.netfilepaths = self.netfilepath+','+self.netfilepaths
-        print 'merging netfilepaths', self.netfilepaths
+        print('merging netfilepaths', self.netfilepaths)
         cml = self.get_cml()+' --ignore-errors -o %s' % (filepathlist_to_filepathstring(self.filepath_out))
         # print 'SumonetImporter.do',cml
         #import_xml(self, rootname, dirname, is_clean_nodes = True)
--- a/tools/contributed/sumopy/coremodules/network/network_editor.py
+++ b/tools/contributed/sumopy/coremodules/network/network_editor.py
@@ -414,7 +414,7 @@ class AddCrossingTool(SelectTool):
     def on_add_crossing(self, event=None):
         self._optionspanel.apply()
         #edges = self.get_edges().ids_sumo
-        print 'add crossing'
+        print('add crossing')
         # print '  id_node',self.id_node.get_value()
         # print '  ids_edge',self.ids_edge.get_value()
         crossings = self.get_scenario().net.crossings
--- a/tools/contributed/sumopy/coremodules/network/networktools.py
+++ b/tools/contributed/sumopy/coremodules/network/networktools.py
@@ -37,7 +37,7 @@ from agilepy.lib_base.geometry import *
 class ActuatedTlsConfigurator(Process):
 
     def __init__(self,  net, logger=None, **kwargs):
-        print 'ActuatedTlsConfigurator.__init__'
+        print('ActuatedTlsConfigurator.__init__')
         self._init_common('sctuatedtlsconfigurator',
                           parent=net,
                           name='Actuated Tls Configurator',
@@ -76,7 +76,7 @@ class ActuatedTlsConfigurator(Process):
         tlss = self.parent.tlss  # traffic light systems
         tlls = tlss.tlls.get_value()  # traffic light logics = programs
         ids_node = nodes.get_ids()
-        print 'ActuatedTlsConfigurator.do, len(ids_node)', len(ids_node), self.is_set_actuated
+        print('ActuatedTlsConfigurator.do, len(ids_node)', len(ids_node), self.is_set_actuated)
 
         if self.is_set_actuated:
             type_tls = 2
@@ -92,7 +92,7 @@ class ActuatedTlsConfigurator(Process):
 
                 # go through logics of traffic light
                 for id_tll in tlss.ids_tlls[id_tls]:
-                    print '    set logic  id_tll', id_tll
+                    print('    set logic  id_tll', id_tll)
                     tlls.ptypes[id_tll] = type_tls
 
                     # go through phases of program and adjust min max durations
@@ -110,7 +110,7 @@ class ActuatedTlsConfigurator(Process):
 
 class TlsGenerator(netconvert.NetConvertMixin):
     def __init__(self,  net, logger=None, **kwargs):
-        print 'TlsGenerate.__init__'
+        print('TlsGenerate.__init__')
         self._init_common('tlsgenerator',
                           parent=net,
                           name='Trafficlight system generator',
@@ -148,7 +148,7 @@ class TlsGenerator(netconvert.NetConvert
         return np.sum(self.parent.edges.lengths[route])
 
     def do(self):
-        print 'TlsGenerator.do'
+        print('TlsGenerator.do')
         net = self.parent
 
         edges = net.edges
@@ -178,7 +178,7 @@ class TlsGenerator(netconvert.NetConvert
                    edges.ids_tonode[ids_edge],
                    edges.speeds_max[ids_edge],
                    ):
-            print '    is_major_road', id_edge, self.is_major_road(priority, n_lanes, speed_max), id_edge not in ids_edges_major
+            print('    is_major_road', id_edge, self.is_major_road(priority, n_lanes, speed_max), id_edge not in ids_edges_major)
             if self.is_major_road(priority, n_lanes, speed_max):
                 if id_edge not in ids_edges_major:
                     #dist = 0
@@ -190,11 +190,11 @@ class TlsGenerator(netconvert.NetConvert
 
         self.majorroutes = majorroutes
 
-        print '  majorroutes:'  # ,majorroutes
+        print('  majorroutes:')  # ,majorroutes
         # mapping with id_edge as key ind index of  majorroutes
         edges_major = {}
         for i, route in zip(xrange(len(majorroutes)), majorroutes):
-            print '    route', i, len(route), route
+            print('    route', i, len(route), route)
             for id_edge in route:
                 edges_major[id_edge] = i
 
@@ -217,7 +217,7 @@ class TlsGenerator(netconvert.NetConvert
             ids_nodeset1 = set(ids_node1)
             for i_route2, ids_node2 in zip(xrange(len(majorroutes)), majornodes):
                 if i_route2 != i_route1:
-                    print '    check routes', i_route1, i_route2, 'ids_node_inter', ids_nodeset1.intersection(ids_node2)
+                    print('    check routes', i_route1, i_route2, 'ids_node_inter', ids_nodeset1.intersection(ids_node2))
                     for id_node_inter in ids_nodeset1.intersection(ids_node2):
                         # go through all nodes that route1 and route2 have in common
                         if majorjuntions.has_key(id_node_inter):
@@ -234,13 +234,13 @@ class TlsGenerator(netconvert.NetConvert
         self.ids_majornodes_used = set()
 
         # create mojor TLS
-        print '  major junctions:'
+        print('  major junctions:')
         for id_node, inds_route in majorjuntions.iteritems():
             if id_node not in self.ids_majornodes_used:
                 # debug
-                print '    Next majornode', id_node
+                print('    Next majornode', id_node)
                 for ind in inds_route:
-                    print '      majorroute', majorroutes[ind]
+                    print('      majorroute', majorroutes[ind])
 
                 self.make_majortls(id_node, inds_route)
             # print '    junction', id_node
@@ -250,8 +250,8 @@ class TlsGenerator(netconvert.NetConvert
         return True
 
     def make_majortls(self, id_node_major, inds_route):
-        print 79*'-'
-        print 'make_majortls for', id_node_major, inds_route
+        print(79*'-')
+        print('make_majortls for', id_node_major, inds_route)
         edges = self.parent.edges
         nodes = self.parent.nodes
         lanes = self.parent.lanes
@@ -302,7 +302,7 @@ class TlsGenerator(netconvert.NetConvert
         # enrich node attributes: is_cycleped, is_crossing
         #  detect all connections, lanes and everything else
         for id_node, nodeattrs in nodes_tls.iteritems():
-            print '  check all in id_node', id_node
+            print('  check all in id_node', id_node)
             is_cycleped = True
             n_cycleped = 0  # count incomin and outgoing cycleped edges
             n_nocycleped_in = 0  # count normal incoming road edges
@@ -311,7 +311,7 @@ class TlsGenerator(netconvert.NetConvert
             # make lists with incoming edges
             for id_edge in nodes.ids_incoming[id_node]:
 
-                print '    check incoming', id_edge
+                print('    check incoming', id_edge)
                 ids_lane = edges.ids_lanes[id_edge]
                 #is_cycleped_edge = True
                 #is_ped_edge = True
@@ -342,7 +342,7 @@ class TlsGenerator(netconvert.NetConvert
 
                 # detect incoming edges
                 # ,not is_ped_edge,'not from TLS',edges.ids_fromnode[id_edge] not in ids_nodes_tls
-                print '       is external', edges.ids_fromnode[id_edge] not in ids_nodes_tls, 'is_cycle_edge', is_cycle_edge, 'is_major', id_edge in edges_major, 'is_noped'
+                print('       is external', edges.ids_fromnode[id_edge] not in ids_nodes_tls, 'is_cycle_edge', is_cycle_edge, 'is_major', id_edge in edges_major, 'is_noped')
                 if edges.ids_fromnode[id_edge] not in ids_nodes_tls:
                     # from node is not part of the TLS
                     # so it comes from external
@@ -396,25 +396,25 @@ class TlsGenerator(netconvert.NetConvert
 
         # debug
         if 1:
-            print '  nodes_tls:'
+            print('  nodes_tls:')
             for id_node, nodeattrs in nodes_tls.iteritems():
-                print '    id_node', id_node
+                print('    id_node', id_node)
                 for key, val in nodeattrs.iteritems():
-                    print '        ', key, val
+                    print('        ', key, val)
 
         n_cons = len(ids_con_tls)
         ids_con_tls = np.array(ids_con_tls, dtype=np.int32)
         ids_connodes = np.array(ids_connodes, dtype=np.int32)
-        print '  ids_incoming_major_tls', ids_incoming_major_tls
-        print '  ids_outgoing_major_tls', ids_outgoing_major_tls
-        print '  ids_incoming_tls', ids_incoming_tls
-        print '  ids_outgoing_tls', ids_outgoing_tls
+        print('  ids_incoming_major_tls', ids_incoming_major_tls)
+        print('  ids_outgoing_major_tls', ids_outgoing_major_tls)
+        print('  ids_incoming_tls', ids_incoming_tls)
+        print('  ids_outgoing_tls', ids_outgoing_tls)
 
         if len(ids_incoming_tls)+len(ids_incoming_major_tls) < 2:
-            print '  Need at least 2 incoming edges. Abandon.'
+            print('  Need at least 2 incoming edges. Abandon.')
             return False
 
-        print '  connectors detected:', n_cons
+        print('  connectors detected:', n_cons)
         #ids_conlane = np.array(ids_conlane, dtype = np.int32 )
         #convecs = np.array(convecs, dtype = np.float32 )
         vertices_fromcon = np.zeros((n_cons, 2, 2), dtype=np.float32)
@@ -511,7 +511,7 @@ class TlsGenerator(netconvert.NetConvert
                         dists_to < dist_intercheck,
                         (ids_connodes == id_node), (ids_conedges_from != id_edge_from),
                         inds):
-                    print '    id_con:%d d_from %.2f, d_to %.2f' % (id_con1, df, dt), df < dist_intercheck, dt < dist_intercheck, id_node1 == id_node, id_edge1 != id_edge_from, crit
+                    print('    id_con:%d d_from %.2f, d_to %.2f' % (id_con1, df, dt), df < dist_intercheck, dt < dist_intercheck, id_node1 == id_node, id_edge1 != id_edge_from, crit)
                     # print '    vf',vf,'vt',vt,'cent',cent,cent-vt
 
                 dists_fromcon_node[id_con] = np.array(dists_from[inds], dtype=np.int32)
@@ -522,9 +522,9 @@ class TlsGenerator(netconvert.NetConvert
             inds_cons_merge[id_con] = inds & np.isnan(dists_to)
 
         if 1:  # debug
-            print '  show conflicts:', len(inds_cons_conflict)
+            print('  show conflicts:', len(inds_cons_conflict))
             for id_con_tls, inds_con_conflict, id_connode in zip(ids_con_tls, inds_cons_conflict.values(), ids_connodes):
-                print '   id_connode:%d id_con:%d' % (id_connode, id_con_tls), 'ids_conf', ids_con_tls[inds_con_conflict]
+                print('   id_connode:%d id_con:%d' % (id_connode, id_con_tls), 'ids_conf', ids_con_tls[inds_con_conflict])
 
             # print '  id_node %d, id_con %d confl:'%(id_node,id_con)
             # print '    ids_con_conflict',ids_con_tls[inds_con_conflict]
@@ -540,7 +540,7 @@ class TlsGenerator(netconvert.NetConvert
         #self.id_mode_ped = net.modes.get_id_mode("pedestrian")
         #self.id_mode_car = net.modes.get_id_mode("passenger")
 
-        print '\n  generate routes accross the TLS'
+        print('\n  generate routes accross the TLS')
         #costs = edges.get_times( id_mode = self.id_mode_car , is_check_lanes = True, speed_max = None)
         # use bus here so we can route also on reserved lanes
         costs = edges.get_times(id_mode=self.id_mode_bus, is_check_lanes=True, speed_max=None)
@@ -554,7 +554,7 @@ class TlsGenerator(netconvert.NetConvert
         routes_tls = []
         routes_tls_cost = []
         ids_routeedge_tls = set()
-        print '    create major routes for ids_incoming_major_tls', ids_incoming_major_tls, 'ids_outgoing_major_tls', ids_outgoing_major_tls
+        print('    create major routes for ids_incoming_major_tls', ids_incoming_major_tls, 'ids_outgoing_major_tls', ids_outgoing_major_tls)
         for id_incoming_tls in ids_incoming_major_tls:
             # ind_route =
             # print '    major:id_incoming_tls',id_incoming_tls,type(id_incoming_tls), edges_major.has_key(id_incoming_tls)
@@ -564,10 +564,10 @@ class TlsGenerator(netconvert.NetConvert
             # select major route
             route_major = self.majorroutes[edges_major[id_incoming_tls]]
             costs_major_tot = self.majorroutecosts[edges_major[id_incoming_tls]]
-            print '      id_incoming_tls', id_incoming_tls, 'costs_major_tot', costs_major_tot
+            print('      id_incoming_tls', id_incoming_tls, 'costs_major_tot', costs_major_tot)
             ind_from = route_major.index(id_incoming_tls)
             for id_outgoing_tls in ids_outgoing_major_tls:
-                print '       id_incoming_tls -> id_outgoing_tls', id_incoming_tls, '->', id_outgoing_tls
+                print('       id_incoming_tls -> id_outgoing_tls', id_incoming_tls, '->', id_outgoing_tls)
                 route = []
 
                 if (id_outgoing_tls in route_major) & (ind_from < (len(route_major)-1)):
@@ -586,7 +586,7 @@ class TlsGenerator(netconvert.NetConvert
 
                 if len(route) == 0:
                     # major route does not connects id_incoming_tls and id_outgoing_tls
-                    print '    try to find a route between both edges'
+                    print('    try to find a route between both edges')
                     dur, route_raw = routing.get_mincostroute_edge2edge(
                         id_incoming_tls, id_outgoing_tls,
                         weights=costs, fstar=fstar)
@@ -613,7 +613,7 @@ class TlsGenerator(netconvert.NetConvert
                         route = []
                         costs_major = 0.0
 
-                print '    =>costs_major,route_major tls', costs_major, route
+                print('    =>costs_major,route_major tls', costs_major, route)
                 if len(route) > 0:
                     routes_tls.append(route)
                     # costs to decide which phase is first
@@ -623,15 +623,15 @@ class TlsGenerator(netconvert.NetConvert
                     ids_routeedge_tls.update(route)
 
         if 1:  # sp
-            print '  major routes_tls', routes_tls, ids_outgoing_bike_tls
-            print '  create bike routes for ids_incoming_bike_tls', ids_incoming_bike_tls, ids_outgoing_bike_tls
+            print('  major routes_tls', routes_tls, ids_outgoing_bike_tls)
+            print('  create bike routes for ids_incoming_bike_tls', ids_incoming_bike_tls, ids_outgoing_bike_tls)
             for id_incoming_tls in ids_incoming_bike_tls:  # +ids_incoming_tls+ids_incoming_major_tls:
 
                 D, P = routing.edgedijkstra(id_incoming_tls, ids_edge_target=set(ids_outgoing_bike_tls),
                                             weights=costs_bike, fstar=fstar)
 
                 for id_outgoing_tls in ids_outgoing_bike_tls:  # +ids_outgoing_tls+ids_outgoing_major_tls:
-                    print '      bike route from %d to %d' % (id_incoming_tls, id_outgoing_tls), 'can route?', (id_incoming_tls in D) & (id_outgoing_tls in D)
+                    print('      bike route from %d to %d' % (id_incoming_tls, id_outgoing_tls), 'can route?', (id_incoming_tls in D) & (id_outgoing_tls in D))
                     if (id_incoming_tls in D) & (id_outgoing_tls in D):
 
                         # avoid route with turnaround
@@ -656,10 +656,10 @@ class TlsGenerator(netconvert.NetConvert
                                         routes_tls_cost.append(routecost)
                                         ids_routeedge_tls.update(route)
 
-            print '  withbike routes_tls', routes_tls
+            print('  withbike routes_tls', routes_tls)
 
         ids_outgoing_tls_rest = ids_outgoing_tls+ids_outgoing_major_tls  # +ids_outgoing_bike_tls
-        print '  create rest of routes for ids_incoming_tls', ids_incoming_tls, ids_outgoing_tls_rest
+        print('  create rest of routes for ids_incoming_tls', ids_incoming_tls, ids_outgoing_tls_rest)
         for id_incoming_tls in ids_incoming_tls+ids_incoming_major_tls:  # +ids_incoming_bike_tls:
 
             D, P = routing.edgedijkstra(id_incoming_tls, ids_edge_target=set(ids_outgoing_tls_rest),
@@ -669,7 +669,7 @@ class TlsGenerator(netconvert.NetConvert
                 if not ((id_incoming_tls in ids_outgoing_major_tls) & (id_outgoing_tls in ids_outgoing_major_tls)):
                     # major incoming and outgoing already done with major routes
 
-                    print '    rest route from id_incoming_tls,', id_incoming_tls, 'id_outgoing_tls', id_outgoing_tls
+                    print('    rest route from id_incoming_tls,', id_incoming_tls, 'id_outgoing_tls', id_outgoing_tls)
                     # avoid route with turnaround
                     if edges.ids_tonode[id_outgoing_tls] != edges.ids_fromnode[id_incoming_tls]:
 
@@ -690,7 +690,7 @@ class TlsGenerator(netconvert.NetConvert
                                     routes_tls_cost.append(routecost)
                                     ids_routeedge_tls.update(route)
 
-        print '\n  all routes_tls', routes_tls
+        print('\n  all routes_tls', routes_tls)
 
         # add bicycle routes
 
@@ -717,7 +717,7 @@ class TlsGenerator(netconvert.NetConvert
             routecost = routes_tls_cost[ind_route]
             #ids_edges = self.majorroutes[ind_route]
             #ids_edges = np.array(ids_edges_list, dtype = np.int32)
-            print '  Determine connectors for route ind_route', ind_route, ids_edges
+            print('  Determine connectors for route ind_route', ind_route, ids_edges)
             # print '    ids_node',edges.ids_fromnode[ids_edges[:-1]]
             # print '    nodes_tls',nodes_tls.keys()
             # for id_edge, id_innode, id_outnode  in zip(ids_edges, edges.ids_fromnode[ids_edges], edges.ids_tonode[ids_edges]):
@@ -744,7 +744,7 @@ class TlsGenerator(netconvert.NetConvert
                         inds_con_route |= (lanes.ids_edge[ids_fromlane_tls] == id_edge_from) & (
                             lanes.ids_edge[ids_tolane_tls] == id_edge_to)
 
-                print '    id_node,prio', id_node, prio, id_node in nodes_tls, 'n_cons_route', len(np.flatnonzero(inds_con_route))
+                print('    id_node,prio', id_node, prio, id_node in nodes_tls, 'n_cons_route', len(np.flatnonzero(inds_con_route)))
 
             # make phase  for ids_edges
             if prio != -1:
@@ -755,9 +755,9 @@ class TlsGenerator(netconvert.NetConvert
                 for id_con, ind_con in zip(ids_con_tls_route, np.flatnonzero(inds_con_route)):
                     inds_cons_conflict_route |= inds_cons_conflict[id_con] & np.logical_not(inds_cons_merge[id_con])
                     inds_cons_merge_route |= inds_cons_merge[id_con]
-                print '      ids_con_alloc', ids_con_tls[inds_con_route]
-                print '      ids_con_confl', ids_con_tls[inds_cons_conflict_route]
-                print '      ids_con_merge', ids_con_tls[inds_cons_merge_route]
+                print('      ids_con_alloc', ids_con_tls[inds_con_route])
+                print('      ids_con_confl', ids_con_tls[inds_cons_conflict_route])
+                print('      ids_con_merge', ids_con_tls[inds_cons_merge_route])
                 routeconnectordata.append((ind_route, inds_con_route, prio,
                                            inds_cons_conflict_route, inds_cons_merge_route))
 
@@ -768,7 +768,7 @@ class TlsGenerator(netconvert.NetConvert
         for data in routeconnectordata:  # data is sorted by routecosts
             ind_tlsroute, inds_con_route, prio, inds_cons_conflict_route, inds_cons_merge_route = data
 
-            print '  ind_tlsroute', ind_tlsroute, 'c=%.1f' % routes_tls_cost[ind_tlsroute], 'ids_edge', routes_tls[ind_tlsroute]
+            print('  ind_tlsroute', ind_tlsroute, 'c=%.1f' % routes_tls_cost[ind_tlsroute], 'ids_edge', routes_tls[ind_tlsroute])
 
         # group non-conflicting routes
         n_routes = len(routeconnectordata)
@@ -790,7 +790,7 @@ class TlsGenerator(netconvert.NetConvert
         i_group = 0
         i_route = 0
         while i_route < n_routes:
-            print '  try i_route', i_route, phasegroups[i_route], phasegroups[i_route] == -1
+            print('  try i_route', i_route, phasegroups[i_route], phasegroups[i_route] == -1)
             if phasegroups[i_route] == -1:
 
                 phasegroups[i_route] = i_group
@@ -798,7 +798,7 @@ class TlsGenerator(netconvert.NetConvert
                     i_route]
 
                 #inds_cons_conflict_group = inds_cons_conflict.copy()
-                print '    Check group', i_group, 'for ind_tlsroute', ind_tlsroute, 'c=%.1f' % routes_tls_cost[ind_tlsroute]
+                print('    Check group', i_group, 'for ind_tlsroute', ind_tlsroute, 'c=%.1f' % routes_tls_cost[ind_tlsroute])
 
                 # print '     inds_cons_conflict',inds_cons_conflict
                 # check whether there are other, compatible
@@ -807,21 +807,21 @@ class TlsGenerator(netconvert.NetConvert
                 inds_confict_group = inds_cons_conflict_route.copy()
                 inds_merge_group = inds_cons_merge_route.copy()
                 prio_group = 1*prio
-                print '            init ids_confict_group=', ids_con_tls[inds_confict_group]
+                print('            init ids_confict_group=', ids_con_tls[inds_confict_group])
                 while j_route < n_routes:
                     if phasegroups[j_route] == -1:
                         # no phase group associated with
                         ind_tlsroute2, inds_con_route2, prio2, inds_cons_conflict_route2, inds_cons_merge_route2 = routeconnectordata[
                             j_route]
-                        print '      check with ind_tlsroute2', ind_tlsroute2, np.any(inds_cons_conflict_route2 & inds_con_route), np.any(inds_cons_conflict_route & inds_con_route2)
+                        print('      check with ind_tlsroute2', ind_tlsroute2, np.any(inds_cons_conflict_route2 & inds_con_route), np.any(inds_cons_conflict_route & inds_con_route2))
                         # print '        c',inds_con_route
                         # print '        x',inds_cons_conflict_route2
                         if (not np.any(inds_cons_conflict_route2 & inds_alloc_group)) & (not np.any(inds_confict_group & inds_con_route2)):
                             # no mutual conflict connections between route j_route
                             # and current route i_route
 
-                            print '         ids_cons_conflict_route2', ids_con_tls[inds_cons_conflict_route2]
-                            print '         inds_con_route          ', ids_con_tls[inds_con_route]
+                            print('         ids_cons_conflict_route2', ids_con_tls[inds_cons_conflict_route2])
+                            print('         inds_con_route          ', ids_con_tls[inds_con_route])
                             # make this route a part of the current group
                             phasegroups[j_route] = i_group
                             inds_confict_group |= inds_cons_conflict_route2
@@ -830,8 +830,8 @@ class TlsGenerator(netconvert.NetConvert
 
                             if prio2 > prio_group:
                                 prio_group = prio
-                            print '           group', phasegroups[j_route], ':put route', ind_tlsroute2, 'to route', ind_tlsroute
-                            print '             ids_confict_group=', ids_con_tls[inds_confict_group]
+                            print('           group', phasegroups[j_route], ':put route', ind_tlsroute2, 'to route', ind_tlsroute)
+                            print('             ids_confict_group=', ids_con_tls[inds_confict_group])
 
                     j_route += 1
 
@@ -847,7 +847,7 @@ class TlsGenerator(netconvert.NetConvert
         # debug:
         for i_group, data in zip(phasegroups, routeconnectordata):
             ind_tlsroute, inds_con_route, prio, inds_cons_conflict_route, inds_cons_merge_route = data
-            print '  i_group', i_group, 'ind_tlsroute', ind_tlsroute, 'ids_edge', routes_tls[ind_tlsroute]
+            print('  i_group', i_group, 'ind_tlsroute', ind_tlsroute, 'ids_edge', routes_tls[ind_tlsroute])
 
         # return
         # create signal phases
@@ -871,11 +871,11 @@ class TlsGenerator(netconvert.NetConvert
 
         # print '\n  **inds_cons_conflict',inds_cons_conflict
         if len(phasegroups) == 0:
-            print '  WARNING: a TLS without signal groups. Abandone.'
+            print('  WARNING: a TLS without signal groups. Abandone.')
             return
 
         for i_group, inds_alloc_groups, inds_confict_groups, inds_merge_groups, prio_group in zip(xrange(max(phasegroups)+1), inds_alloc_groups, inds_confict_groups, inds_merge_groups, prios_group):
-            print '    allocate slots for group', i_group
+            print('    allocate slots for group', i_group)
             phaseallocations.append(inds_alloc_groups)
 
             phaseconflicts.append(2*inds_confict_groups + 1 * (inds_merge_groups & np.logical_not(inds_confict_groups)))
@@ -891,13 +891,13 @@ class TlsGenerator(netconvert.NetConvert
         n_phase = len(phaseconflicts)
 
         if n_phase < 2:
-            print '  WARNING: a TLS with just one phase makes no sense. Abandone.'
+            print('  WARNING: a TLS with just one phase makes no sense. Abandone.')
             return
 
         if 1:  # debug
-            print '    Show phases n_phase', n_phase
+            print('    Show phases n_phase', n_phase)
             for i, inds_phaseconflict, prio in zip(xrange(n_phase), phaseconflicts, phasepriorities):
-                print '  phase', i, 'prio', prio
+                print('  phase', i, 'prio', prio)
                 #ids_con_conf_phase = ids_con_tls[inds_phaseconflict==2]
                 # print '    ids_con_conf_phase',ids_con_conf_phase
                 #ids_con_merge_phase = ids_con_tls[inds_phaseconflict==1]
@@ -906,9 +906,9 @@ class TlsGenerator(netconvert.NetConvert
                 ids_node_phase = set(ids_connodes[inds_phaseconflict > 0])
 
                 for id_node in ids_node_phase:
-                    print '    id_node', id_node
-                    print '      ids_conflicts', ids_con_tls[(inds_phaseconflict == 2) & (ids_connodes == id_node)]
-                    print '      ids_merge', ids_con_tls[(inds_phaseconflict == 1) & (ids_connodes == id_node)]
+                    print('    id_node', id_node)
+                    print('      ids_conflicts', ids_con_tls[(inds_phaseconflict == 2) & (ids_connodes == id_node)])
+                    print('      ids_merge', ids_con_tls[(inds_phaseconflict == 1) & (ids_connodes == id_node)])
 
         # make sure that all connetors between two edges have the equal signal
         for id_fromedge in set(ids_conedges_from):
@@ -943,7 +943,7 @@ class TlsGenerator(netconvert.NetConvert
         if 1:
             # go though all nodes of this TLS
             for id_node, nodeattrs in nodes_tls.iteritems():
-                print '    safecheck id_node', id_node, 'is_crossing', nodeattrs['is_crossing'], 'is_cycleped', nodeattrs['is_cycleped']
+                print('    safecheck id_node', id_node, 'is_crossing', nodeattrs['is_crossing'], 'is_cycleped', nodeattrs['is_cycleped'])
 
                 #nodeattrs['is_cycleped'] = is_cycleped
                 # nodeattrs['is_crossing'] =
@@ -959,14 +959,14 @@ class TlsGenerator(netconvert.NetConvert
 
                     for id_edge_from in nodeattrs['ids_cycleped_incoming']:  # nodes.ids_incoming[id_node]:
                         for id_edge_to in nodeattrs['ids_cycleped_outgoing']:
-                            print '      safecheck cycleped from edge %d to edge %d id_edge' % (id_edge_from, id_edge_to)
+                            print('      safecheck cycleped from edge %d to edge %d id_edge' % (id_edge_from, id_edge_to))
 
                             # connector index vector with all connectors for this edge
 
                             inds_con_edge = inds_con_node & (lanes.ids_edge[ids_fromlane_tls] == id_edge_from) & (
                                 lanes.ids_edge[ids_tolane_tls] == id_edge_to)
                             ids_con_edge = ids_con_tls[inds_con_edge]
-                            print '          ids_con_edge', ids_con_edge, np.any(inds_con_edge)
+                            print('          ids_con_edge', ids_con_edge, np.any(inds_con_edge))
                             if np.any(inds_con_edge):
                                 # get conflicts for these connections
                                 for id_con, ind_con in zip(ids_con_edge, np.flatnonzero(inds_con_edge)):
@@ -975,9 +975,9 @@ class TlsGenerator(netconvert.NetConvert
                                     #                    conflicts                valid           to connector does NOT point to toedge
                                     inds_con_check |= inds_cons_conflict[id_con] & are_enabeled & (
                                         lanes.ids_edge[ids_tolane_tls] != id_edge_to)
-                                    print '          id_con %d: inds_con_check' % id_con, ids_con_tls[inds_con_check]
+                                    print('          id_con %d: inds_con_check' % id_con, ids_con_tls[inds_con_check])
 
-                    print '        ids_con_check', ids_con_tls[inds_con_check]
+                    print('        ids_con_check', ids_con_tls[inds_con_check])
 
                     # check if there is a dedicated phase with assigned
                     # cycleped edges
@@ -987,7 +987,7 @@ class TlsGenerator(netconvert.NetConvert
 
                         if is_alloc_allgreen:
                             # cycleped path is allocated, so make all conflicts red
-                            print '      found cycleped green phase', i
+                            print('      found cycleped green phase', i)
 
                             # make all conflicting red, but this should already
                             # be the case
@@ -1010,7 +1010,7 @@ class TlsGenerator(netconvert.NetConvert
                         # and make cycleped green only in phase i_red
                         # when conflicts are all red
                         for i, prio in zip(xrange(n_phase), phasepriorities):
-                            print '          adjust phase', i, 'green', i == i_red
+                            print('          adjust phase', i, 'green', i == i_red)
                             if i == i_red:
                                 phaseconflicts[i][inds_con_node] = 0
                             else:
@@ -1022,7 +1022,7 @@ class TlsGenerator(netconvert.NetConvert
 
                     # go through all incoming edges of this node
                     for id_edge in nodes.ids_incoming[id_node]:
-                        print '      safecheck icoming id_edge', id_edge
+                        print('      safecheck icoming id_edge', id_edge)
 
                         # connector index vector with all connectors for this edge
                         inds_con_node = (ids_connodes == id_node) & are_enabeled
@@ -1042,7 +1042,7 @@ class TlsGenerator(netconvert.NetConvert
 
                                 # if id_con is green, then these must be red in all phases
                                 inds_con_confcheck = inds_cons_conflict[id_con]
-                                print '\n        safecheck id_con', id_con, 'ids_con_confcheck', ids_con_tls[inds_con_confcheck]
+                                print('\n        safecheck id_con', id_con, 'ids_con_confcheck', ids_con_tls[inds_con_confcheck])
 
                                 # go through all phases
                                 for i, prio in zip(xrange(n_phase), phasepriorities):
@@ -1051,7 +1051,7 @@ class TlsGenerator(netconvert.NetConvert
 
                                     inds_noconf = phaseconflicts[i] == 0
                                     inds_noconf_last = phaseconflicts[i-1] == 0
-                                    print '          safecheck phase', i, 'inds_noconf', inds_noconf[ind_con], 'inds_noconf_last', inds_noconf_last[ind_con]
+                                    print('          safecheck phase', i, 'inds_noconf', inds_noconf[ind_con], 'inds_noconf_last', inds_noconf_last[ind_con])
 
                                     if inds_noconfmerge[ind_con]:  # no red at ind_con
 
@@ -1066,7 +1066,7 @@ class TlsGenerator(netconvert.NetConvert
 
                                         # ambiguous cons = green cons inds & inds where cons should be red
                                         inds_con_ambiqu = inds_noconf & (inds_con_confcheck > 0) & are_enabeled
-                                        print '            inds_con_ambiqu', ids_con_tls[inds_con_ambiqu], 'resolve ambig', (inds_noconf_last[ind_con]) & np.any(inds_con_ambiqu)
+                                        print('            inds_con_ambiqu', ids_con_tls[inds_con_ambiqu], 'resolve ambig', (inds_noconf_last[ind_con]) & np.any(inds_con_ambiqu))
 
                                         # any ambiguous connector found?
                                         if np.any(inds_con_ambiqu):
@@ -1082,10 +1082,10 @@ class TlsGenerator(netconvert.NetConvert
                                                 # of connectors, it can happen
                                                 # that allocated connectors are in conflict
                                                 if np.any(phaseallocations[i][inds_con_ambiqu]):
-                                                    print '            set thiscon', id_con, 'to red, instead of allocated.'
+                                                    print('            set thiscon', id_con, 'to red, instead of allocated.')
                                                     phaseconflicts[i][ind_con] = 2
                                                 else:
-                                                    print '            set confcons', ids_con_tls[inds_con_ambiqu], 'to red'
+                                                    print('            set confcons', ids_con_tls[inds_con_ambiqu], 'to red')
                                                     phaseconflicts[i][inds_con_ambiqu] = 2
 
                                                 # for ind_con_ambiqu, raw in zip(inds_con_ambiqu, phaseconflicts[i][inds_con_ambiqu]):
@@ -1094,13 +1094,13 @@ class TlsGenerator(netconvert.NetConvert
                                                 # during the last phase this signal
                                                 # has been red so let it red
                                                 # these should be blocked!!
-                                                print '            set thiscon', id_con, 'to red'
+                                                print('            set thiscon', id_con, 'to red')
                                                 phaseconflicts[i][ind_con] = 2
                                                 #self.block_connection(ind_con, 2 , phaseconflicts[i], ids_fromlane_tls, ids_tolane_tls, ids_con_tls,are_enabeled)
                                         else:
-                                            print '            no ambiguity.'
+                                            print('            no ambiguity.')
                                     else:
-                                        print '            signal is already red. Try make it green'
+                                        print('            signal is already red. Try make it green')
                                         # make signal green, if signal has been green in the past and
                                         # if all conflicting connectors are red
                                         #inds_con_ambiqu = (phaseconflicts[i] == 2) & (inds_con_confcheck>0) & are_enabeled
@@ -1108,9 +1108,9 @@ class TlsGenerator(netconvert.NetConvert
                                             phaseconflicts[i][ind_con] = 0
 
         if 0:  # debug
-            print '  After safetycheck: Show phases n_phase', n_phase
+            print('  After safetycheck: Show phases n_phase', n_phase)
             for i, inds_phaseconflict, prio in zip(xrange(n_phase), phaseconflicts, phasepriorities):
-                print '   phase', i, 'prio', prio
+                print('   phase', i, 'prio', prio)
                 #ids_con_conf_phase = ids_con_tls[inds_phaseconflict==2]
                 # print '    ids_con_conf_phase',ids_con_conf_phase
                 #ids_con_merge_phase = ids_con_tls[inds_phaseconflict==1]
@@ -1119,9 +1119,9 @@ class TlsGenerator(netconvert.NetConvert
                 ids_node_phase = set(ids_connodes[inds_phaseconflict > 0])
 
                 for id_node in ids_node_phase:
-                    print '    id_node', id_node
-                    print '      ids_conflicts', ids_con_tls[(inds_phaseconflict == 2) & (ids_connodes == id_node)]
-                    print '      ids_merge', ids_con_tls[(inds_phaseconflict == 1) & (ids_connodes == id_node)]
+                    print('    id_node', id_node)
+                    print('      ids_conflicts', ids_con_tls[(inds_phaseconflict == 2) & (ids_connodes == id_node)])
+                    print('      ids_merge', ids_con_tls[(inds_phaseconflict == 1) & (ids_connodes == id_node)])
 
         # push red signs back over short edges
         if 1:
@@ -1132,7 +1132,7 @@ class TlsGenerator(netconvert.NetConvert
                 slots_raw = phaseconflicts[i]
                 # index with all merge and red signals
                 inds = np.flatnonzero(slots_raw == 2)
-                print '\n      Phase', i, 'block ids_con', ids_con_tls[inds]
+                print('\n      Phase', i, 'block ids_con', ids_con_tls[inds])
                 # print '              red  ',ids_con_tls[phaseconflicts[i]==2]
                 # print '              merge',ids_con_tls[phaseconflicts[i]==1]
                 # go though all connectors with merge and red signals
@@ -1144,9 +1144,9 @@ class TlsGenerator(netconvert.NetConvert
                 phaseconflicts[i] = slots
 
         if 1:  # debug
-            print '  After push back reds: Show phases n_phase', n_phase
+            print('  After push back reds: Show phases n_phase', n_phase)
             for i, inds_phaseconflict, prio in zip(xrange(n_phase), phaseconflicts, phasepriorities):
-                print '   phase', i, 'prio', prio
+                print('   phase', i, 'prio', prio)
                 #ids_con_conf_phase = ids_con_tls[inds_phaseconflict==2]
                 # print '    ids_con_conf_phase',ids_con_conf_phase
                 #ids_con_merge_phase = ids_con_tls[inds_phaseconflict==1]
@@ -1155,14 +1155,14 @@ class TlsGenerator(netconvert.NetConvert
                 ids_node_phase = set(ids_connodes[inds_phaseconflict > 0])
 
                 for id_node in ids_node_phase:
-                    print '    id_node', id_node
-                    print '      ids_conflicts', ids_con_tls[(inds_phaseconflict == 2) & (ids_connodes == id_node)]
-                    print '      ids_merge', ids_con_tls[(inds_phaseconflict == 1) & (ids_connodes == id_node)]
+                    print('    id_node', id_node)
+                    print('      ids_conflicts', ids_con_tls[(inds_phaseconflict == 2) & (ids_connodes == id_node)])
+                    print('      ids_merge', ids_con_tls[(inds_phaseconflict == 1) & (ids_connodes == id_node)])
 
         # create traffic light system in SUMO net
         n_phase = len(phaseconflicts)
         if n_phase <= 1:
-            print '   Less than one phase => abbandon.'
+            print('   Less than one phase => abbandon.')
             return False
 
         inds_con_controlled = np.zeros(n_cons, dtype=np.bool)
@@ -1226,13 +1226,13 @@ class TlsGenerator(netconvert.NetConvert
         inds_con_sumotls = np.flatnonzero(inds_con_off | inds_con_controlled)
         ids_con_sumotls = ids_con_tls[inds_con_sumotls]
 
-        print '  ids_con_notls', ids_con_tls[inds_con_notls]
-        print '  are_enabeled', ids_con_tls[are_enabeled]
-        print '  ids_con_controlled', ids_con_tls[inds_con_controlled]
-
-        print '  ids_node_sumotls', ids_node_sumotls
-        print '  ids_con_sumotls', ids_con_sumotls
-        print '  ids_con_off', ids_con_tls[inds_con_off]
+        print('  ids_con_notls', ids_con_tls[inds_con_notls])
+        print('  are_enabeled', ids_con_tls[are_enabeled])
+        print('  ids_con_controlled', ids_con_tls[inds_con_controlled])
+
+        print('  ids_node_sumotls', ids_node_sumotls)
+        print('  ids_con_sumotls', ids_con_sumotls)
+        print('  ids_con_off', ids_con_tls[inds_con_off])
 
         #n_cons_sumotls = len(inds_con_sumotls)
         states = []
@@ -1262,7 +1262,7 @@ class TlsGenerator(netconvert.NetConvert
         states_sumotls = []
         for state in states:
             states_sumotls.append(string.join(signals[state], ''))
-            print '    state=', states_sumotls[-1]
+            print('    state=', states_sumotls[-1])
 
         id_tls = tlss.suggest_id()
         weights = np.array(weights, dtype=np.float32)
@@ -1308,7 +1308,7 @@ class TlsGenerator(netconvert.NetConvert
         ids_con_tls_route = ids_con_tls[inds_con_route]
         for id_con, ind_con in zip(ids_con_tls_route, np.flatnonzero(inds_con_route)):
 
-            print '\ninit_slots for id_con', id_con  # ,ids_con_tls[ind_con],ind_con
+            print('\ninit_slots for id_con', id_con)  # ,ids_con_tls[ind_con],ind_con
             # print '  inds_cons_conflict\n',inds_cons_conflict[id_con]
             # print '  inds_cons_merge\n',inds_cons_merge[id_con]
 
@@ -1321,7 +1321,7 @@ class TlsGenerator(netconvert.NetConvert
             slots_raw = 2*(inds_cons_conflict[id_con] &
                            np.logical_not(inds_cons_merge[id_con])) + 1 * inds_cons_merge[id_con]
             inds = np.flatnonzero(slots_raw)
-            print '    block', ids_con_tls[inds]
+            print('    block', ids_con_tls[inds])
             for ind_confl, slot_raw in zip(inds, slots_raw[inds]):
                 self.block_connection(ind_confl, slot_raw, slots, ids_fromlane_tls,
                                       ids_tolane_tls, ids_con_tls, are_enabeled)
@@ -1344,8 +1344,8 @@ class TlsGenerator(netconvert.NetConvert
         #        inds_con_crit = inds_con_conf_check & np.logical_not(slots_blocked>0)
         #        inds_con_crit = inds_con_crit & are_enabeled
         #
-        print '  =>3stopslots for cons\n', ids_con_tls[slots == 2]
-        print '  =>3mergeslots for cons\n', ids_con_tls[slots == 1]
+        print('  =>3stopslots for cons\n', ids_con_tls[slots == 2])
+        print('  =>3mergeslots for cons\n', ids_con_tls[slots == 1])
 
         return slots, slots_blocked
 
@@ -1362,11 +1362,11 @@ class TlsGenerator(netconvert.NetConvert
 
         id_fromlane = ids_fromlane_tls[ind_con_block]
         is_disabled = not are_enabeled[ind_con_block]
-        print 'block_connection id %d id_fromlane %d' % (ids_con_tls[ind_con_block], id_fromlane), 'nocycleped', lanes.ids_mode[ids_fromlane_tls[ind_con_block]] not in self.ids_cycleped, 'slot', slots[ind_con_block], 'L=%dm' % edges.lengths[lanes.ids_edge[id_fromlane]],
+        print('block_connection id %d id_fromlane %d' % (ids_con_tls[ind_con_block], id_fromlane), 'nocycleped', lanes.ids_mode[ids_fromlane_tls[ind_con_block]] not in self.ids_cycleped, 'slot', slots[ind_con_block], 'L=%dm' % edges.lengths[lanes.ids_edge[id_fromlane]],)
 
         if (slots[ind_con_block] > 0) | is_disabled:
             # ind_con_block has already been tuned to red
-            print '*'
+            print('*')
             return
 
         # do not block accross cycleped edges
@@ -1383,27 +1383,27 @@ class TlsGenerator(netconvert.NetConvert
                 if (len(inds_con) > 0) & np.all(slots[inds_con] >= 0):
                     slots[ind_con_block] = -1  # sign as visited
                     print
-                    print '->', ids_con_tls[inds_con]
+                    print('->', ids_con_tls[inds_con])
 
                     for ind_con in inds_con:
                         self.block_connection(ind_con, 2, slots, ids_fromlane_tls,
                                               ids_tolane_tls, ids_con_tls, are_enabeled)
-                    print '.'
+                    print('.')
                     slots[ind_con_block] = 0  # remove sign as visited
 
                 else:
                     # from lane is connected from outside the TLS:
                     slots[ind_con_block] = 2  # put red light
-                    print '-r'
+                    print('-r')
             else:
                 # road length acceptable
                 slots[ind_con_block] = slot_raw
-                print '-s', slot_raw
+                print('-s', slot_raw)
 
         else:
             # to lane is bikeway or footpath
             slots[ind_con_block] = slot_raw
-            print '-b', slot_raw
+            print('-b', slot_raw)
 
         # print '    stopslots %d for cons\n'%ids_con_tls[ind_con_block],ids_con_tls[slots == 2]
         # print '    mergeslots %d for cons\n'%ids_con_tls[ind_con_block],ids_con_tls[slots == 1]
@@ -1418,7 +1418,7 @@ class TlsGenerator(netconvert.NetConvert
         Allocates a phase for a particular route though the TLS.
         The route is represented by the connector indexes along the route.
         """
-        print '\nadd_timeslot for', ids_con_tls[inds_con_route]
+        print('\nadd_timeslot for', ids_con_tls[inds_con_route])
         # go through all connections used by this route and
         # signalize all conflicts
         # for id_con in ids_con_tls[inds_con_route]:
@@ -1432,40 +1432,40 @@ class TlsGenerator(netconvert.NetConvert
                                                ids_tolane_tls,
                                                are_enabeled)
         n_slots = len(np.flatnonzero(slots))
-        print '    n_slots', n_slots, 'n_phases', len(phaseconflicts)
+        print('    n_slots', n_slots, 'n_phases', len(phaseconflicts))
 
         if n_slots == 0:
-            print '  no  conflicts detected'
+            print('  no  conflicts detected')
             pass
 
         elif len(phaseconflicts) == 0:
-            print '  append first phase'
+            print('  append first phase')
             phaseallocations.append(inds_con_route)
             phaseconflicts.append(slots)
             phaseblocks.append(slots_blocked)
             phasepriorities.append(prio)
         else:
-            print '  search phase with minimum signal difference n_phases=', len(phaseallocations)
+            print('  search phase with minimum signal difference n_phases=', len(phaseallocations))
             n_diff_min = 10**8
             i_phase = 0
             i_phase_min = -1
             for inds_phaseallocation, inds_phaseconflict in zip(phaseallocations, phaseconflicts):
                 # check if slots overlap with allocated connections this phase
-                print '    compare phase', i_phase
-                print '      new  allocations', ids_con_tls[inds_con_route]
-                print '      phaseallocations', ids_con_tls[inds_phaseallocation]
-                print '      new    conflicts', ids_con_tls[slots == 2]
-                print '      phase  conflicts', ids_con_tls[inds_phaseconflict == 2]
+                print('    compare phase', i_phase)
+                print('      new  allocations', ids_con_tls[inds_con_route])
+                print('      phaseallocations', ids_con_tls[inds_phaseallocation])
+                print('      new    conflicts', ids_con_tls[slots == 2])
+                print('      phase  conflicts', ids_con_tls[inds_phaseconflict == 2])
                 # print '      allocations',ids_con_tls[inds_phaseallocation]
-                print '      n_diff =', np.sum(np.any((slots == 2) & inds_phaseallocation))
+                print('      n_diff =', np.sum(np.any((slots == 2) & inds_phaseallocation)))
 
                 if not np.any((slots == 2) & inds_phaseallocation):
-                    print '    no conflict in this phase go for a merge'
+                    print('    no conflict in this phase go for a merge')
                     i_phase_min = i_phase
                     n_diff_min = -1  # indicate phase merge
 
                 else:
-                    print '    there are conflicts with this phase...count'
+                    print('    there are conflicts with this phase...count')
                     n_diff = np.sum(np.any((slots == 2) & inds_phaseallocation))
                     #n_diff = np.sum(np.abs(slots - inds_phaseconflict)!=0)
                     # print '    ',inds_phaseconflict,n_diff
@@ -1475,14 +1475,14 @@ class TlsGenerator(netconvert.NetConvert
 
                 i_phase += 1
 
-            print '    finished comparing phases i_phase_min,n_diff_min', i_phase_min, n_diff_min
+            print('    finished comparing phases i_phase_min,n_diff_min', i_phase_min, n_diff_min)
 
             if n_diff_min == 0:
-                print '  already a phase with suitable signalling, nothing to do'
+                print('  already a phase with suitable signalling, nothing to do')
                 pass
 
             elif n_diff_min == -1:
-                print '  there are no phase conflicts, so merge'
+                print('  there are no phase conflicts, so merge')
                 phaseallocations[i_phase_min] = phaseallocations[i_phase_min] | inds_con_route
                 phaseconflicts[i_phase_min] = np.max([slots, phaseconflicts[i_phase_min]], 0)
                 phaseblocks[i_phase_min] = phaseblocks[i_phase_min] | slots_blocked
@@ -1498,14 +1498,14 @@ class TlsGenerator(netconvert.NetConvert
                 # get number of cons which are less restrictive signals
                 n_diff_neg = np.sum((slots - phaseconflicts[i_phase_min]) < 0)
 
-                print '  n_diff_min', n_diff_min, 'n_diff_pos', n_diff_pos, 'n_diff_neg', n_diff_neg, 'i_phase_min', i_phase_min
+                print('  n_diff_min', n_diff_min, 'n_diff_pos', n_diff_pos, 'n_diff_neg', n_diff_neg, 'i_phase_min', i_phase_min)
                 # print '  inds_phaseconflict_min',ids_con_tls[phaseconflicts[i_phase_min] >0]
                 # print '  inds_phaseconflict',ids_con_tls[slots>0]
                 #inds_diff = np.abs(slots - inds_phaseconflict)!=0
                 # if (n_diff_pos>0) & (n_diff_neg == 0):
                 if (n_diff_pos >= n_diff_neg) & (n_diff_pos <= 2):
                     # only more restrictive
-                    print '    put new phase after the phase with minimum difference'
+                    print('    put new phase after the phase with minimum difference')
                     phaseallocations.insert(i_phase_min+1, inds_con_route)
                     phaseconflicts.insert(i_phase_min+1, slots)
                     phaseblocks.insert(i_phase_min+1, slots_blocked)
@@ -1514,7 +1514,7 @@ class TlsGenerator(netconvert.NetConvert
                 # elif (n_diff_pos==0) & (n_diff_neg > 0):
                 if (n_diff_pos < n_diff_neg) & (n_diff_neg <= 2):
                     # only less restrictive
-                    print '    put new phase before the phase with minimum difference'
+                    print('    put new phase before the phase with minimum difference')
                     phaseallocations.insert(i_phase_min, inds_con_route)
                     phaseconflicts.insert(i_phase_min, slots)
                     phaseblocks.insert(i_phase_min, slots_blocked)
@@ -1522,13 +1522,13 @@ class TlsGenerator(netconvert.NetConvert
 
                 else:
                     # mixed changes
-                    print '    append en entirely new phase'
+                    print('    append en entirely new phase')
                     phaseconflicts.append(slots)
                     phaseblocks.append(slots_blocked)
                     phasepriorities.append(prio)
 
     def init_tlsnode(self, id_node, nodes_tls):
-        print 'init_tlsnode', id_node, 'is in TLS'
+        print('init_tlsnode', id_node, 'is in TLS')
         nodeattrs = {}
         if id_node in self.ids_majornodes:
             self.ids_majornodes_used.add(id_node)
@@ -1543,7 +1543,7 @@ class TlsGenerator(netconvert.NetConvert
         nodes_tls[id_node] = nodeattrs
 
     def find_neighbour_nodes(self, id_node, dist, nodes_tls, edges, nodes):
-        print 'find_neighbour_nodes', id_node, dist
+        print('find_neighbour_nodes', id_node, dist)
         dist_tls_max = self.dist_tls_max
         #ids_edge = nodes.ids_outgoing[id_node]
 
@@ -1556,23 +1556,23 @@ class TlsGenerator(netconvert.NetConvert
                 if len(ids_edge_out) == 1:
                     # one incoming one outgoing only, check if bidir link
                     if edges.ids_fromnode[ids_edge[0]] == edges.ids_tonode[ids_edge_out[0]]:
-                        print '  it is a turnaround only node -> remove node', id_node
+                        print('  it is a turnaround only node -> remove node', id_node)
                         del nodes_tls[id_node]
                         return
             elif len(ids_edge) == 0:  # no input??
-                print '  no input -> remove node', id_node
+                print('  no input -> remove node', id_node)
                 del nodes_tls[id_node]
                 return
 
             for id_edge, length, id_edgenode in zip(ids_edge, edges.lengths[ids_edge], edges.ids_fromnode[ids_edge]):
-                print '    check in id_edge', id_edge, dist+length, dist_tls_max, (dist+length < dist_tls_max), (length < self.dist_tls_internode_max)
+                print('    check in id_edge', id_edge, dist+length, dist_tls_max, (dist+length < dist_tls_max), (length < self.dist_tls_internode_max))
                 if (dist+length < dist_tls_max) & (length < self.dist_tls_internode_max):
                     if id_edgenode not in nodes_tls:
                         self.init_tlsnode(id_edgenode, nodes_tls)
                         self.find_neighbour_nodes(id_edgenode, dist+length, nodes_tls, edges, nodes)
         else:
             # node without incoming??
-            print '  node without incoming -> remove node', id_node
+            print('  node without incoming -> remove node', id_node)
             del nodes_tls[id_node]
             return
 
@@ -1602,7 +1602,7 @@ class TlsGenerator(netconvert.NetConvert
         that no turnarounds are used,
         and for not major routes that the route follows a straight line.
         """
-        print 'correct_tls_route', route
+        print('correct_tls_route', route)
         net = self.parent
         edges = net.edges
         #ids_edges_major = self.ids_edges_major
@@ -1652,7 +1652,7 @@ class TlsGenerator(netconvert.NetConvert
             # determine angle change
             angle = get_diff_angle_clockwise(dir1, dir2)
             angle_abs = min(angle, 2*np.pi-angle)
-            print '      id_edge:%d, angle_abs:%.1f, angle_max: %.1f' % (id_edge, angle_abs/np.pi*180, angle_max/np.pi*180), id_fromnode in nodes_tls, (angle_abs < angle_max)
+            print('      id_edge:%d, angle_abs:%.1f, angle_max: %.1f' % (id_edge, angle_abs/np.pi*180, angle_max/np.pi*180), id_fromnode in nodes_tls, (angle_abs < angle_max))
             if id_fromnode in nodes_tls:
                 # route is still in TLS
                 p01 = shape_curr[-2][:2]
@@ -1688,11 +1688,11 @@ class TlsGenerator(netconvert.NetConvert
             newroutes.append(newroute)
             routecosts.append(self.get_routecost(newroute))
 
-        print '    ind_route', ind_route, len(route), 'newroutes', newroutes, 'routecosts', routecosts
+        print('    ind_route', ind_route, len(route), 'newroutes', newroutes, 'routecosts', routecosts)
         return newroutes, routecosts
 
     def follow_major_route_backward(self, id_edge_next, shape):
-        print 'follow_major_route_backward', id_edge_next
+        print('follow_major_route_backward', id_edge_next)
         net = self.parent
         edges = net.edges
         ids_edges_major = self.ids_edges_major
@@ -1787,7 +1787,7 @@ class TlsGenerator(netconvert.NetConvert
         return route
 
     def follow_major_route_foreward(self, id_edge_next, shape):
-        print 'follow_major_route_foreward', id_edge_next
+        print('follow_major_route_foreward', id_edge_next)
         net = self.parent
         edges = net.edges
         ids_edges_major = self.ids_edges_major
@@ -1833,7 +1833,7 @@ class TlsGenerator(netconvert.NetConvert
                     angle = get_diff_angle_clockwise(dir1, dir2)
                     angle_abs = min(angle, 2*np.pi-angle)
                     edgedirection2 = shape[:2]
-                    print '      |angle|=%d' % (angle_abs/np.pi*180), angle/np.pi*180, dir1, dir2
+                    print('      |angle|=%d' % (angle_abs/np.pi*180), angle/np.pi*180, dir1, dir2)
 
                     if angle_abs < angle_max:
                         if id_edge not in self.ids_edges_major:
@@ -1874,7 +1874,7 @@ class TlsGenerator(netconvert.NetConvert
                 p01 = shape_next[-2][:2]
                 p11 = shape_next[-1][:2]
                 dir1 = p11-p01
-                print '    **winner:', id_edge_next, 'dir1=', dir1
+                print('    **winner:', id_edge_next, 'dir1=', dir1)
                 route.append(id_edge_next)
                 ids_edges_major.add(id_edge_next)
 
@@ -1887,7 +1887,7 @@ class TlsGenerator(netconvert.NetConvert
 
 class BikenetworkCompleter(Process):
     def __init__(self,  net, logger=None, **kwargs):
-        print 'Bikenetworkcompleter.__init__'
+        print('Bikenetworkcompleter.__init__')
         self._init_common('bikenetworkcompleter',
                           parent=net,
                           name='Bike network completer',
@@ -1959,7 +1959,7 @@ class BikenetworkCompleter(Process):
             [modes.get_id_mode("pedestrian"), modes.get_id_mode("delivery"), modes.get_id_mode("bus")])
 
     def do(self):
-        print 'BikenetworkCompleter.do'
+        print('BikenetworkCompleter.do')
         edges = self.parent.edges
         nodes = self.parent.nodes
         lanes = self.parent.lanes
@@ -2187,7 +2187,7 @@ class BikenetworkCompleter(Process):
 
 class TlsjunctionGenerator_old(netconvert.NetConvertMixin):
     def __init__(self,  net, logger=None, **kwargs):
-        print 'TlsjunctionGenerator.__init__'
+        print('TlsjunctionGenerator.__init__')
         self._init_common('tlsjunctiongenerator',
                           parent=net,
                           name='Trafficlight Junction generator',
@@ -2215,7 +2215,7 @@ class TlsjunctionGenerator_old(netconver
                                                  ))
 
     def do(self):
-        print 'TlsjunctionGenerator.do'
+        print('TlsjunctionGenerator.do')
         net = self.parent
         edges = self.parent.edges
         nodes = self.parent.nodes
--- a/tools/contributed/sumopy/coremodules/network/networkxtools.py
+++ b/tools/contributed/sumopy/coremodules/network/networkxtools.py
@@ -63,7 +63,7 @@ def load_objfile(filepath):
     try:
         f = open(filepath, 'rb')
     except:
-        print 'WARNING in load_obj: could not open', filepath
+        print('WARNING in load_obj: could not open', filepath)
         return None
 
     # try:
@@ -75,17 +75,17 @@ def load_objfile(filepath):
 
 def print_attrs(attrs):
     for key, val in attrs.iteritems():
-        print '    %s=\t%s' % (key, val)
+        print('    %s=\t%s' % (key, val))
     print
 
 
 def get_loop(digraph, ids_node, ids_nodepairs=[], n_node_max=4):
-    print 'get_loop ids_node', ids_node
+    print('get_loop ids_node', ids_node)
     if (ids_node[-1] == ids_node[0]):
-        print '    success.'
+        print('    success.')
         return ids_nodepairs
     elif (len(ids_node) == n_node_max):
-        print '    no loop reached.'
+        print('    no loop reached.')
         return []
     else:
         id_node = ids_node[-1]
@@ -106,11 +106,11 @@ def get_loop(digraph, ids_node, ids_node
 
         id_nbnode_new = node['dirind_to_node'][ind]
         if id_nbnode == id_nbnode_new:
-            print '  simple bidir return link'
+            print('  simple bidir return link')
             return []
 
         elif abs(id_nbnode_new) in ids_node[1:]:
-            print '  complex bidir return link'
+            print('  complex bidir return link')
             return []
 
         if id_nbnode_new < 0:
@@ -166,7 +166,7 @@ class Road:
         """
         Make defaults to be overridden
         """
-        print 'config'
+        print('config')
         # pass here either road type specific defaults
         # or global defaults from parent process
 
@@ -272,7 +272,7 @@ class Road:
     def make_sumoattrs(self):
 
         osmattrs = self._osmattrs
-        print 'make_sumoattrs'
+        print('make_sumoattrs')
         print_attrs(osmattrs)
         #self._highway = osmattrs.get('highway','road')
 
@@ -386,7 +386,7 @@ class Road:
         self._n_lane_forward_osm = n_lane_forward_osm
         self._n_lane_backward_osm = n_lane_backward_osm
         self._n_lane_osm = n_lane_osm
-        print '  lane numbers: n_lane_forward_osm=%d, n_lane_backward_osm=%d n_default=%d' % (n_lane_forward_osm, n_lane_backward_osm, self.n_lane), 'rigid fb', is_lanes_forward_rigid, is_lanes_backward_rigid
+        print('  lane numbers: n_lane_forward_osm=%d, n_lane_backward_osm=%d n_default=%d' % (n_lane_forward_osm, n_lane_backward_osm, self.n_lane), 'rigid fb', is_lanes_forward_rigid, is_lanes_backward_rigid)
 
     def _get_access(self, access_str):
         access_data = np.array(access_str.split('|'), dtype=np.object)[::-1]
@@ -446,12 +446,12 @@ class Road:
 
         #lanes = []
         #lanes_opp = []
-        print '  realoneway', self.is_oneway()
+        print('  realoneway', self.is_oneway())
 
         #self._lanes = []
         #self._lanes_opp = []
 
-        print '  Main Dir ^^^^^^^^^^^', self._is_lanes_forward_rigid, self._is_lanes_backward_rigid
+        print('  Main Dir ^^^^^^^^^^^', self._is_lanes_forward_rigid, self._is_lanes_backward_rigid)
         if self._is_lanes_forward_rigid:
             self.make_lanes_rigid(is_opp=False, n_lane_osm=self._n_lane_forward_osm)
         else:
@@ -459,15 +459,15 @@ class Road:
 
         if not self.is_oneway():
 
-            print '  Opp  Dir vvvvvvvvvvv'
+            print('  Opp  Dir vvvvvvvvvvv')
             if self._is_lanes_backward_rigid:
                 self.make_lanes_rigid(is_opp=True, n_lane_osm=self._n_lane_backward_osm)
             else:
                 self.make_lanes(is_opp=True, n_lane_osm=self._n_lane_backward_osm)
 
-        print '  id', id(self)
-        print '  len(self._lanes)', len(self._lanes)
-        print '  len(self._lanes_opp)', len(self._lanes_opp)
+        print('  id', id(self))
+        print('  len(self._lanes)', len(self._lanes))
+        print('  len(self._lanes_opp)', len(self._lanes_opp))
 
     def _get_speedinfo(self, speed_max_str):
         speed_max_data = speed_max_str.split(' ')
@@ -607,7 +607,7 @@ class Road:
         else:
             ind = 1
 
-        print 'add_sidewalk', is_opp, self._sidewalkattrs[ind]['n_lane'], self._sidewalkattrs[ind]['n_lane'] == 0
+        print('add_sidewalk', is_opp, self._sidewalkattrs[ind]['n_lane'], self._sidewalkattrs[ind]['n_lane'] == 0)
         if self._sidewalkattrs[ind]['n_lane'] == 0:
             self.make_sidewalk(is_opp=is_opp, is_rightside=True, width=road.lanewidth)
             self.make_road()
@@ -629,7 +629,7 @@ class Road:
         #  to mark that sidewalks are mapped separately.
         # Also, sidewalk=separate
 
-        print 'make_sidewalk', ind, is_rightside
+        print('make_sidewalk', ind, is_rightside)
         # needed to merge access?
         self._sidewalkattrs[ind]['is_share'] = len(ids_modes_allow) > 0
 
@@ -657,7 +657,7 @@ class Road:
         print_attrs(self._sidewalkattrs[ind])
 
     def make_sidewalkattrs(self):
-        print 'make_sidewalkattrs'
+        print('make_sidewalkattrs')
 
         if self.get_priority() < 7:
             return self.make_sidewalkattrs_smallroads()
@@ -665,7 +665,7 @@ class Road:
             return self.make_sidewalkattrs_largeroads()
 
     def make_sidewalkattrs_largeroads(self):
-        print 'make_sidewalkattrs_largeroads'
+        print('make_sidewalkattrs_largeroads')
 
         osmattrs = self._osmattrs
         self._sidewalkattrs = (deepcopy(LANEATTRS_DEFAULT),
@@ -742,7 +742,7 @@ class Road:
         #        print_attrs(attrs)
 
     def make_sidewalkattrs_smallroads(self):
-        print 'make_sidewalkattrs_smallroads'
+        print('make_sidewalkattrs_smallroads')
         osmattrs = self._osmattrs
         self._sidewalkattrs = (deepcopy(LANEATTRS_DEFAULT),
                                deepcopy(LANEATTRS_DEFAULT))
@@ -808,20 +808,20 @@ class Road:
             if self.is_oneway():
 
                 if osmattrs.get('junction', '') == 'roundabout':
-                    print '  put a sidewalk around roundabouts, not inside'
+                    print('  put a sidewalk around roundabouts, not inside')
                     self.make_sidewalk(is_opp=False, is_rightside=True, width=self.width_sidewalk)
                 else:
-                    print '  put a sidewalk on both sides of the oneway'
+                    print('  put a sidewalk on both sides of the oneway')
                     self.make_sidewalk(is_opp=False, is_rightside=True, width=self.width_sidewalk)
                     self.make_sidewalk(is_opp=False, is_rightside=False, width=self.width_sidewalk)
             else:
-                print '    put a sidewalk on both sides of the road'
+                print('    put a sidewalk on both sides of the road')
                 self.make_sidewalk(is_opp=False, is_rightside=True, width=self.width_sidewalk)
                 self.make_sidewalk(is_opp=True, is_rightside=True, width=self.width_sidewalk)
 
     def make_bikelane(self, is_opp=False, is_rightside=True,
                       ids_modes_allow=[], width=1.5, n_lane=1):
-        print 'make_bikelane', is_opp, is_rightside, ids_modes_allow
+        print('make_bikelane', is_opp, is_rightside, ids_modes_allow)
         if is_opp:
             ind = 0
         else:
@@ -857,7 +857,7 @@ class Road:
                 widths:  is a tuple with sidewalk widths of left and right sidewalk.
                 if values are less than 0 means no sidewalk.
         """
-        print 'make_bikewayattrs'
+        print('make_bikewayattrs')
         self._bikewayattrs = (deepcopy(LANEATTRS_DEFAULT),
                               deepcopy(LANEATTRS_DEFAULT))
 
@@ -942,7 +942,7 @@ class Road:
             # general bicycle tag if all from abive fails but share with pedestrians
             # Moved to main lane attr except if segragated
             elif (osmattrs.get('bicycle', 'no') in YES_OR_DESIGNATED) & (osmattrs.get('segregated', '') == 'yes'):
-                print '  check if there are cycle lanes already', self._bikewayattrs[0]['n_lane'] == 0, self._bikewayattrs[1]['n_lane'] == 0
+                print('  check if there are cycle lanes already', self._bikewayattrs[0]['n_lane'] == 0, self._bikewayattrs[1]['n_lane'] == 0)
 
                 if (self._bikewayattrs[0]['n_lane'] == 0) & (self._bikewayattrs[1]['n_lane'] == 0):
                     # no bikelanes in both dir
@@ -1003,7 +1003,7 @@ class Road:
             # Moved to main lane attr except segregated
             elif (osmattrs.get('bicycle', 'no') in YES_OR_DESIGNATED) & (osmattrs.get('segregated', '') == 'yes'):
 
-                print '  check if there are cycle lanes already', self._bikewayattrs[1]['n_lane'] == 0
+                print('  check if there are cycle lanes already', self._bikewayattrs[1]['n_lane'] == 0)
                 if (self._bikewayattrs[1]['n_lane'] == 0):
                     self.make_bikelane(is_opp=False, is_rightside=True, width=width_left)
 
@@ -1014,7 +1014,7 @@ class Road:
 
     def make_buslane(self, is_opp=False, is_rightside=True,
                      ids_modes_allow=[], width=3.5, n_lane=1):
-        print 'make_buslane', is_opp, is_rightside, width
+        print('make_buslane', is_opp, is_rightside, width)
         if is_opp:
             ind = 0
         else:
@@ -1052,7 +1052,7 @@ class Road:
                 return 0
 
     def make_buswayattrs(self):
-        print 'make_buswayattrs'
+        print('make_buswayattrs')
         self._buswayattrs = (deepcopy(LANEATTRS_DEFAULT),
                              deepcopy(LANEATTRS_DEFAULT))
 
@@ -1071,11 +1071,11 @@ class Road:
 
         busway = osmattrs.get('busway', '')
 
-        if busway is not "":
+        if busway != "":
             # busway scheme
             if osmattrs.get('oneway', 'no') == 'no':
                 # bidir
-                print '  buslane bidir', busway
+                print('  buslane bidir', busway)
                 if busway == 'lane':
                     self.make_buslane(is_opp=False)
                     self.make_buslane(is_opp=True)
@@ -1125,7 +1125,7 @@ class Road:
 
             else:
                 # cycle lanes on oneway road
-                print '  buslane oneway', busway, busway in ('opposite', 'opposite_lane')
+                print('  buslane oneway', busway, busway in ('opposite', 'opposite_lane'))
                 if busway == 'lane':
                     self.make_buslane(is_opp=False, width=width_right)
 
@@ -1289,7 +1289,7 @@ class Road:
                 return 10
 
     def merge_laneattrs(self, laneattrs_dest, laneattrs_merge, is_rightside=False, is_leftside=False):
-        print 'merge_laneattrs'
+        print('merge_laneattrs')
         # print '  laneattrs_dest',laneattrs_dest
         # print '  laneattrs_merge',laneattrs_merge
         #self._buswayattrs[ind]['ids_modes_allow'] = ids_allowed
@@ -1362,7 +1362,7 @@ class Road:
                 laneattrs['ids_modes_allow'].append(id_allow)
 
     def make_lanes_rigid(self, is_opp=False, n_lane_osm=0):
-        print 'make_lanes_rigid', is_opp, n_lane_osm
+        print('make_lanes_rigid', is_opp, n_lane_osm)
         osmattrs = self._osmattrs
 
         if is_opp:
@@ -1386,7 +1386,7 @@ class Road:
         attrs = self._buswayattrs[ind]
 
         if attrs['n_lane'] > 0:
-            print '  busways n_lane', attrs['n_lane']
+            print('  busways n_lane', attrs['n_lane'])
 
             n_lane = len(lanes)
 
@@ -1418,7 +1418,7 @@ class Road:
         # do bikeways
         attrs = self._bikewayattrs[ind]
         if attrs['n_lane'] > 0:
-            print '  bikeways n_lane', attrs['n_lane']
+            print('  bikeways n_lane', attrs['n_lane'])
 
             n_lane = len(lanes)
 
@@ -1448,7 +1448,7 @@ class Road:
         # do sidewalks
         attrs = self._sidewalkattrs[ind]
         if attrs['n_lane'] > 0:
-            print '  sidewalks n_lane', attrs['n_lane']
+            print('  sidewalks n_lane', attrs['n_lane'])
             n_lane_assig = attrs['n_lane']
             n_lane = len(lanes)
             # sidewalks are not considered lanes in osm
@@ -1477,14 +1477,14 @@ class Road:
             self._lanes_opp = lanes
         else:
             self._lanes = lanes
-        print '  created %d lanes' % len(lanes)
+        print('  created %d lanes' % len(lanes))
         # print '  lanes', lanes
         for laneattrs in lanes:
             print_attrs(laneattrs)
         return True
 
     def make_lanes(self, is_opp=False, n_lane_osm=0):
-        print 'make_lanes', is_opp, n_lane_osm
+        print('make_lanes', is_opp, n_lane_osm)
         osmattrs = self._osmattrs
         is_lanes_rigid = False
 
@@ -1503,7 +1503,7 @@ class Road:
         # do busways
         attrs = self._buswayattrs[ind]
         if attrs['n_lane'] > 0:
-            print '  busways n_lane', attrs['n_lane']
+            print('  busways n_lane', attrs['n_lane'])
             n_lane_assig = attrs['n_lane']
             n_lane = len(lanes)
 
@@ -1518,7 +1518,7 @@ class Road:
         # do bikeways
         attrs = self._bikewayattrs[ind]
         if attrs['n_lane'] > 0:
-            print '  bikeways n_lane', attrs['n_lane']
+            print('  bikeways n_lane', attrs['n_lane'])
             n_lane_assig = attrs['n_lane']
             n_lane = len(lanes)
 
@@ -1541,7 +1541,7 @@ class Road:
         attrs = self._sidewalkattrs[ind]
 
         if attrs['n_lane'] > 0:
-            print '  sidewalks n_lane', attrs['n_lane']
+            print('  sidewalks n_lane', attrs['n_lane'])
             n_lane_assig = attrs['n_lane']
             n_lane = len(lanes)
             # sidewalks are not considered lanes in osm
@@ -1570,7 +1570,7 @@ class Road:
             self._lanes_opp = lanes
         else:
             self._lanes = lanes
-        print '  created %d lanes' % len(lanes)
+        print('  created %d lanes' % len(lanes))
         # print '  lanes', lanes
         for laneattrs in lanes:
             print_attrs(laneattrs)
@@ -1597,7 +1597,7 @@ class Road:
             ind = 1
             lanes = np.array(self._lanes)
 
-        print 'configure_edge', id_edge, net.edges.ids_sumo[id_edge], self.highway, 'is_opp', is_opp, 'n_lanes', len(lanes), 'is_remove_sidewalk', is_remove_sidewalk
+        print('configure_edge', id_edge, net.edges.ids_sumo[id_edge], self.highway, 'is_opp', is_opp, 'n_lanes', len(lanes), 'is_remove_sidewalk', is_remove_sidewalk)
 
         if self._is_oneway:  # & (not self.is_roundabout()):
             type_spread = 1  # centered
@@ -1628,11 +1628,11 @@ class Road:
             for laneattrs in lanes:
                 # &lanes[-1]['is_sidewalk']:
                 if (ind == 0) & laneattrs['is_sidewalk'] & (is_remove_sidewalk == 2) & (ind_lastlane > 0):
-                    print '  sidewalk removed on right side'
+                    print('  sidewalk removed on right side')
                     pass
                 # &lanes[0]['is_sidewalk']:
                 elif (ind == ind_lastlane) & laneattrs['is_sidewalk'] & (is_remove_sidewalk == 1) & (ind_lastlane > 0):
-                    print '  sidewalk removed on left side'
+                    print('  sidewalk removed on left side')
                     pass
                 else:
                     inds_valid.append(ind)
@@ -1667,9 +1667,9 @@ class Road:
         # add lanes
 
         if n_lane == 0:
-            print 'WARNING: no lane for this direction!!'
+            print('WARNING: no lane for this direction!!')
         else:
-            print '    inds_valid', inds_valid
+            print('    inds_valid', inds_valid)
         ids_lane = net.lanes.add_rows(n_lane)
 
         for id_lane, ind_lane, laneattrs in zip(ids_lane, xrange(n_lane), lanes[inds_valid]):
@@ -1753,7 +1753,7 @@ class Primary(Road):
             return 10
 
     def make_lanes_rigid(self, is_opp=False, n_lane_osm=0):
-        print 'make_lanes_rigid', is_opp, n_lane_osm
+        print('make_lanes_rigid', is_opp, n_lane_osm)
         osmattrs = self._osmattrs
 
         if is_opp:
@@ -1777,7 +1777,7 @@ class Primary(Road):
         attrs = self._buswayattrs[ind]
 
         if attrs['n_lane'] > 0:
-            print '  busways n_lane', attrs['n_lane']
+            print('  busways n_lane', attrs['n_lane'])
 
             n_lane = len(lanes)
 
@@ -1809,7 +1809,7 @@ class Primary(Road):
         # do bikeways
         attrs = self._bikewayattrs[ind]
         if attrs['n_lane'] > 0:
-            print '  bikeways n_lane', attrs['n_lane']
+            print('  bikeways n_lane', attrs['n_lane'])
 
             n_lane = len(lanes)
 
@@ -1846,7 +1846,7 @@ class Primary(Road):
         # do sidewalks
         attrs = self._sidewalkattrs[ind]
         if attrs['n_lane'] > 0:
-            print '  sidewalks n_lane', attrs['n_lane']
+            print('  sidewalks n_lane', attrs['n_lane'])
             n_lane_assig = attrs['n_lane']
             n_lane = len(lanes)
             # sidewalks are not considered lanes in osm
@@ -1876,14 +1876,14 @@ class Primary(Road):
             self._lanes_opp = lanes
         else:
             self._lanes = lanes
-        print '  created %d lanes' % len(lanes)
+        print('  created %d lanes' % len(lanes))
         # print '  lanes', lanes
         for laneattrs in lanes:
             print_attrs(laneattrs)
         return True
 
     def make_lanes(self, is_opp=False, n_lane_osm=0):
-        print 'make_lanes primary', is_opp, n_lane_osm
+        print('make_lanes primary', is_opp, n_lane_osm)
         osmattrs = self._osmattrs
         #is_lanes_rigid = False
 
@@ -1902,7 +1902,7 @@ class Primary(Road):
         # do busways
         attrs = self._buswayattrs[ind]
         if attrs['n_lane'] > 0:
-            print '  busways n_lane', attrs['n_lane']
+            print('  busways n_lane', attrs['n_lane'])
             n_lane_assig = attrs['n_lane']
             n_lane = len(lanes)
 
@@ -1917,7 +1917,7 @@ class Primary(Road):
         # do bikeways
         attrs = self._bikewayattrs[ind]
         if attrs['n_lane'] > 0:
-            print '  bikeways n_lane', attrs['n_lane']
+            print('  bikeways n_lane', attrs['n_lane'])
             n_lane_assig = attrs['n_lane']
             n_lane = len(lanes)
 
@@ -1947,7 +1947,7 @@ class Primary(Road):
         # do sidewalks
         attrs = self._sidewalkattrs[ind]
         if attrs['n_lane'] > 0:
-            print '  sidewalks n_lane', attrs['n_lane']
+            print('  sidewalks n_lane', attrs['n_lane'])
             n_lane_assig = attrs['n_lane']
             n_lane = len(lanes)
             # sidewalks are not considered lanes in osm
@@ -1976,7 +1976,7 @@ class Primary(Road):
             self._lanes_opp = lanes
         else:
             self._lanes = lanes
-        print '  created %d lanes' % len(lanes)
+        print('  created %d lanes' % len(lanes))
         # print '  lanes', lanes
         for laneattrs in lanes:
             print_attrs(laneattrs)
@@ -2025,7 +2025,7 @@ class Motorway(Road):
             return 10
 
     def make_lanes_rigid(self, is_opp=False, n_lane_osm=0):
-        print 'make_lanes_rigid', is_opp, n_lane_osm
+        print('make_lanes_rigid', is_opp, n_lane_osm)
         osmattrs = self._osmattrs
 
         if is_opp:
@@ -2048,14 +2048,14 @@ class Motorway(Road):
             self._lanes_opp = lanes
         else:
             self._lanes = lanes
-        print '  created %d lanes' % len(lanes)
+        print('  created %d lanes' % len(lanes))
         # print '  lanes', lanes
         for laneattrs in lanes:
             print_attrs(laneattrs)
         return True
 
     def make_lanes(self, is_opp=False, n_lane_osm=0):
-        print 'make_lanes primary', is_opp, n_lane_osm
+        print('make_lanes primary', is_opp, n_lane_osm)
         osmattrs = self._osmattrs
         #is_lanes_rigid = False
 
@@ -2078,7 +2078,7 @@ class Motorway(Road):
             self._lanes_opp = lanes
         else:
             self._lanes = lanes
-        print '  created %d lanes' % len(lanes)
+        print('  created %d lanes' % len(lanes))
         # print '  lanes', lanes
         for laneattrs in lanes:
             print_attrs(laneattrs)
@@ -2119,7 +2119,7 @@ class Residential(Road):
         return 3
 
     def make_sidewalkattrs(self):
-        print 'make_sidewalkattrs'
+        print('make_sidewalkattrs')
         self.make_sidewalkattrs_smallroads()
 
 
@@ -2217,7 +2217,7 @@ class Footpath(Road):
         # but there will be no sidewalk of sidewalk
 
     def make_bikewayattrs(self):
-        print 'Footpath.make_bikewayattrs'
+        print('Footpath.make_bikewayattrs')
         osmattrs = self._osmattrs
         self._bikewayattrs = (deepcopy(LANEATTRS_DEFAULT),
                               deepcopy(LANEATTRS_DEFAULT))
@@ -2244,7 +2244,7 @@ class Footpath(Road):
                     self.make_bikelane(is_opp=False, is_rightside=False, width=width_right)
 
     def make_lanes_rigid(self, is_opp=False, n_lane_osm=0):
-        print 'Footpath.make_lanes_rigid ped', is_opp, n_lane_osm
+        print('Footpath.make_lanes_rigid ped', is_opp, n_lane_osm)
         osmattrs = self._osmattrs
 
         if is_opp:
@@ -2273,7 +2273,7 @@ class Footpath(Road):
         attrs = self._buswayattrs[ind]
 
         if attrs['n_lane'] > 0:
-            print '  busways n_lane', attrs['n_lane']
+            print('  busways n_lane', attrs['n_lane'])
 
             n_lane = len(lanes)
 
@@ -2305,7 +2305,7 @@ class Footpath(Road):
         # do bikeways
         attrs = self._bikewayattrs[ind]
         if attrs['n_lane'] > 0:
-            print '  bikeways n_lane', attrs['n_lane']
+            print('  bikeways n_lane', attrs['n_lane'])
 
             n_lane = len(lanes)
 
@@ -2333,10 +2333,10 @@ class Footpath(Road):
                             n_lane_assig -= 1
 
     def make_lanes(self, is_opp=False, n_lane_osm=0):
-        print 'Footpath.make_lanes', is_opp, n_lane_osm, 'n_bikelane', len(self._bikewayattrs)
+        print('Footpath.make_lanes', is_opp, n_lane_osm, 'n_bikelane', len(self._bikewayattrs))
         osmattrs = self._osmattrs
 
-        print '  main lane attrs'
+        print('  main lane attrs')
         print_attrs(self._laneattrs_main)
 
         if is_opp:
@@ -2357,7 +2357,7 @@ class Footpath(Road):
         # do busways
         attrs = self._buswayattrs[ind]
         if attrs['n_lane'] > 0:
-            print '  busways n_lane', attrs['n_lane']
+            print('  busways n_lane', attrs['n_lane'])
             n_lane_assig = attrs['n_lane']
             n_lane = len(lanes)
 
@@ -2371,11 +2371,11 @@ class Footpath(Road):
 
         # do bikeways
 
-        print '  bikewayattrs:'
+        print('  bikewayattrs:')
         attrs = self._bikewayattrs[ind]
         print_attrs(attrs)
         if attrs['n_lane'] > 0:
-            print '  bikeways n_lane', attrs['n_lane']
+            print('  bikeways n_lane', attrs['n_lane'])
             n_lane_assig = attrs['n_lane']
             n_lane = len(lanes)
 
@@ -2399,7 +2399,7 @@ class Footpath(Road):
         else:
             self._lanes = lanes
 
-        print '  created %d lanes' % len(lanes)
+        print('  created %d lanes' % len(lanes))
         # print '  lanes', lanes
         for laneattrs in lanes:
             print_attrs(laneattrs)
@@ -2412,7 +2412,7 @@ class Cycleway(Road):
         """
         Make defaults to be overridden
         """
-        print 'config cycleway'
+        print('config cycleway')
         # pass here either road type specific defaults
         # or global defaults from parent process
 
@@ -2444,7 +2444,7 @@ class Cycleway(Road):
         self.ids_modes_disallow = []
         self.make_speed(self.parent.speed_max_bike)
 
-        print '  ids_modes_allow', self.ids_modes_allow
+        print('  ids_modes_allow', self.ids_modes_allow)
         #self.speed_max_bus = self.parent.speed_max_bus
         #self.speed_max_bike = self.parent.speed_max_bike
         self.speed_max_ped = self.parent.speed_max_ped
@@ -2479,12 +2479,12 @@ class Cycleway(Road):
         pass
 
     def make_sidewalkattrs(self):
-        print 'make_sidewalkattrs'
+        print('make_sidewalkattrs')
         # put sidewalks only if sidewalk  attributes are given
         return self.make_sidewalkattrs_largeroads()
 
     def make_lanes_rigid(self, is_opp=False, n_lane_osm=0):
-        print 'make_lanes_rigid cycle', is_opp, n_lane_osm
+        print('make_lanes_rigid cycle', is_opp, n_lane_osm)
         osmattrs = self._osmattrs
 
         if is_opp:
@@ -2502,7 +2502,7 @@ class Cycleway(Road):
         # do sidewalks
         attrs = self._sidewalkattrs[ind]
         if attrs['n_lane'] > 0:
-            print '  sidewalks n_lane', attrs['n_lane']
+            print('  sidewalks n_lane', attrs['n_lane'])
             n_lane_assig = attrs['n_lane']
             n_lane = len(lanes)
             # sidewalks are not considered lanes in osm
@@ -2531,14 +2531,14 @@ class Cycleway(Road):
             self._lanes_opp = lanes
         else:
             self._lanes = lanes
-        print '  created %d lanes' % len(lanes)
+        print('  created %d lanes' % len(lanes))
         # print '  lanes', lanes
         for laneattrs in lanes:
             print_attrs(laneattrs)
         return True
 
     def make_lanes(self, is_opp=False, n_lane_osm=0):
-        print 'make_lanes cycle', is_opp, n_lane_osm
+        print('make_lanes cycle', is_opp, n_lane_osm)
         osmattrs = self._osmattrs
         is_lanes_rigid = False
 
@@ -2557,7 +2557,7 @@ class Cycleway(Road):
         # do sidewalks
         attrs = self._sidewalkattrs[ind]
         if attrs['n_lane'] > 0:
-            print '  sidewalks n_lane', attrs['n_lane']
+            print('  sidewalks n_lane', attrs['n_lane'])
             n_lane_assig = attrs['n_lane']
             n_lane = len(lanes)
             # sidewalks are not considered lanes in osm
@@ -2586,7 +2586,7 @@ class Cycleway(Road):
             self._lanes_opp = lanes
         else:
             self._lanes = lanes
-        print '  created %d lanes' % len(lanes)
+        print('  created %d lanes' % len(lanes))
         # print '  lanes', lanes
         for laneattrs in lanes:
             print_attrs(laneattrs)
@@ -2637,7 +2637,7 @@ class OxImporter(Process):
                  info='Import of network imported with the help of osmnx.',
                  logger=None, **kwargs):
 
-        print 'OxImporter.__init__'
+        print('OxImporter.__init__')
 
         self._init_common(ident,
                           parent=scenario,
@@ -2797,10 +2797,10 @@ class OxImporter(Process):
         return self.parent
 
     def do(self):
-        print self.ident+'.do'
+        print(self.ident+'.do')
 
-        print '   osmdatafilepaths', self.osmdatafilepaths
-        print '   nxnetworkpaths', self.nxnetworkpaths
+        print('   osmdatafilepaths', self.osmdatafilepaths)
+        print('   nxnetworkpaths', self.nxnetworkpaths)
         net = self.get_scenario().net
         self._net = net
         self._map_id_edge_sumo_to_doubles = {}
@@ -2834,15 +2834,15 @@ class OxImporter(Process):
                     highway = element['tags'].get('highway', 'road')
                 else:
                     highway = 'road'
-                print '  '+70*'-'
-                print '  way', element['id'], type(element['id']), highway
+                print('  '+70*'-')
+                print('  way', element['id'], type(element['id']), highway)
                 edges_osm[str(element['id'])] = ROADCLASSES.get(highway, Road)(element, self)
-                print '  done with way', element['id'], id(self.edges_osm[str(element['id'])])
+                print('  done with way', element['id'], id(self.edges_osm[str(element['id'])]))
 
             if element['type'] == 'node':
                 nodes_osm[element['id']] = element.get('tags', {})
 
-        print '   import_osmdata:done'
+        print('   import_osmdata:done')
 
     # def get_id_edge_sumo(self, osmid):
     #    idmap = self._map_id_edge_sumo_to_doubles
@@ -2907,7 +2907,7 @@ class OxImporter(Process):
         n_edges = len(polylines)
         inds = np.arange(n_edges)
         #ids = inds+1
-        print 'make_linevertices', n_edges
+        print('make_linevertices', n_edges)
 
         linevertices = np.zeros((0, 2, 3), np.float32)
         vertexinds = np.zeros((0, 2), np.int32)
@@ -3024,7 +3024,7 @@ class OxImporter(Process):
             return self._edgeinds[inds_min], np.sqrt(dists2_min), angles[inds_min]
 
     def configure_sidewalks(self):
-        print 'configure_sidewalks'
+        print('configure_sidewalks')
         nodes = self._net.nodes
 
         #are_remove_sidewalk = np.zeros(len(self._are_edge_valid), dtype = np.int32)
@@ -3044,11 +3044,11 @@ class OxImporter(Process):
         for ind, id_edge_osm, shape, id_fromnode, id_tonode in zip(np.arange(len(ids_edge_osm)), ids_edge_osm, self._edgeshapes, ids_fromnode, ids_tonode):
             road = edges_osm[id_edge_osm]
             # if road.is_roundabout():# & (len(shape)>2):
-            print '  check edge id_edge_osm', ids_edge_sumo[ind], 'no cycleped', (road.highway not in ['cycleway', 'path', 'pedestrian', 'stairs', 'steps', 'platform']), 'has sidewalk', (road.has_sidewalks(False) | road.has_sidewalks(True))
+            print('  check edge id_edge_osm', ids_edge_sumo[ind], 'no cycleped', (road.highway not in ['cycleway', 'path', 'pedestrian', 'stairs', 'steps', 'platform']), 'has sidewalk', (road.has_sidewalks(False) | road.has_sidewalks(True)))
             # if (road.has_sidewalks(False)|road.has_sidewalks(True))\
             #    &(road.highway not in ['cycleway','path','pedestrian','stairs','steps','platform']):
             if 1:  # (road.highway not in ['path','pedestrian','stairs','steps','platform','footway']):
-                print '   add_edge', ids_edge_sumo[ind], 'id_fromnode', id_fromnode, 'id_tonode', id_tonode, 'ind', ind
+                print('   add_edge', ids_edge_sumo[ind], 'id_fromnode', id_fromnode, 'id_tonode', id_tonode, 'ind', ind)
 
                 shapearray = np.array(shape, dtype=np.float32)
                 delta_out = shapearray[1]-shapearray[0]
@@ -3067,7 +3067,7 @@ class OxImporter(Process):
 
         # print '  graph.nodes()',graph.nodes()
         for id_fromnode, tonodes in digraph.adj.items():
-            print '  investigate id_fromnode', id_fromnode
+            print('  investigate id_fromnode', id_fromnode)
             # dictionary with id_nnode as key and outgoing angle as value
             # if id_nnode is negative then the direction if from
             #  incoming edge from node -id_nnode
@@ -3085,7 +3085,7 @@ class OxImporter(Process):
             node_to_dirind = OrderedDict()
             i = 0
             for angle, id_node, id_edge_sumo in directiondata:
-                print '      ', i, 'id_node', id_node, 'angle', angle, 'id_edge_sumo', id_edge_sumo
+                print('      ', i, 'id_node', id_node, 'angle', angle, 'id_edge_sumo', id_edge_sumo)
                 dirind_to_node[i] = id_node
                 node_to_dirind[id_node] = i
                 i += 1
@@ -3097,7 +3097,7 @@ class OxImporter(Process):
         for id_node in list(digraph.nodes_iter()):
 
             node = digraph.node[id_node]
-            print '\n  find loops for node', id_node  # ,node['dirind_to_node']
+            print('\n  find loops for node', id_node)  # ,node['dirind_to_node']
             for ind, id_nbnode in node['dirind_to_node'].iteritems():
 
                 if id_nbnode < 0:
@@ -3137,10 +3137,10 @@ class OxImporter(Process):
                                 else:
                                     are_remove_sidewalk[id_sumo] = 2  # remove sidewalk from right
 
-                            print '   found edge', id_sumo, id_fromnode, id_tonone, id_node, 'is_remove_sidewalk', are_remove_sidewalk[id_sumo]
+                            print('   found edge', id_sumo, id_fromnode, id_tonone, id_node, 'is_remove_sidewalk', are_remove_sidewalk[id_sumo])
 
     def configure_roundabouts(self):
-        print 'configure_roundabouts'
+        print('configure_roundabouts')
         nodes = self._net.nodes
         roundabouts = []
         edges_osm = self.edges_osm
@@ -3213,13 +3213,13 @@ class OxImporter(Process):
             return id_osm
 
     def check_consistency(self):
-        print 'check_consistency'
+        print('check_consistency')
         nodelookup = {}
 
         for ind, id_fromnode,  id_tonode, id_edge_sumo in zip(np.arange(len(self._ids_edge_sumo)), self._ids_fromnode, self._ids_tonode, self._ids_edge_sumo):
             ids_fromtonode = (id_fromnode, id_tonode)
             if nodelookup.has_key(ids_fromtonode):
-                print '  WARNING: %s double edge to %s detected' % (id_edge_sumo, nodelookup[ids_fromtonode]), 'from', id_fromnode, 'to', id_tonode, 'id_edge_sumo', id_edge_sumo, nodelookup[ids_fromtonode] == id_edge_sumo
+                print('  WARNING: %s double edge to %s detected' % (id_edge_sumo, nodelookup[ids_fromtonode]), 'from', id_fromnode, 'to', id_tonode, 'id_edge_sumo', id_edge_sumo, nodelookup[ids_fromtonode] == id_edge_sumo)
                 if nodelookup[ids_fromtonode] == id_edge_sumo:
                     # meand 2 edges with identical ID
                     self._are_edge_valid[ind] = False
@@ -3247,7 +3247,7 @@ class OxImporter(Process):
 
         alpha_crit = 30.0*np.pi/180.0
         alpha_crit_cross = 30.0*np.pi/180.0
-        print 'configure_footpath alpha_crit', alpha_crit
+        print('configure_footpath alpha_crit', alpha_crit)
         #self.id_mode = ID_MODE_PED
         # highway=footway|path
         #self.highway = self._osmattrs.get('highway','footway')
@@ -3258,7 +3258,7 @@ class OxImporter(Process):
             road = edges_osm[id_edge_osm]
 
             if road.highway in footpath_condig:
-                print '  check edge', ids_edge_sumo[ind], road.footway, (road.get_osmattr('tunnel') != 'yes'), (length > dist_min_remove), length
+                print('  check edge', ids_edge_sumo[ind], road.footway, (road.get_osmattr('tunnel') != 'yes'), (length > dist_min_remove), length)
                 #(road.footway != 'crossing') (road.footway != 'sidewalk')
                 ids_osm_main = set()
                 is_remove = True
@@ -3273,16 +3273,16 @@ class OxImporter(Process):
                         inds_edge_main, dists, angles = self.get_closest_edge_dist(
                             point, ind, n_best=20, d_max=dist_min_detect)
                         #matchdata = {}
-                        print '   check sidewalk point (%d/%d)' % (i+1, len(shape))
+                        print('   check sidewalk point (%d/%d)' % (i+1, len(shape)))
                         for ind_edge_main, dist, angle in zip(inds_edge_main, dists, angles):
                             id_edge_osm_main, is_opp, nr = self.get_id_edge_osm_from_id_sumo(
                                 ids_edge_sumo[ind_edge_main])
                             road_main = edges_osm[id_edge_osm_main]
                             prio = road_main.get_priority(is_opp)
-                            print '    check medge %s d=%.1fm al=%.1f' % (ids_edge_sumo[ind_edge_main], dist, angle/np.pi*180), prio, road_main.highway, (angle < alpha_crit), (dist < 2*dist_min_detect), (road_main.highway not in footpath_nomerge)
+                            print('    check medge %s d=%.1fm al=%.1f' % (ids_edge_sumo[ind_edge_main], dist, angle/np.pi*180), prio, road_main.highway, (angle < alpha_crit), (dist < 2*dist_min_detect), (road_main.highway not in footpath_nomerge))
                             # print '   p1',shape[i-1],'pc',point,'p2',shape[i]
                             if (angle < 2*alpha_crit) & (dist < dist_min_detect) & (road_main.highway not in footpath_nomerge):
-                                print '     add edge main edge %s' % ids_edge_sumo[ind_edge_main], (id_edge_osm_main, is_opp)
+                                print('     add edge main edge %s' % ids_edge_sumo[ind_edge_main], (id_edge_osm_main, is_opp))
                                 ids_osm_main.add((id_edge_osm_main, is_opp))
                                 is_foundmatch = True
                                 break
@@ -3299,16 +3299,16 @@ class OxImporter(Process):
                             is_foundmatch = False
                             inds_edge_main, dists, angles = self.get_closest_edge_dist(
                                 point, ind, n_best=20, d_max=dist_min_detect)
-                            print '  check footpath point (%d/%d)' % (i+1, len(shape))
+                            print('  check footpath point (%d/%d)' % (i+1, len(shape)))
                             for ind_edge_main, dist, angle in zip(inds_edge_main, dists, angles):
                                 id_edge_osm_main, is_opp, nr = self.get_id_edge_osm_from_id_sumo(
                                     ids_edge_sumo[ind_edge_main])
                                 road_main = edges_osm[id_edge_osm_main]
                                 prio = road_main.get_priority(is_opp)
-                                print '   check medge %s d=%.1fm al=%.1f,%.2f' % (ids_edge_sumo[ind_edge_main], dist, angle/np.pi*180, angle), prio, road_main.highway, (angle < alpha_crit), (dist < dist_min_detect), (road_main.highway not in footpath_nomerge)
+                                print('   check medge %s d=%.1fm al=%.1f,%.2f' % (ids_edge_sumo[ind_edge_main], dist, angle/np.pi*180, angle), prio, road_main.highway, (angle < alpha_crit), (dist < dist_min_detect), (road_main.highway not in footpath_nomerge))
                                 # print '   p1',shape[i-1],'pc',point,'p2',shape[i]
                                 if (prio <= prio_max) & (angle < alpha_crit) & (dist < dist_min_detect) & (road_main.highway not in footpath_nomerge):
-                                    print '       add edge main edge %s' % ids_edge_sumo[ind_edge_main], (id_edge_osm_main, is_opp)
+                                    print('       add edge main edge %s' % ids_edge_sumo[ind_edge_main], (id_edge_osm_main, is_opp))
                                     ids_osm_main.add((id_edge_osm_main, is_opp))
                                     is_foundmatch = True
                                     break
@@ -3329,17 +3329,17 @@ class OxImporter(Process):
                             is_foundmatch = False
                             inds_edge_main, dists, angles = self.get_closest_edge_dist(
                                 point, ind, n_best=20, d_max=dist_min_detect_cross)
-                            print '  check crossing point (%d/%d)' % (i+1, len(shape))
+                            print('  check crossing point (%d/%d)' % (i+1, len(shape)))
                             for ind_edge_main, dist, angle in zip(inds_edge_main, dists, angles):
                                 id_edge_osm_main, is_opp, nr = self.get_id_edge_osm_from_id_sumo(
                                     ids_edge_sumo[ind_edge_main])
                                 road_main = edges_osm[id_edge_osm_main]
                                 prio = road_main.get_priority(is_opp)
-                                print '   check medge %s d=%.1fm al=%.1f' % (ids_edge_sumo[ind_edge_main], dist, angle/np.pi*180), prio, road_main.highway, (angle < alpha_crit_cross), (dist < dist_min_detect_cross), (road_main.highway in footpath_merge_cross)
+                                print('   check medge %s d=%.1fm al=%.1f' % (ids_edge_sumo[ind_edge_main], dist, angle/np.pi*180), prio, road_main.highway, (angle < alpha_crit_cross), (dist < dist_min_detect_cross), (road_main.highway in footpath_merge_cross))
                                 # print '   p1',shape[i-1],'pc',point,'p2',shape[i]
                                 # if (prio<=prio_max)&(((angle<alpha_crit_cross)&(dist < dist_min_detect))|(dist < dist_min_detect_cross))& (road_main.highway in footpath_merge_cross):
                                 if (prio <= prio_max) & (angle < alpha_crit_cross) & (dist < dist_min_detect_cross) & (road_main.highway in footpath_merge_cross):
-                                    print '       add edge main edge %s' % ids_edge_sumo[ind_edge_main], (id_edge_osm_main, is_opp)
+                                    print('       add edge main edge %s' % ids_edge_sumo[ind_edge_main], (id_edge_osm_main, is_opp))
                                     ids_osm_main.add((id_edge_osm_main, is_opp))
                                     is_foundmatch = True
                                     break
@@ -3356,11 +3356,11 @@ class OxImporter(Process):
                     # footpath can be matched to main roads
 
                     for id_osm_main, is_opp in ids_osm_main:
-                        print '    found', id_edge_osm, 'match with', id_osm_main, 'is_opp', is_opp
+                        print('    found', id_edge_osm, 'match with', id_osm_main, 'is_opp', is_opp)
                         edges_osm[id_osm_main].add_sidewalk(road, is_opp=is_opp)
 
                     # make sure footpath is invalid
-                    print '  eliminate edge', ids_edge_sumo[ind]
+                    print('  eliminate edge', ids_edge_sumo[ind])
                     are_edge_valid[ind] = False
 
     def _get_osmid_from_attr(self, attrs):
@@ -3407,7 +3407,7 @@ class OxImporter(Process):
         """
         Import an networkx graph into net
         """
-        print 'import_nx'
+        print('import_nx')
         net = self._net
         edges_osm = self.edges_osm
         nodes_osm = self.nodes_osm
@@ -3456,7 +3456,7 @@ class OxImporter(Process):
         for id_fromnode, id_fromnode_sumo, outgoingdicts in zip(ids_node, graphx.adj.keys(), graphx.adj.values()):
             i_node += 1
             #ids_node_sumo[i_node] = id_fromnode_sumo
-            print '  ', id_fromnode, id_fromnode_sumo, gxnodes[id_fromnode_sumo]  # nodes.ids_sumo[id_fromnode]
+            print('  ', id_fromnode, id_fromnode_sumo, gxnodes[id_fromnode_sumo])  # nodes.ids_sumo[id_fromnode]
             lonlats_node[i_node] = [gxnodes[id_fromnode_sumo]['x'], gxnodes[id_fromnode_sumo]['y']]
             ids_node_sumo[i_node] = str(id_fromnode_sumo)
             elevation[i_node] = float(gxnodes[id_fromnode_sumo].get('elevation', 0.0))
@@ -3472,9 +3472,9 @@ class OxImporter(Process):
         nodes.types_tl[ids_node[nodetypes == id_nodetype_tl]] = nodes.types_tl.choices['static']
 
         if projparams is None:
-            print '  take first node to estimate projection', (lonlats_node[0][0], lonlats_node[0][1])
+            print('  take first node to estimate projection', (lonlats_node[0][0], lonlats_node[0][1]))
             projparams = guess_utm_from_coord([lonlats_node[0][0], lonlats_node[0][1]])
-        print '  projparams', projparams
+        print('  projparams', projparams)
         proj = pyproj.Proj(projparams)
         net.set_projparams(projparams)
 
@@ -3584,7 +3584,7 @@ class OxImporter(Process):
                     road = edges_osm[id_osm]
 
                     is_oneway = road.is_oneway()
-                    print '    check id_osm', id_osm, 'is_oneway', is_oneway, "id_fromnode_sumo %s id_tonode_sumo %s" % (id_fromnode_sumo, id_tonode_sumo)
+                    print('    check id_osm', id_osm, 'is_oneway', is_oneway, "id_fromnode_sumo %s id_tonode_sumo %s" % (id_fromnode_sumo, id_tonode_sumo))
                     if is_oneway:
                         is_reverse = False
                         shapes.append(list(shape1))
@@ -3593,7 +3593,7 @@ class OxImporter(Process):
 
                     else:
                         is_reverse = self.is_reverse(id_osm, id_fromnode_sumo, id_tonode_sumo)
-                        print 'is_revese', is_reverse, edges_osm[id_osm].ids_osmnode
+                        print('is_revese', is_reverse, edges_osm[id_osm].ids_osmnode)
 
                         # if (not is_oneway) & is_reverse:#self.is_reverse(id_osm, id_fromnode_sumo, id_tonode_sumo):
                         if is_reverse:
@@ -3601,7 +3601,7 @@ class OxImporter(Process):
                             shapes.append(list(shape1)[::-1])
                             ids_fromnode.append(id_tonode)
                             ids_tonode.append(id_fromnode)
-                            print '      created edge %s from' % ids_edge_sumo[-1], id_tonode_sumo, 'to', id_fromnode_sumo
+                            print('      created edge %s from' % ids_edge_sumo[-1], id_tonode_sumo, 'to', id_fromnode_sumo)
                             #id_node_temp = id_fromnode
                             #id_fromnode = id_tonode
                             #id_tonode = id_node_temp
@@ -3609,7 +3609,7 @@ class OxImporter(Process):
                             shapes.append(list(shape1))
                             ids_fromnode.append(id_fromnode)
                             ids_tonode.append(id_tonode)
-                            print '      created edge %s from' % ids_edge_sumo[-1], id_fromnode_sumo, 'to', id_tonode_sumo
+                            print('      created edge %s from' % ids_edge_sumo[-1], id_fromnode_sumo, 'to', id_tonode_sumo)
                             # ids_fromnode.append(id_fromnode)
                             # ids_tonode.append(id_tonode)
 
@@ -3631,7 +3631,7 @@ class OxImporter(Process):
                         ids_edge_sumo.append(self.get_id_edge_sumo('-'+id_osm))
                         ids_edge_osm.append(id_osm)
                         inds_edge_opp.append(-2)  # mark that this is the opposite edge
-                        print '      created reverse ids_edge_sumo', ids_edge_sumo[i_edge], 'from', ids_fromnode[-1], 'to', ids_tonode[-1]
+                        print('      created reverse ids_edge_sumo', ids_edge_sumo[i_edge], 'from', ids_fromnode[-1], 'to', ids_tonode[-1])
 
                     else:
                         inds_edge_opp.append(-1)
@@ -3715,12 +3715,12 @@ class OxImporter(Process):
             if id_sumo[0] > '-':  # it is not an opposite edge
                 road = edges_osm[id_edge_osm]
 
-                print '  configure way id_edge_osm', id_edge_osm, id_sumo, are_remove_sidewalk.get(id_sumo, 0)
+                print('  configure way id_edge_osm', id_edge_osm, id_sumo, are_remove_sidewalk.get(id_sumo, 0))
                 road.configure_edge(id_edge, net, is_remove_sidewalk=are_remove_sidewalk.get(id_sumo, 0))
                 #id_edge_opp = self.get_id_edge_opp
                 id_sumo_opp = '-'+id_sumo
                 if edges.ids_sumo.has_index(id_sumo_opp):
-                    print '  configure opposite way id_edge_osm', id_edge_osm, id_sumo_opp, are_remove_sidewalk.get(id_sumo_opp, 0)
+                    print('  configure opposite way id_edge_osm', id_edge_osm, id_sumo_opp, are_remove_sidewalk.get(id_sumo_opp, 0))
                     road.configure_edge(edges.ids_sumo.get_id_from_index(id_sumo_opp),
                                         net, is_opp=True,
                                         is_remove_sidewalk=are_remove_sidewalk.get(id_sumo_opp, 0))
--- a/tools/contributed/sumopy/coremodules/network/osmnx_import.py
+++ b/tools/contributed/sumopy/coremodules/network/osmnx_import.py
@@ -36,9 +36,9 @@ def import_nx(graphx, net, projparams=''
     """
 
     for id_node_sumo, nbrsdict in graphx.adjacency():
-        print '  id_node_sumo', id_node_sumo
+        print('  id_node_sumo', id_node_sumo)
         for nbr, eattr in nbrsdict.items():
-            print '    nbr, eattr', nbr, eattr
+            print('    nbr, eattr', nbr, eattr)
 
     if projparams == "":
         projparams_target = guess_utm_from_coord()
@@ -51,7 +51,7 @@ class OxImporter(Process):
                  info='Import of network imported with the help of osmnx.',
                  logger=None, **kwargs):
 
-        print 'OxImporter.__init__'
+        print('OxImporter.__init__')
 
         self._init_common(ident,
                           parent=scenario,
@@ -96,7 +96,7 @@ class OxImporter(Process):
         return self.parent
 
     def do(self):
-        print self.ident+'.do'
+        print(self.ident+'.do')
 
         net = self.get_scenario().net
         projparams_target = net.get_projparams()
--- a/tools/contributed/sumopy/coremodules/network/publictransportnet.py
+++ b/tools/contributed/sumopy/coremodules/network/publictransportnet.py
@@ -42,8 +42,8 @@ try:
 
 except:
     pyproj = None
-    print 'Some of the functions cannot be executed because module pypro or mpl_toolkits.basemap is missing.'
-    print 'Please install these modules if you want to use it.'
+    print('Some of the functions cannot be executed because module pypro or mpl_toolkits.basemap is missing.')
+    print('Please install these modules if you want to use it.')
     # print __doc__
 
 
@@ -52,7 +52,7 @@ except:
 
 class StopAccessProvider(Process):
     def __init__(self,  net, logger=None, **kwargs):
-        print 'StopAccessProvider.__init__'
+        print('StopAccessProvider.__init__')
         self._init_common('stopaccessprovider',
                           parent=net,
                           name='Stop access provider',
@@ -75,7 +75,7 @@ class StopAccessProvider(Process):
         #self.ids_modes_tocomplete = set([MODES["pedestrian"], MODES["delivery"], MODES["bus"]])
 
     def do(self):
-        print 'StopAccessProvider.do'
+        print('StopAccessProvider.do')
 
         self.provide_access()
 
@@ -107,21 +107,21 @@ class StopAccessProvider(Process):
                 # print ' Check access at stop %s lane %d. al='%(id_stop,id_lane)
                 if lanes.get_accesslevel([id_lane], id_mode_ped) == -1:
                     # no pedaccess
-                    print '    add ped access at stop %s lane %d, ID edge SUMO "%s".' % (id_stop, id_lane, edges.ids_sumo[id_edge])
+                    print('    add ped access at stop %s lane %d, ID edge SUMO "%s".' % (id_stop, id_lane, edges.ids_sumo[id_edge]))
                     lanes.add_access(id_lane, id_mode_ped)
                     n_add_access += 1
 
                 if self.is_bikeaccess:
                     if lanes.get_accesslevel([id_lane], id_mode_bike) == -1:
-                        print '    add bike access at stop %s lane %d, ID edge SUMO "%s".' % (id_stop, id_lane, edges.ids_sumo[id_edge])
+                        print('    add bike access at stop %s lane %d, ID edge SUMO "%s".' % (id_stop, id_lane, edges.ids_sumo[id_edge]))
                         lanes.add_access(id_lane, id_mode_bike)
                         n_add_access += 1
 
             else:
-                print 'WARNING: stop %s at edge %d, SUMO ID %s with without access lane.' % (id_stop, id_edge, edges.ids_sumo[id_edge])
+                print('WARNING: stop %s at edge %d, SUMO ID %s with without access lane.' % (id_stop, id_edge, edges.ids_sumo[id_edge]))
                 # return False
 
-        print '  Added access to %d stops' % n_add_access
+        print('  Added access to %d stops' % n_add_access)
         return True
 
 
@@ -346,7 +346,7 @@ class PtStops(am.ArrayObjman):
         """
         Export stops to SUMO stop xml file.
         """
-        print 'export_sumoxml', filepath, len(self)
+        print('export_sumoxml', filepath, len(self))
         if len(self) == 0:
             return None
 
@@ -356,7 +356,7 @@ class PtStops(am.ArrayObjman):
         try:
             fd = open(filepath, 'w')
         except:
-            print 'WARNING in write_obj_to_xml: could not open', filepath
+            print('WARNING in write_obj_to_xml: could not open', filepath)
             return False
         #xmltag, xmltag_item, attrname_id = self.xmltag
         fd.write('<?xml version="1.0" encoding="%s"?>\n' % encoding)
@@ -375,7 +375,7 @@ class PtStops(am.ArrayObjman):
         if filepath is None:
             filepath = self.get_stopfilepath()
 
-        print 'import_sumostops %s ' % (filepath,)
+        print('import_sumostops %s ' % (filepath,))
 
         fd = open(filepath, 'r')
 
@@ -388,7 +388,7 @@ class PtStops(am.ArrayObjman):
                 os.remove(filepath)
 
         except KeyError:
-            print >> sys.stderr, "Error: Problems with reading file %s" % filepath
+            print("Error: Problems with reading file %s" % filepath, file=sys.stderr)
             raise
 
     def update_centroids(self):
@@ -462,4 +462,4 @@ class StopReader(handler.ContentHandler)
                                  )
 
             else:
-                print 'WARNING in StopReader: stop %s has non-existant lane %s' % (id_stop, attrs['lane'])
+                print('WARNING in StopReader: stop %s has non-existant lane %s' % (id_stop, attrs['lane']))
--- a/tools/contributed/sumopy/coremodules/network/publictransportnet_wxgui.py
+++ b/tools/contributed/sumopy/coremodules/network/publictransportnet_wxgui.py
@@ -300,7 +300,7 @@ class PtWxGuiMixin:
         # Finally, if the directory is changed in the process of getting files, this
         # dialog is set up to change the current working directory to the path chosen.
         defaultfilepath = self._net.ptstops.get_stopfilepath()
-        print '  defaultfilepath', defaultfilepath
+        print('  defaultfilepath', defaultfilepath)
 
         dlg = wx.FileDialog(
             self._mainframe, message="Open stops XML file",
@@ -357,11 +357,11 @@ class PtWxGuiMixin:
         # print '  val,val == wx.ID_OK',val,wx.ID_OK,wx.ID_CANCEL,val == wx.ID_CANCEL
         # print '  status =',dlg.get_status()
         if dlg.get_status() != 'success':  # val == wx.ID_CANCEL:
-            print ">>>>>>>>>Unsuccessful\n"
+            print(">>>>>>>>>Unsuccessful\n")
             dlg.Destroy()
 
         if dlg.get_status() == 'success':
-            print ">>>>>>>>>successful\n"
+            print(">>>>>>>>>successful\n")
             # apply current widget values to scenario instance
             dlg.apply()
             dlg.Destroy()
--- a/tools/contributed/sumopy/coremodules/network/routing.py
+++ b/tools/contributed/sumopy/coremodules/network/routing.py
@@ -41,7 +41,7 @@ class priorityDictionary(dict):
     def smallest(self):
         '''Find smallest item after removing deleted items from heap.'''
         if len(self) == 0:
-            raise IndexError, "smallest of empty priorityDictionary"
+            raise IndexError("smallest of empty priorityDictionary")
         heap = self.__heap
         while heap[0][1] not in self or self[heap[0][1]] != heap[0][0]:
             lastItem = heap.pop()
@@ -150,7 +150,7 @@ def edgedijkstra_backwards(id_edge_start
     # est.dist. of non-final vert.
 
     if np.isnan(weights[id_edge_start]):
-        print '  no access id_edge_start, weights', id_edge_start, weights[id_edge_start]
+        print('  no access id_edge_start, weights', id_edge_start, weights[id_edge_start])
         return ([], {}, {})
 
     Q = priorityDictionary()
@@ -167,8 +167,8 @@ def edgedijkstra_backwards(id_edge_start
             # print '    D=',D
             # print '    Q=',Q
             if not bstar.has_key(e):
-                print 'WARNING in edgedijkstra: bstar has no edge', e
-                print 'routes = \n', P
+                print('WARNING in edgedijkstra: bstar has no edge', e)
+                print('routes = \n', P)
                 return ([], None, P)
 
             for id_edge in bstar[e]:
@@ -183,7 +183,7 @@ def edgedijkstra_backwards(id_edge_start
                         newstate += '<Q'
                     else:
                         newstate += '>Q|'
-                    print '    id_bedge', id_edge, 'w=%.2f,w_tot=%.2f' % (weights[id_edge], weight_tot), weights[id_edge] >= 0, D[e] + weights[id_edge] < cost_limit, id_edge not in D, (id_edge not in Q or weight_tot < Q[id_edge]), newstate
+                    print('    id_bedge', id_edge, 'w=%.2f,w_tot=%.2f' % (weights[id_edge], weight_tot), weights[id_edge] >= 0, D[e] + weights[id_edge] < cost_limit, id_edge not in D, (id_edge not in Q or weight_tot < Q[id_edge]), newstate)
 
                 if not np.isnan(weights[id_edge]):  # edge accessible?
                     weight_tot = D[e] + weights[id_edge]
@@ -252,7 +252,7 @@ def edgedijkstra(id_edge_start, ids_edge
     # est.dist. of non-final vert.
 
     if np.isnan(weights[id_edge_start]):
-        print '  WARNING in edgedijkstra: no access id_edge_start, weights', id_edge_start, weights[id_edge_start]
+        print('  WARNING in edgedijkstra: no access id_edge_start, weights', id_edge_start, weights[id_edge_start])
         return ({}, {})
 
     Q = priorityDictionary()
@@ -266,8 +266,8 @@ def edgedijkstra(id_edge_start, ids_edge
             if len(ids_target) == 0:
                 return (D, P)
         if not fstar.has_key(e):
-            print 'WARNING in edgedijkstra: fstar has no edge', e
-            print 'routes = \n', P
+            print('WARNING in edgedijkstra: fstar has no edge', e)
+            print('routes = \n', P)
             return (None, P)
         for id_edge in fstar[e]:
             if not np.isnan(weights[id_edge]):  # edge accessible?
@@ -538,7 +538,7 @@ class RouterMixin(CmlMixin, Process):
                         cml='--gawron.beta',
                         groupnames=[optiongroup, 'options', ],
                         perm='rw',
-                        is_enabled=lambda self: self.method_routechoice is 'gawron',
+                        is_enabled=lambda self: self.method_routechoice == 'gawron',
                         )
 
         self.add_option('a_gawron', kwargs.get('a_gawron', 0.05),
@@ -547,7 +547,7 @@ class RouterMixin(CmlMixin, Process):
                         cml='--gawron.a',
                         groupnames=[optiongroup, 'options', ],
                         perm='rw',
-                        is_enabled=lambda self: self.method_routechoice is 'gawron',
+                        is_enabled=lambda self: self.method_routechoice == 'gawron',
                         )
 
         self.add_option('beta_logit', kwargs.get('beta_logit', 0.15),
@@ -556,7 +556,7 @@ class RouterMixin(CmlMixin, Process):
                         cml='--logit.beta',
                         groupnames=[optiongroup, 'options', ],
                         perm='rw',
-                        is_enabled=lambda self: self.method_routechoice is 'logit',
+                        is_enabled=lambda self: self.method_routechoice == 'logit',
                         )
 
         self.add_option('gamma_logit', kwargs.get('gamma_logit', 1.0),
@@ -565,7 +565,7 @@ class RouterMixin(CmlMixin, Process):
                         cml='--logit.gamma',
                         groupnames=[optiongroup, 'options', ],
                         perm='rw',
-                        is_enabled=lambda self: self.method_routechoice is 'logit',
+                        is_enabled=lambda self: self.method_routechoice == 'logit',
                         )
 
         self.add_option('theta_logit', kwargs.get('theta_logit', 0.01),
@@ -574,7 +574,7 @@ class RouterMixin(CmlMixin, Process):
                         cml='--logit.theta',
                         groupnames=[optiongroup, 'options', ],
                         perm='rw',
-                        is_enabled=lambda self: self.method_routechoice is 'logit',
+                        is_enabled=lambda self: self.method_routechoice == 'logit',
                         )
 
         self.add_option('algorithm_routing', kwargs.get('algorithm_routing', 'dijkstra'),
@@ -615,11 +615,11 @@ class RouterMixin(CmlMixin, Process):
         # print 'SumonetImporter.do',cml
         self.run_cml(cml)
         if self.status == 'success':
-            print '  Routing done.'
+            print('  Routing done.')
             if os.path.isfile(self.outfilepath):
                 # print '  outfile exists, start importing routes'
                 if self.is_update_current_routes:
-                    print '  update current routes'
+                    print('  update current routes')
                     self._trips.import_routes_xml(self.outfilepath,
                                                   is_clear_trips=False,
                                                   is_generate_ids=False,
@@ -627,7 +627,7 @@ class RouterMixin(CmlMixin, Process):
                                                   is_add=False
                                                   )
                 else:
-                    print '  create route alternatives'
+                    print('  create route alternatives')
                     self._trips.import_routes_xml(self.outfilepath,
                                                   is_clear_trips=False,
                                                   is_generate_ids=True,
@@ -645,7 +645,7 @@ class DuaRouter(RouterMixin):
                  is_export_net=True,
                  logger=None,
                  **kwargs):
-        print 'DuaRouter.__init__ net, trips', net, trips
+        print('DuaRouter.__init__ net, trips', net, trips)
         self.init_tripsrouter('duarouter', net,  # net becomes parent
                               trips,
                               outfilepath=outfilepath,
@@ -662,7 +662,7 @@ class DuaRouter(RouterMixin):
 
         else:
             self.is_export_trips = False
-        print '  tripfilepaths', tripfilepaths
+        print('  tripfilepaths', tripfilepaths)
         if tripfilepaths is not None:
             self.add_option('tripfilepaths', tripfilepaths,
                             groupnames=['_private'],
@@ -1075,7 +1075,7 @@ class MaRouter(CmlMixin, Process):
         """
         Imports simulation resuts into results object.
         """
-        print 'import_results of marouter'
+        print('import_results of marouter')
 
         if results is None:
             results = self._results
--- a/tools/contributed/sumopy/coremodules/network/wxgui.py
+++ b/tools/contributed/sumopy/coremodules/network/wxgui.py
@@ -399,14 +399,14 @@ class WxGui(PtWxGuiMixin, ModuleGui):
     def on_test_routing(self, event=None):
         D, P = routing.dijkstra(54, self._net.nodes, self._net.edges, set([42, 82]))
         cost, route = routing.get_mincostroute_node2node(54, 42, D, P, self._net.edges)
-        print ' route:', route
-        print ' cost', cost
-        print '  firstnode, lastnode', self._net.edges.ids_fromnode[route[0]], self._net.edges.ids_tonode[route[-1]]
+        print(' route:', route)
+        print(' cost', cost)
+        print('  firstnode, lastnode', self._net.edges.ids_fromnode[route[0]], self._net.edges.ids_tonode[route[-1]])
 
         D, P = routing.edgedijkstra(29, self._net.nodes, self._net.edges, set([106, 82]))
         cost, route = routing.get_mincostroute_edge2edge(29, 82, D, P)
-        print ' route:', route
-        print ' cost', cost
+        print(' route:', route)
+        print(' cost', cost)
         # print  '  firstnode, lastnode',self._net.edges.ids_fromnode[route[0]],self._net.edges.ids_tonode[route[-1]]
 
     def on_clean_codes(self, event=None):
@@ -804,7 +804,7 @@ class WxGui(PtWxGuiMixin, ModuleGui):
             self._mainframe.refresh_moduleguis()
 
     def on_export_sumonet(self, event=None):
-        print 'on_export_sumonet'
+        print('on_export_sumonet')
         if self._net.parent is not None:
             rootname = self._net.parent.get_rootfilename()
             rootdirpath = self._net.parent.get_workdirpath()
@@ -854,7 +854,7 @@ class WxGui(PtWxGuiMixin, ModuleGui):
         """
         Export Network nodes data to shape file.
         """
-        print 'on_nodes_to_shapefile'
+        print('on_nodes_to_shapefile')
 
         dirpath = self._net.parent.get_workdirpath()
         defaultFile = self._net.parent.get_rootfilename()+'.nodes.shp'
--- a/tools/contributed/sumopy/coremodules/scenario/__init__.py
+++ b/tools/contributed/sumopy/coremodules/scenario/__init__.py
@@ -18,7 +18,7 @@
 
 __version__ = "0.0"
 
-print 'init', __name__
+print('init', __name__)
 
 
 def get_wxgui():
--- a/tools/contributed/sumopy/coremodules/scenario/scenario.py
+++ b/tools/contributed/sumopy/coremodules/scenario/scenario.py
@@ -222,7 +222,7 @@ class Scenario(cm.BaseObjman):
         self._init_attributes()
 
     def _init_attributes(self):
-        print 'Scenario._init_attributes'  # ,dir(self)
+        print('Scenario._init_attributes')  # ,dir(self)
 
         attrsman = self.get_attrsman()
         self.simulation = attrsman.add(cm.ObjConf(simulation.Simulation(self)))
@@ -288,7 +288,7 @@ class Scenario(cm.BaseObjman):
         try:
             self.demand.import_xml(self.get_rootfilename(), self.get_workdirpath())
         except:
-            print 'WARNING: import of demand data failed. Please check for inconsistency with trip/route and network edge IDs.'
+            print('WARNING: import of demand data failed. Please check for inconsistency with trip/route and network edge IDs.')
 
     def update_netoffset(self, deltaoffset):
         """
--- a/tools/contributed/sumopy/coremodules/simulation/__init__.py
+++ b/tools/contributed/sumopy/coremodules/simulation/__init__.py
@@ -18,7 +18,7 @@
 
 __version__ = "0.0"
 
-print 'init', __name__
+print('init', __name__)
 
 
 def get_wxgui():
--- a/tools/contributed/sumopy/coremodules/simulation/result_oglviewer.py
+++ b/tools/contributed/sumopy/coremodules/simulation/result_oglviewer.py
@@ -728,7 +728,7 @@ class EdgeresultDrawings(Polylines):
         Called by tool.
         """
         self.resultsattr = getattr(self._edgeresults, attrname)
-        print 'configure', self.resultsattr.attrname, is_widthvalue, is_colorvalue
+        print('configure', self.resultsattr.attrname, is_widthvalue, is_colorvalue)
         # used for normalization
         if len(self.resultsattr.get_value()) == 0:
             return
@@ -796,7 +796,7 @@ class Resultviewer(OGleditor):
                  is_menu=False,  # create menu items
                  Debug=0,
                  ):
-        print 'Resultviewer.__init__ parent', parent
+        print('Resultviewer.__init__ parent', parent)
         self._drawing = None
         self.prefix_anim = 'anim_'
         self.layer_anim = 1000.0
--- a/tools/contributed/sumopy/coremodules/simulation/results.py
+++ b/tools/contributed/sumopy/coremodules/simulation/results.py
@@ -303,43 +303,43 @@ class Connectionresults(am.ArrayObjman):
             elif routeresults.ids_ptline[trip] > 0:
                 mode = self._edges.parent.modes.names[self._trips.parent.vtypes.ids_mode[self._trips.parent.ptlines.ids_vtype[routeresults.ids_ptline[trip]]]]
             else:
-                print 'WARNING: there is a not considered route typology'
+                print('WARNING: there is a not considered route typology')
             modes_tot.append(mode)
 
-        print 'n route', len(modes_tot)
+        print('n route', len(modes_tot))
         if len(modes_tot) != len(ids_edges):
-            print 'WARNING: modes and ids_edges have a different length - total flow'
-        print 'n car routes', len(modes_car)
+            print('WARNING: modes and ids_edges have a different length - total flow')
+        print('n car routes', len(modes_car))
         if len(modes_car) != len(ids_edges_car):
-            print 'WARNING: modes and ids_edges have a different length - car'
-        print 'n bike routes', len(modes_bike)
+            print('WARNING: modes and ids_edges have a different length - car')
+        print('n bike routes', len(modes_bike))
         if len(modes_bike) != len(ids_edges_bike):
-            print 'WARNING: modes and ids_edges have a different length - bike'
-        print 'n moto routes', len(modes_moto)
+            print('WARNING: modes and ids_edges have a different length - bike')
+        print('n moto routes', len(modes_moto))
         if len(modes_moto) != len(ids_edges_moto):
-            print 'WARNING: modes and ids_edges have a different length - moto'
-        print 'n od routes', len(modes_od)
+            print('WARNING: modes and ids_edges have a different length - moto')
+        print('n od routes', len(modes_od))
         if len(modes_od) != len(ids_edges_od):
-            print 'WARNING: modes and ids_edges have a different length - od'
-        print 'n od car routes', modes_od.count('passenger')
-        print 'n od taxi routes', modes_od.count('taxi')
-        print 'n od bike routes', modes_od.count('bicycle')
-        print 'n od moto routes', modes_od.count('motorcycle')
-        print 'n vp routes',  len(modes_vp)
+            print('WARNING: modes and ids_edges have a different length - od')
+        print('n od car routes', modes_od.count('passenger'))
+        print('n od taxi routes', modes_od.count('taxi'))
+        print('n od bike routes', modes_od.count('bicycle'))
+        print('n od moto routes', modes_od.count('motorcycle'))
+        print('n vp routes',  len(modes_vp))
         if len(modes_vp) != len(ids_edges_vp):
-            print 'WARNING: modes and ids_edges have a different length - vp'
-        print 'n iauto routes',  len(modes_iauto)
+            print('WARNING: modes and ids_edges have a different length - vp')
+        print('n iauto routes',  len(modes_iauto))
         if len(modes_iauto) != len(ids_edges_iauto):
-            print 'WARNING: modes and ids_edges have a different length - iauto'
-        print 'n ibike routes',  len(modes_ibike)
+            print('WARNING: modes and ids_edges have a different length - iauto')
+        print('n ibike routes',  len(modes_ibike))
         if len(modes_ibike) != len(ids_edges_ibike):
-            print 'WARNING: modes and ids_edges have a different length - ibike'
-        print 'n imoto routes',  len(modes_imoto)
+            print('WARNING: modes and ids_edges have a different length - ibike')
+        print('n imoto routes',  len(modes_imoto))
         if len(modes_imoto) != len(ids_edges_imoto):
-            print 'WARNING: modes and ids_edges have a different length - imoto'
-        print 'n pt routes',  len(modes_ptline)
+            print('WARNING: modes and ids_edges have a different length - imoto')
+        print('n pt routes',  len(modes_ptline))
         if len(modes_ptline) != len(ids_edges_ptline):
-            print 'WARNING: modes and ids_edges have a different length - bus'
+            print('WARNING: modes and ids_edges have a different length - bus')
 
         ids_connections_tot, flows_tot = self.evaluate_connection_flows('tot', modes_tot, ids_edges)
         self.add_rows(ids_connection=ids_connections_tot, total_flows=flows_tot)
@@ -389,7 +389,7 @@ class Connectionresults(am.ArrayObjman):
         the available maneuvers, between the connections allowed for the specific MODE.
         Return both the traveled connections and the related flows
         '''
-        print 'analyzing', ident, 'routes'
+        print('analyzing', ident, 'routes')
         edges = self._edges
         lanes = edges.parent.lanes
         connections = edges.parent.connections
@@ -451,9 +451,9 @@ class Connectionresults(am.ArrayObjman):
                         connections_list.append(element)
 
                 if connections_list == []:
-                    print 'Warning: no connections between a couple of successive edges for mode', mode
-                    print 'ids_lane_from_all', ids_lane_from_all
-                    print 'ids_lane_to_all', ids_lane_to_all
+                    print('Warning: no connections between a couple of successive edges for mode', mode)
+                    print('ids_lane_from_all', ids_lane_from_all)
+                    print('ids_lane_to_all', ids_lane_to_all)
                     n_wrong_connections += 1
                     if mode == 'motorcycle':
                         n_wrong_connections_moto += 1
@@ -477,7 +477,7 @@ class Connectionresults(am.ArrayObjman):
                     elif mode == 'taxi':
                         keep_right = self._is_keep_right_taxi
                     else:
-                        print 'WARNING - Not recognized mode'
+                        print('WARNING - Not recognized mode')
                         keep_right = True
 
                     n_good_connections += 1
@@ -495,8 +495,8 @@ class Connectionresults(am.ArrayObjman):
                             ids_traveled_connections.append(connection)
                         connection_flows[connection] += 1.
 # print ids_traveled_connections, connection_flows[ids_traveled_connections]
-        print 'n_good_connections:', n_good_connections
-        print 'n_wrong_connections:', n_wrong_connections
+        print('n_good_connections:', n_good_connections)
+        print('n_wrong_connections:', n_wrong_connections)
 # print 'n_wrong_connections_moto:', n_wrong_connections_moto
 # print 'n_wrong_connections_auto:', n_wrong_connections_auto
 # print 'n_wrong_connections_bike:', n_wrong_connections_bike
@@ -809,7 +809,7 @@ class Tripresults(am.ArrayObjman):
     #    self.import_sumoxml(filepath,self.get_group('tripdata'))
 
     def import_xml(self, sumo, datapaths):
-        print 'Tripresults.import_xml datapaths', datapaths
+        print('Tripresults.import_xml datapaths', datapaths)
         datapathkey = 'tripdatapath'
         if datapaths.has_key(datapathkey):
             self.import_tripdata_sumoxml(datapaths[datapathkey], sumo)
@@ -820,7 +820,7 @@ class Tripresults(am.ArrayObjman):
 
     def import_electricenergy_sumoxml_broke(self, filepath, sumo):
         element = 'vehicle'
-        print 'Tripresults.import_electricenergy_sumoxml', self.get_trips().ident, element, filepath
+        print('Tripresults.import_electricenergy_sumoxml', self.get_trips().ident, element, filepath)
         #id_type = 'edge',
         #reader = 'interval',
         attrconfigs = self.get_group('electricenergydata')
@@ -897,7 +897,7 @@ class Tripresults(am.ArrayObjman):
 
     def import_tripdata_sumoxml(self, filepath, sumo):
         element = 'tripinfo'
-        print 'Tripresults.import_tripdata_sumoxml', self.get_trips().ident, 'element', element, filepath
+        print('Tripresults.import_tripdata_sumoxml', self.get_trips().ident, 'element', element, filepath)
         #id_type = 'edge',
         #reader = 'interval',
         attrconfigs = self.get_group('tripdata')
@@ -1110,7 +1110,7 @@ class Edgeresults(am.ArrayObjman):
         """
         Keep only results of edges that belong to zone id_zone
         """
-        print 'filter_zoneedges', ids_zone
+        print('filter_zoneedges', ids_zone)
 
         zones = self.parent.parent.parent.landuse.zones
         ids_zoneedge = set()
@@ -1130,7 +1130,7 @@ class Edgeresults(am.ArrayObjman):
             self.del_rows(ids_res[inds])
 
     def import_edgedata(self, sumo,  filepath):
-        print 'import_edgedata', filepath
+        print('import_edgedata', filepath)
         # print '  group',self.get_group('edgedata')
         #attrnames_data = ['entered','left','arrived','departed']
         #attrnames_averaged = ['traveltime','density','waitingTime','speed',]
@@ -1242,11 +1242,11 @@ class Edgeresults(am.ArrayObjman):
         return True
 
     def import_edgenoise(self, sumo,  filepath):
-        print 'import_edgenoise', filepath
+        print('import_edgenoise', filepath)
         self.import_sumoxml(filepath, sumo, self.get_group('edgenoise'))
 
     def import_edgeemissions(self, sumo, filepath):
-        print 'import_edgeemissions', filepath
+        print('import_edgeemissions', filepath)
         #attrnames_data = ['fuel_abs','CO_abs','CO2_abs','NOx_abs','PMx_abs']
         #attrnames_averaged = ['fuel_normed','CO_normed','CO2_normed',]
         self.import_sumoxml(filepath, sumo, self.get_group('edgeemissions'))
@@ -1365,7 +1365,7 @@ class Edgeresults(am.ArrayObjman):
 
 class EdgeresultFilter(Process):
     def __init__(self, edgeresults,  logger=None, **kwargs):
-        print 'EdgeresultFilter.__init__'
+        print('EdgeresultFilter.__init__')
 
         # TODO: let this be independent, link to it or child??
 
@@ -1382,7 +1382,7 @@ class EdgeresultFilter(Process):
         zonechoices = {}
         for id_zone, name_zone in zip(ids_zone, zones.ids_sumo[ids_zone]):
             zonechoices[name_zone] = id_zone
-        print '  zonechoices', zonechoices
+        print('  zonechoices', zonechoices)
         # make for each possible pattern a field for prob
         # if len(zonechoices) > 0:
         self.ids_zone = attrsman.add(cm.ListConf('ids_zone', [],
@@ -1408,7 +1408,7 @@ class EdgeresultFilter(Process):
                                                   ))
 
     def do(self):
-        print 'EdgeresultFilter'
+        print('EdgeresultFilter')
         # links
         edgeresults = self.parent
         edgeresults.filter_zoneedges(self.ids_zone, self.is_invert)
@@ -1477,13 +1477,13 @@ class TrajectoryResults(am.ArrayObjman):
 
     def import_xml(self, sumo, datapaths):
         datapathkey = self.datapathkey.get_value()
-        print 'TrajectoryResults.import_xml datapathkey', datapathkey, datapaths.has_key(datapathkey)
+        print('TrajectoryResults.import_xml datapathkey', datapathkey, datapaths.has_key(datapathkey))
         if datapaths.has_key(datapathkey):
             self.import_trajectories_sumoxml(datapaths[datapathkey], sumo)
 
     def import_trajectories_sumoxml(self, filepath, sumo):
         element = 'vehicle'
-        print 'TrajectoryResults.import_trajectories_sumoxml', element, filepath
+        print('TrajectoryResults.import_trajectories_sumoxml', element, filepath)
 
         ids_sumo, times, trajectories, angles, speeds = read_trajectories(
             filepath, sumo, element)
@@ -1500,14 +1500,14 @@ class TrajectoryResults(am.ArrayObjman):
         ids_res = self.get_ids()
         times = self.times.get_value()
         for i, t in zip(xrange(len(times)), times):
-            print 79*'-'
-            print 'time=', t, 's', len(times)
+            print(79*'-')
+            print('time=', t, 's', len(times))
             for id_res, id_sumo_veh, traj, a, v in zip(ids_res, self.ids_sumo[ids_res], self.trajectories[ids_res], self.angles[ids_res], self.speeds[ids_res]):
                 # print '  id_sumo_veh',id_sumo_veh,id_res
                 # print '    v',v[i]
                 # print '    traj',traj[i]
                 # print '    a',a[i]
-                print '  id_sumo_veh', id_sumo_veh, ': (x,y)', traj[i], 'a=%.2f', a[i], ' v=%.2fm/s' % v[i], len(a), len(v), len(traj)
+                print('  id_sumo_veh', id_sumo_veh, ': (x,y)', traj[i], 'a=%.2f', a[i], ' v=%.2fm/s' % v[i], len(a), len(v), len(traj))
 
 
 class ElectricEnergyVehicleResults(am.ArrayObjman):
@@ -1600,7 +1600,7 @@ class ElectricEnergyVehicleResults(am.Ar
 
     def import_electricenergy_sumoxml(self, filepath, sumo):
         element = 'vehicle'
-        print 'ElectricEnergyresults.import_electricenergy_sumoxml', element, filepath
+        print('ElectricEnergyresults.import_electricenergy_sumoxml', element, filepath)
         #id_type = 'edge',
         #reader = 'interval',
         attrconfigs = self.get_group('electricenergydata')
@@ -1613,8 +1613,8 @@ class ElectricEnergyVehicleResults(am.Ar
         self.times.set_value(times)
         self.energies.set_value(energies)
 
-        print '  times=\n', self.times.get_value()
-        print '  energies=\n', self.energies.get_value()
+        print('  times=\n', self.times.get_value())
+        print('  energies=\n', self.energies.get_value())
 
         # print '  ids_sumo',ids_sumo
         # print '  results.keys()',results.keys()
@@ -1627,7 +1627,7 @@ class ElectricEnergyVehicleResults(am.Ar
         #ids_sumotrip = self.ids_trip.get_linktab().ids_sumo
         n = len(ids_sumo)
         ids = self.add_rows(n=n, ids_sumo=ids_sumo)
-        print '  n', n
+        print('  n', n)
         ind_range = np.arange(n, dtype=np.int32)
 
         #ids = np.zeros(n, dtype=np.int32)
@@ -1719,8 +1719,8 @@ class Simresults(cm.BaseObjman):
         self.routeresults = attrsman.add(cm.ObjConf(Routeresults('routeresults', self, scenario.demand.trips,
                                                                  scenario.net.edges), groupnames=['Route results']))
         # add trip results from all demand objects
-        print 'Simresults._init_attributes'
-        print '  scenario.demand.get_demandobjects()', scenario.demand.get_demandobjects()
+        print('Simresults._init_attributes')
+        print('  scenario.demand.get_demandobjects()', scenario.demand.get_demandobjects())
         for demandobj in scenario.demand.get_demandobjects():
             demandobj.config_results(self)
 
@@ -1776,32 +1776,32 @@ class Simresults(cm.BaseObjman):
     #    #edgedatapath=None, edgenoisepath=None, edgeemissionspath = None, routesdatapath=None, tripdatapath=None
 
     def import_xml(self, sumo, **datapaths):
-        print 'Simresults.import_xml', self.get_ident_abs()
+        print('Simresults.import_xml', self.get_ident_abs())
 # print '  datapaths',datapaths
         # import first all edge oriented results for the whole net
         if datapaths.has_key('edgedatapath'):
-            print 'import edge data'
+            print('import edge data')
             self.edgeresults.import_edgedata(sumo, datapaths['edgedatapath'])
 
         if datapaths.has_key('edgenoisepath'):
-            print 'import edge noise'
+            print('import edge noise')
             self.edgeresults.import_edgenoise(sumo, datapaths['edgenoisepath'])
 
         if datapaths.has_key('edgeemissionspath'):
-            print 'import edge emissons'
+            print('import edge emissons')
             self.edgeresults.import_edgeemissions(sumo, datapaths['edgeemissionspath'])
 
         # import all other resultobjects
         for resultobj in self.get_attrsman().get_group_attrs('Results').values():
-            print '  import other resultobject', resultobj.ident
+            print('  import other resultobject', resultobj.ident)
             resultobj.import_xml(sumo, datapaths)
 
         if datapaths.has_key('routesdatapath'):
-            print 'import route results'
+            print('import route results')
             self.routeresults.import_xml(sumo, datapaths)
-            print 'importedge flows'
+            print('importedge flows')
             self.edgeresults.import_edgeflows(sumo, datapaths['edgedatapath'])
-            print 'import connection flows'
+            print('import connection flows')
             self.connectionresults.evaluate_results(sumo, datapaths)
 
     # def process(self, process = None):
@@ -1942,7 +1942,7 @@ class IntervalAvReader2(handler.ContentH
         element is "lane" or "edge" or "tripinfo"
         attrnames is a list of attribute names to read.
         """
-        print 'IntervalAvReader2', element
+        print('IntervalAvReader2', element)
         # print '  attrsconfigs_cumulative'
         # for attrconfig in attrsconfigs_cumulative: print '    ',attrconfig.attrname
 
@@ -2085,7 +2085,7 @@ class ElectricalEnergyReader(IntervalAvR
         element is "lane" or "edge" or "tripinfo"
         attrnames is a list of attribute names to read.
         """
-        print 'ElectricalEnergyReader', element
+        print('ElectricalEnergyReader', element)
         # print '  attrsconfigs_cumulative',attrsconfigs_cumulative
         # print '  attrsconfigs_average',attrsconfigs_average
         IntervalAvReader2.__init__(self, element, sumo,  attrsconfigs_cumulative, attrsconfigs_average)
@@ -2295,7 +2295,7 @@ class TripresultReader(IntervalAvReader2
 
 
 def read_electrical_energy(filepath, sumo,  element, attrsconfigs):
-    print 'read_electrical_energy'
+    print('read_electrical_energy')
     attrsconfigs_cumulative = []
     attrsconfigs_average = []
     for attrsconfig in attrsconfigs:
@@ -2323,7 +2323,7 @@ class ElectricalEnergyReader(IntervalAvR
         element is "lane" or "edge" or "tripinfo"
         attrnames is a list of attribute names to read.
         """
-        print 'ElectricalEnergyReader', element
+        print('ElectricalEnergyReader', element)
         # print '  attrsconfigs_cumulative',attrsconfigs_cumulative
         # print '  attrsconfigs_average',attrsconfigs_average
         IntervalAvReader2.__init__(self, element, sumo,  attrsconfigs_cumulative, attrsconfigs_average)
@@ -2435,7 +2435,7 @@ class TrajectoryReader(IntervalAvReader2
         element is "lane" or "edge" or "tripinfo"
         attrnames is a list of attribute names to read.
         """
-        print 'TrajectoryReader', element
+        print('TrajectoryReader', element)
         # print '  attrsconfigs_cumulative',attrsconfigs_cumulative
         # print '  attrsconfigs_average',attrsconfigs_average
         IntervalAvReader2.__init__(self, element, sumo,  [], [])
@@ -2518,7 +2518,7 @@ class TrajectoryReader(IntervalAvReader2
 
 
 def read_trajectories(filepath, sumo,  element):
-    print 'read_trajectories', element
+    print('read_trajectories', element)
 
     reader = TrajectoryReader(element, sumo)
     parse(filepath, reader)
@@ -2563,7 +2563,7 @@ def read_interval2(filepath, sumo,  elem
 
 
 def read_tripresult(filepath, sumo,  trips, element, attrsconfigs):
-    print 'read_tripresult', filepath, trips.ident, 'element', element
+    print('read_tripresult', filepath, trips.ident, 'element', element)
     attrsconfigs_cumulative = []
     attrsconfigs_average = []
     for attrsconfig in attrsconfigs:
--- a/tools/contributed/sumopy/coremodules/simulation/results_mpl.py
+++ b/tools/contributed/sumopy/coremodules/simulation/results_mpl.py
@@ -82,7 +82,7 @@ class Resultplotter(PlotoptionsMixin, Pr
         # if self.axis  is None:
         axis = init_plot()
 
-        if (self.edgeattrname is not ""):
+        if (self.edgeattrname != ""):
             resultattrconf = getattr(self.parent.edgeresults, self.edgeattrname)
             ids = self.parent.edgeresults.get_ids()
             if self.is_show_title:
@@ -117,7 +117,7 @@ class ElectricalEnergyResultsPlotter(Plo
         self._init_common('electricalenergyresultsplotter', parent=results, name=name,
                           info=info, logger=logger)
 
-        print 'ElectricalEnergyResultsPlotter.__init__', results, self.parent, len(self.get_eneryresults())
+        print('ElectricalEnergyResultsPlotter.__init__', results, self.parent, len(self.get_eneryresults()))
         attrsman = self.get_attrsman()
 
         self.add_plotoptions_lineplot(**kwargs)
@@ -128,16 +128,16 @@ class ElectricalEnergyResultsPlotter(Plo
 
     def show(self):
         eneryresults = self.get_eneryresults()
-        print 'show', eneryresults
+        print('show', eneryresults)
         # print '  dir(vehicleman)',dir(vehicleman)
 
-        print '  len(eneryresults)', len(eneryresults)
+        print('  len(eneryresults)', len(eneryresults))
         if len(eneryresults) > 0:
             plt.close("all")
             self.plot_power()
 
     def plot_power(self):
-        print 'plot_power'
+        print('plot_power')
         eneryresults = self.get_eneryresults()
 
         times = eneryresults.times.get_value()
@@ -193,7 +193,7 @@ class SpeedprofilePlotter(PlotoptionsMix
         self._init_common('speedprofileplotter', parent=results, name=name,
                           info=info, logger=logger)
 
-        print 'SpeedprofilePlotter.__init__', results, self.parent, len(self.get_results())
+        print('SpeedprofilePlotter.__init__', results, self.parent, len(self.get_results()))
         attrsman = self.get_attrsman()
 
         self.id_veh_sumo = attrsman.add(cm.AttrConf('id_veh_sumo', kwargs.get('id_veh_sumo', ''),
@@ -211,10 +211,10 @@ class SpeedprofilePlotter(PlotoptionsMix
 
     def show(self):
         results = self.get_results()
-        print 'show', results
+        print('show', results)
         id_res = results.ids_sumo.get_id_from_index(self.id_veh_sumo)
 
-        print '  len(results)', len(results), results.ids_sumo.has_index(self.id_veh_sumo)
+        print('  len(results)', len(results), results.ids_sumo.has_index(self.id_veh_sumo))
         if results.ids_sumo.has_index(self.id_veh_sumo):
             id_res = results.ids_sumo.get_id_from_index(self.id_veh_sumo)
             plt.close("all")
@@ -224,7 +224,7 @@ class SpeedprofilePlotter(PlotoptionsMix
             return False
 
     def plot_speedprofile(self, times, speeds):
-        print 'plot_speedprofile'
+        print('plot_speedprofile')
 
         if len(times) < 2:
             return False
@@ -278,7 +278,7 @@ class XYEdgeresultsPlotter(PlotoptionsMi
         self._init_common('xyedgeresultsplotter', parent=results, name=name,
                           info=info, logger=logger)
 
-        print 'XYResultsPlotter.__init__', results
+        print('XYResultsPlotter.__init__', results)
         attrsman = self.get_attrsman()
 
         # edgeresultes....
@@ -315,15 +315,15 @@ class XYEdgeresultsPlotter(PlotoptionsMi
         self.add_save_options(**kwargs)
 
     def show(self):
-        print 'show'
+        print('show')
 
         plt.close("all")
         self.plot_xy()
 
     def plot_xy(self):
-        print 'plot_xy', self.edgeattrname_y, 'vs', self.edgeattrname_x
+        print('plot_xy', self.edgeattrname_y, 'vs', self.edgeattrname_x)
 
-        if (self.edgeattrname_x is not "") & (self.edgeattrname_x is not ""):
+        if (self.edgeattrname_x != "") & (self.edgeattrname_x != ""):
             resultattrconf_x = getattr(self.parent.edgeresults, self.edgeattrname_x)
             resultattrconf_y = getattr(self.parent.edgeresults, self.edgeattrname_y)
 
@@ -363,7 +363,7 @@ class XYEdgeresultsPlotter(PlotoptionsMi
             offset = my - (m*mx)
 
             x_linreg = np.array([np.min(x[inds]), np.max(x[inds])], dtype=np.float)
-            print ' m', m, 'offset', offset
+            print(' m', m, 'offset', offset)
             # print ' x_linreg',offset * x_linreg
             ax.plot(x_linreg, offset + m*x_linreg,
                     label=r'$%.3f+%.3fx$, $R^2=%.3f$' % (offset, m, R2),
@@ -431,7 +431,7 @@ class TraveltimePlotter(PlotoptionsMixin
         self._init_common('isochoneplotter', parent=results, name=name,
                           info=info, logger=logger)
 
-        print 'TraveltimePlotter.__init__', results, self.parent
+        print('TraveltimePlotter.__init__', results, self.parent)
         attrsman = self.get_attrsman()
         scenario = self.get_scenario()
 
@@ -559,7 +559,7 @@ class TraveltimePlotter(PlotoptionsMixin
 
         if 0:  # self.is_isochrone:
 
-            print 'isochrone plot not yet implemented'
+            print('isochrone plot not yet implemented')
 
             times_point = np.zeros(np.max(ids_point)+1)
             for id_point in ids_point:
@@ -620,7 +620,7 @@ class TraveltimePlotter(PlotoptionsMixin
                     else:
                         isochrone_shapes[i].append([(points.coords[iso_points[np.argmax(iso_points[:, 3]), 1]][0]),
                                                     (points.coords[iso_points[np.argmax(iso_points[:, 3]), 1]][1])])
-        print isochrone_shapes
+        print(isochrone_shapes)
         for isochrone_shape in isochrone_shapes:
             verts = np.array(isochrone_shape)[:, :2].tolist()
             verts.append([0, 0])
@@ -637,9 +637,9 @@ class TraveltimePlotter(PlotoptionsMixin
 
             if len(isochrone_shape) > 4:
                 zone_shape = isochrone_shape
-                print zone_shape
+                print(zone_shape)
                 for zone_shape_coords, i in zip(isochrone_shape, range(len(isochrone_shape))):
-                    print i, len(isochrone_shape)
+                    print(i, len(isochrone_shape))
                     if i == 0:
                         zone_shape[i] = ((np.array(isochrone_shape[i])+np.array(isochrone_shape[i+1])+np.array(
                             isochrone_shape[-1])+np.array(isochrone_shape[i+2])+np.array(isochrone_shape[-2]))/5.).tolist()
--- a/tools/contributed/sumopy/coremodules/simulation/simplaconfig.py
+++ b/tools/contributed/sumopy/coremodules/simulation/simplaconfig.py
@@ -42,7 +42,7 @@ try:
     import simpla
 
 except:
-    print 'WARNING: No module simpla in syspath. Please provide SUMO_HOME.'
+    print('WARNING: No module simpla in syspath. Please provide SUMO_HOME.')
 
     simpla = None
 
@@ -287,7 +287,7 @@ class SimplaConfig(DemandobjMixin, cm.Ba
         if self.is_enabled:
             # self.add_vtypes()# done in get_writexmlinfo means in get_vtypes()
             self.export_config()
-            print 'Simplaconfig.prepare_sim', self.configfilepath, self.is_enabled
+            print('Simplaconfig.prepare_sim', self.configfilepath, self.is_enabled)
             simpla.load(self.configfilepath)
 
     def finish_sim(self):
@@ -303,7 +303,7 @@ class SimplaConfig(DemandobjMixin, cm.Ba
         """
         Write simpla xml config file
         """
-        print 'Simplaconfig.write_xml'
+        print('Simplaconfig.write_xml')
         fd.write(xm.begin(self.xmltag, indent))
         attrsman = self.get_attrsman()
         vtypes = self.parent.get_scenario().demand.vtypes
@@ -372,7 +372,7 @@ class SimplaConfig(DemandobjMixin, cm.Ba
         This function is called before writing vtypes.
         These vtypes should be deleted after the export.
         """
-        print 'Simplaconfig.add_vtypes'
+        print('Simplaconfig.add_vtypes')
         self._typemap = {}
         vtypes = self.get_scenario().demand.vtypes
         for id_mode in self.ids_platoonmodes:
@@ -433,7 +433,7 @@ class SimplaConfig(DemandobjMixin, cm.Ba
         if not self.is_enabled:
             return []
 
-        print 'Simpla.get_vtypes'
+        print('Simpla.get_vtypes')
         plattype_original = 'original'
         # add vtypes for platooning here
         self.add_vtypes()
@@ -457,7 +457,7 @@ class SimplaConfig(DemandobjMixin, cm.Ba
                 if plattype != plattype_original:
                     ids_vtypes_plat.append(id_vtype)
 
-        print 'del_vtypes', ids_vtypes_plat
+        print('del_vtypes', ids_vtypes_plat)
         vtypes.del_rows(ids_vtypes_plat)
         self._typemap = {}
 
@@ -467,7 +467,7 @@ class SimplaConfig(DemandobjMixin, cm.Ba
                     coloroffset=np.zeros(4, np.float32),
                     colorfactor=np.ones(4, np.float32),
                     carfollowermodel='Krauss'):
-        print '_add_vtypes', ids, plattype
+        print('_add_vtypes', ids, plattype)
         n = len(ids)
         ids_new = vtypes.add_rows(n=len(ids))
         for colconfig in vtypes.get_attrsman()._colconfigs:
--- a/tools/contributed/sumopy/coremodules/simulation/simulation.py
+++ b/tools/contributed/sumopy/coremodules/simulation/simulation.py
@@ -42,7 +42,7 @@ class Simulation(cm.BaseObjman):
         self._init_constants()
 
     def _init_attributes(self):
-        print 'Simulation._init_attributes id', id(self), self.parent.rootname  # ,dir(self)
+        print('Simulation._init_attributes id', id(self), self.parent.rootname)  # ,dir(self)
         attrsman = self.get_attrsman()
 
         # if self.get_version()<0.2:
--- a/tools/contributed/sumopy/coremodules/simulation/sumo.py
+++ b/tools/contributed/sumopy/coremodules/simulation/sumo.py
@@ -51,7 +51,7 @@ try:
 
 
 except:
-    print 'WARNING: No module traci in syspath. Please provide SUMO_HOME.'
+    print('WARNING: No module traci in syspath. Please provide SUMO_HOME.')
 
     traci = None
 
@@ -649,7 +649,7 @@ class Sumo(CmlMixin, Process):
                                                  perm='rw',
                                                  name='Start immediately',
                                                  info='Immediate start of simulation, without waiting to press the start button in GUI mode.',
-                                                 is_enabled=lambda self: self.guimode is not 'nogui',
+                                                 is_enabled=lambda self: self.guimode != 'nogui',
                                                  ))
 
         self.is_quit_on_end = attrsman.add(cm.AttrConf('is_quit_on_end', kwargs.get('is_quit_on_end', False),
@@ -657,7 +657,7 @@ class Sumo(CmlMixin, Process):
                                                        perm='rw',
                                                        name='Quit on end',
                                                        info='Quits the GUI when the simulation stops.',
-                                                       is_enabled=lambda self: self.guimode is not 'nogui',
+                                                       is_enabled=lambda self: self.guimode != 'nogui',
                                                        ))
 
         self.logfilepath = attrsman.add(cm.AttrConf('logfilepath', logfilepath,
@@ -896,7 +896,7 @@ class Sumo(CmlMixin, Process):
         Called by run after is_ready verification
         """
 
-        print 'do... '
+        print('do... ')
 
         scenario = self.parent
 
@@ -1026,7 +1026,7 @@ class Sumo(CmlMixin, Process):
             #is_exclude_emptylanes =self.is_exclude_emptylanes,
             seed=self.seed,
             filepath_gui=filepath_gui,
-            is_openscenegraph=self.guimode is 'openscene',
+            is_openscenegraph=self.guimode == 'openscene',
             width_pedestrian_striping=scenario.demand.vtypes.width_pedestrian_striping.get_value(),
             slowdownfactor_pedestrian_striping=scenario.demand.vtypes.slowdownfactor_pedestrian_striping.get_value(),
             jamtime_pedestrian_striping=scenario.demand.vtypes.jamtime_pedestrian_striping.get_value(),
@@ -1047,10 +1047,10 @@ class Sumo(CmlMixin, Process):
         )
 
         if self._cmlfilepath is None:
-            print '  call run_cml'
+            print('  call run_cml')
             return self.run_cml(cml=self.get_cml())
         else:
-            print '  do not simulate but write cml to', self._cmlfilepath
+            print('  do not simulate but write cml to', self._cmlfilepath)
             f = open(self._cmlfilepath, "w+")
             f.write(self.get_cml()+'\n')
 
@@ -1065,7 +1065,7 @@ class Sumo(CmlMixin, Process):
         """
         Imports simulation resuts into results object.
         """
-        print 'import_results'
+        print('import_results')
 
         # first a dict is created with available dataname as key
         # and filepath as value
@@ -1125,10 +1125,10 @@ class Sumo(CmlMixin, Process):
             p = P
         else:
             p = ''
-        print 'get_cml p=%s=' % p
+        print('get_cml p=%s=' % p)
         # print '  self.configfilepath=%s='%self.configfilepath
         # print '  self.logfilepath=%s='%self.logfilepath
-        if self.guimode is 'nogui':
+        if self.guimode == 'nogui':
             command = 'sumo'
         else:
             command = 'sumo-gui'
@@ -1249,7 +1249,7 @@ class SumoTraci(Sumo):
     def run_cml(self, cml):
         scenario = self.parent
         cmllist = cml.split(' ')
-        print 'SumoTraci.run_cml', cmllist
+        print('SumoTraci.run_cml', cmllist)
         traci.start(cmllist)
 
         simplaconfig = self.parent.simulation.simplaconfig
@@ -1259,7 +1259,7 @@ class SumoTraci(Sumo):
         self.simtime = self.simtime_start
         self.duration = 1.0+self.simtime_end-self.simtime_start
         self.get_attrsman().status.set('running')
-        print '  traci started', self.get_attrsman().status.get()
+        print('  traci started', self.get_attrsman().status.get())
         simobjects = []
 
         for simobj in self.parent.simulation.get_simobjects():
@@ -1288,8 +1288,8 @@ class SumoTraci(Sumo):
     def step(self):
         # called interactively
         # when gui it is called through the timer function
-        print 79*'='
-        print "simstep", self.simtime, self.simtime_end, self.simtime >= self.simtime_end
+        print(79*'=')
+        print("simstep", self.simtime, self.simtime_end, self.simtime >= self.simtime_end)
         traci.simulationStep()
         for i in xrange(len(self.simobjects)):
             # for time_last, time_sample, simfunc in self.simobjects:
@@ -1303,18 +1303,18 @@ class SumoTraci(Sumo):
 
         if self.simtime >= self.simtime_end:  # | (not (traci.simulation.getMinExpectedNumber() > 0)):
             #   if self.simtime >= self.simtime_end:
-            print '    end of simulation reached at', self.simtime
+            print('    end of simulation reached at', self.simtime)
             return self.finish_sim()
 
         self.simtime += self.time_step
 
     def finish_sim(self):
-        print 'finish_sim'
+        print('finish_sim')
         # for demandobj in self.parent.demand.get_demandobjects():
         #    print '  finish_sim',demandobj.ident
         #    #demandobj.finish_sim(self) # why not for sim objects?
         traci.close()
-        print '    traci closed.'
+        print('    traci closed.')
         self.get_attrsman().status.set('success')
 
         simplaconfig = self.parent.simulation.simplaconfig
@@ -1841,13 +1841,13 @@ class Duaiterate(CmlMixin, Sumo):  # att
                 # print '  new since 1.8.0 ?'
                 # print '    workdirpath',self.workdirpath,'step_last',step_last
                 resultdir = os.path.join(self.workdirpath, str(step_last))
-                print '    resultdir', resultdir
+                print('    resultdir', resultdir)
                 filename = self.parent.get_rootfilename() + "_%03d.rou.xml" % (self.get_last_step(),)
-                print '    filename', filename
+                print('    filename', filename)
                 #routefilepath_final = os.path.join(self.workdirpath, str(step_last),'.'.join(self.routefilepath.split('.')[:-2]) + "_%03d.rou.xml"%(step_last,))
                 routefilepath_final = os.path.join(resultdir, filename)
 
-            print '  load routes from file ', routefilepath_final
+            print('  load routes from file ', routefilepath_final)
             if os.path.isfile(routefilepath_final):
                 scenario.demand.import_routes_xml(routefilepath_final)
 
@@ -1869,7 +1869,7 @@ class Duaiterate(CmlMixin, Sumo):  # att
                 else:  # new since 1.8.0 ?'
                     for step in xrange(self.step_first, step_last):
                         filepath = os.path.join(self.workdirpath, str(step))
-                        print '  delete dir', filepath
+                        print('  delete dir', filepath)
                         if os.path.isdir(filepath):
                             # print '    delete now'
                             try:
@@ -1886,7 +1886,7 @@ class Duaiterate(CmlMixin, Sumo):  # att
         """
         Imports simulation resuts into results object.
         """
-        print 'import_results'
+        print('import_results')
 
         # currently nothing is imported in results only routs are
         # reimported in trip database
--- a/tools/contributed/sumopy/coremodules/simulation/sumo_virtualpop.py
+++ b/tools/contributed/sumopy/coremodules/simulation/sumo_virtualpop.py
@@ -51,7 +51,7 @@ if __name__ == '__main__':
     else:
         filepath_simstats = None
 
-print 'sys.path', sys.path
+print('sys.path', sys.path)
 
 
 #from coremodules.demand import vehicles as ve
@@ -76,7 +76,7 @@ seed = 1234
 logfilepath = 'log.txt'
 sumologfilepath = 'log_sumo.txt'
 ###########################################################
-print 'script_vp: initialize sim cmlfilepath=', cmlfilepath
+print('script_vp: initialize sim cmlfilepath=', cmlfilepath)
 
 # Load the scenario
 
@@ -168,7 +168,7 @@ ids_pers = virtualpop.get_ids()
 
 if is_not_first_iter:
     # load previous results, if cmlfilepath is present
-    print '  importing and procerroessing previous results'
+    print('  importing and procerroessing previous results')
 
     # store plans before reselection
     ids_plan_before = virtualpop.ids_plan[ids_pers].copy()
@@ -180,7 +180,7 @@ if is_not_first_iter:
     # decrease c_probit and fraction for the nex iteration
     c_probit = c_probit/(decrease+1)**n_iter
     fraction = fraction/(decrease+1)**n_iter
-    print 'n_iter:', n_iter, 'c_probit:', c_probit, 'fraction:', fraction
+    print('n_iter:', n_iter, 'c_probit:', c_probit, 'fraction:', fraction)
     # select plans according to last simulation results
     sim.import_results()  # will update plan travel times
     virtualpop.select_plans_min_time_exec_est(fraction=fraction,
@@ -193,7 +193,7 @@ if is_not_first_iter:
 
 
 else:
-    print '  first iteration'
+    print('  first iteration')
     # select all plans with the minimum estimated time
     virtualpop.select_plans_min_time_est(fraction=1.0,
                                          c_probit=c_probit_ini)
--- a/tools/contributed/sumopy/coremodules/simulation/sumo_virtualpop_iterate.py
+++ b/tools/contributed/sumopy/coremodules/simulation/sumo_virtualpop_iterate.py
@@ -32,7 +32,7 @@ import time
 
 
 def start_iterations(scenariofilepath, n_iter, simscriptfilepath):
-    print 'sumo_virtualpop_iterate.run', scenariofilepath
+    print('sumo_virtualpop_iterate.run', scenariofilepath)
     cmlfilepath = os.path.join(os.path.dirname(simscriptfilepath), 'sumo_virtualpop_cml.bash')
 
     P = '"'
@@ -43,37 +43,37 @@ def start_iterations(scenariofilepath, n
 
     for i in range(1, n_iter+1):
 
-        print '  Start preparation of iteration %d.' % i
+        print('  Start preparation of iteration %d.' % i)
         proc = subprocess.Popen(cml_script, shell=True)
         proc.wait()
         if proc.returncode == 0:
-            print '  Preparation of iteration %d successful' % i
+            print('  Preparation of iteration %d successful' % i)
             f = open(cmlfilepath, "r")
             cml = f.readline()
             f.close()
 
             # time.sleep(10)
 
-            print '  Start SUMO microsimulator'
-            print '  cml=', cml
+            print('  Start SUMO microsimulator')
+            print('  cml=', cml)
             proc = subprocess.Popen(cml, shell=True)
             proc.wait()
             if proc.returncode == 0:
-                print '  Microsimulation of iteration %d successful.' % i
+                print('  Microsimulation of iteration %d successful.' % i)
             else:
-                print '  Error in microsimulation of iteration %d.' % i
+                print('  Error in microsimulation of iteration %d.' % i)
         else:
-            print '  Error in preparation of iteration %d successful' % i
-    print '  Start preparation of iteration %d.' % i
+            print('  Error in preparation of iteration %d successful' % i)
+    print('  Start preparation of iteration %d.' % i)
     proc = subprocess.Popen(cml_script, shell=True)
     proc.wait()
     if proc.returncode == 0:
-        print 'Save last results.'
+        print('Save last results.')
         f = open(cmlfilepath, "r")
         cml = f.readline()
         f.close()
     else:
-        print'error on the last data backup'
+        print('error on the last data backup')
 
         # time.sleep(10)
 
--- a/tools/contributed/sumopy/coremodules/simulation/taxi.py
+++ b/tools/contributed/sumopy/coremodules/simulation/taxi.py
@@ -133,7 +133,7 @@ class TaxiService(DemandobjMixin, cm.Bas
         """
         Write taxi configuration to sumo configuration file feed.
         """
-        print 'TaxiService.write_config is_enabled', self.is_enabled
+        print('TaxiService.write_config is_enabled', self.is_enabled)
         if self.is_enabled:
             attrsman = self.get_attrsman()
 
--- a/tools/contributed/sumopy/coremodules/simulation/wxgui.py
+++ b/tools/contributed/sumopy/coremodules/simulation/wxgui.py
@@ -33,7 +33,7 @@ try:
     import results_mpl as results_mpl
     is_mpl = True  # we have matplotlib support
 except:
-    print "WARNING: python matplotlib package not installed, no matplotlib plots."
+    print("WARNING: python matplotlib package not installed, no matplotlib plots.")
     is_mpl = False
 
 
@@ -82,12 +82,12 @@ class WxGui(ModuleGui):
         Set mainframe and initialize widgets to various places.
         """
         self._mainframe = mainframe
-        print 'SimulationGui.init_widgets'
+        print('SimulationGui.init_widgets')
         # mainframe.browse_obj(self._net)
         self.make_menu()
         self.make_toolbar()
         self._resultviewer = mainframe.add_view("Result viewer", Resultviewer)
-        print '  self._resultviewer', self._resultviewer, self._resultviewer.get_drawing()
+        print('  self._resultviewer', self._resultviewer, self._resultviewer.get_drawing())
 
     def refresh_widgets(self):
         """
@@ -96,11 +96,11 @@ class WxGui(ModuleGui):
         dependent on the availability of data. 
         """
         scenario = self.get_scenario()
-        print 'simulation.WxGui.refresh_widgets', self._simulation != scenario.simulation
+        print('simulation.WxGui.refresh_widgets', self._simulation != scenario.simulation)
         is_refresh = False
 
         if self._simulation != scenario.simulation:
-            print '  id(self._simulation)', id(self._simulation), 'id(scenario.simulation)', id(scenario.simulation), scenario.rootname
+            print('  id(self._simulation)', id(self._simulation), 'id(scenario.simulation)', id(scenario.simulation), scenario.rootname)
             del self._simulation
             self._simulation = scenario.simulation
             is_refresh = True
@@ -110,11 +110,11 @@ class WxGui(ModuleGui):
         # if is_refresh
         if self._simulation.results.is_modified():
             #
-            print '  refresh of _resultviewer'
+            print('  refresh of _resultviewer')
             drawing = self._resultviewer.set_results(self._simulation.results)
         #    canvas = self._neteditor.get_canvas()
         else:
-            print '  no refresh of _resultviewer :('
+            print('  no refresh of _resultviewer :(')
 
     def make_menu(self):
         # print 'make_menu'
@@ -750,7 +750,7 @@ class WxGui(ModuleGui):
 
         # this does not return until the dialog is closed.
         #val = dlg.ShowModal()
-        print 'open_sumodialog_interactive'
+        print('open_sumodialog_interactive')
         dlg.Show()
         dlg.MakeModal(True)
         # print '  val,val == wx.ID_OK',val,wx.ID_OK,wx.ID_CANCEL,val == wx.ID_CANCEL
@@ -789,9 +789,9 @@ class WxGui(ModuleGui):
         results = self._simulation.results
         turnflows = self.get_scenario().demand.turnflows
         ids_edge, flows = turnflows.estimate_entered()
-        print 'on_estimate_entered_turnflows'
-        print 'ids_edge', ids_edge
-        print 'flows', flows
+        print('on_estimate_entered_turnflows')
+        print('ids_edge', ids_edge)
+        print('flows', flows)
         results.edgeresults.add_entered_est(*turnflows.estimate_entered())
         self._mainframe.browse_obj(results.edgeresults)
         self._mainframe.select_view(name="Result viewer")  # !!!!!!!!tricky, crashes without
--- a/tools/contributed/sumopy/examples/scripts/sumopy_sim.py
+++ b/tools/contributed/sumopy/examples/scripts/sumopy_sim.py
@@ -39,7 +39,7 @@ if len(sys.argv) >= 2:
     if len(sys.argv) == 3:
         resultfilepath = sys.argv[2]
 else:
-    print __doc__
+    print(__doc__)
     sys.exit(0)
 
 myscenario = scenario.load_scenario(simfilepath)
@@ -111,7 +111,7 @@ microsim.do()  # now open SUMO and run s
 
 
 if resultfilepath is not None:
-    print 'saving results in', resultfilepath
+    print('saving results in', resultfilepath)
     myscenario.simulation.results.save(resultfilepath)
 
 # import all results from xml and put them into myscenario.simulation.results
@@ -135,9 +135,9 @@ tripres.export_csv(rootfilepath+'.tripre
 
 # do some analyses
 ids_tripres = tripres.get_ids()
-print 'numer of arrived vehicles:', len(ids_tripres)
-print 'Total triplength: %.2fKm' % (0.001*np.mean(tripres.routeLength[ids_tripres]))
-print 'Average speed: %.2fKm/s' % (3.6*np.mean(tripres.routeLength[ids_tripres]/tripres.duration[ids_tripres]))
+print('numer of arrived vehicles:', len(ids_tripres))
+print('Total triplength: %.2fKm' % (0.001*np.mean(tripres.routeLength[ids_tripres])))
+print('Average speed: %.2fKm/s' % (3.6*np.mean(tripres.routeLength[ids_tripres]/tripres.duration[ids_tripres])))
 
 ids_edgeres = edgeres.get_ids()
-print 'Total fuel consumption: %.2f liter' % (0.001*np.sum(edgeres.fuel_abs[ids_edgeres]))
+print('Total fuel consumption: %.2f liter' % (0.001*np.sum(edgeres.fuel_abs[ids_edgeres])))
--- a/tools/contributed/sumopy/plugins/common/__init__.py
+++ b/tools/contributed/sumopy/plugins/common/__init__.py
@@ -18,7 +18,7 @@
 
 __version__ = "0.0"
 
-print 'init', __name__
+print('init', __name__)
 
 
 def get_wxgui():
--- a/tools/contributed/sumopy/plugins/hcprt/__init__.py
+++ b/tools/contributed/sumopy/plugins/hcprt/__init__.py
@@ -18,7 +18,7 @@
 
 __version__ = "0.0"
 
-print 'init', __name__
+print('init', __name__)
 
 
 def get_wxgui():
--- a/tools/contributed/sumopy/plugins/hcprt/hcprt.py
+++ b/tools/contributed/sumopy/plugins/hcprt/hcprt.py
@@ -148,7 +148,7 @@ class Compressors(am.ArrayObjman):
         ])
 
     def make(self, id_detectoredge=None, **kwargs):
-        print 'make', kwargs
+        print('make', kwargs)
         # print '  ids_shuntedge',kwargs.get('ids_shuntedge',None),type(kwargs.get('ids_shuntedge',None)[0])
         id_comp = self.add_row(ids_shuntedges=kwargs.get('ids_shuntedge', None),
                                ids_detectoredge=id_detectoredge
@@ -158,13 +158,13 @@ class Compressors(am.ArrayObjman):
         return id_comp
 
     def update(self, id_comp):
-        print 'update id_comp', id_comp
+        print('update id_comp', id_comp)
         edges = self.get_scenario().net.edges
 
         self.ids_detectoredge[id_comp] = edges.get_incoming(self.ids_shuntedges[id_comp][0])[0]
 
     def update_all(self):
-        print 'update_all'
+        print('update_all')
         for id_comp in self.get_ids():
             self.update(id_comp)
 
@@ -172,7 +172,7 @@ class Compressors(am.ArrayObjman):
         return self.parent.get_scenario()
 
     def prepare_sim(self, process):
-        print 'Compressors.prepare_sim'
+        print('Compressors.prepare_sim')
         net = self.get_scenario().net
         nodes = net.nodes
         edges = net.edges
@@ -220,7 +220,7 @@ class Compressors(am.ArrayObjman):
         self.ids_vehs_detect_sumo = np.zeros(n_id_max, dtype=np.object)
 
         for id_comp, ids_shuntedge in zip(ids, self.ids_shuntedges[ids]):
-            print '  id_comp', id_comp
+            print('  id_comp', id_comp)
             n_shunts = len(ids_shuntedge)  # first edge is not a real shunt!!
 
             queues = n_shunts*[None]
@@ -240,16 +240,16 @@ class Compressors(am.ArrayObjman):
             self.releasetimes_queues[id_comp] = n_shunts*[0]
 
             self.ids_vehs_detect_sumo[id_comp] = set()
-            print '  capacities', self.capacitiess[id_comp]
-            print '  queues', self.queuess[id_comp]
+            print('  capacities', self.capacitiess[id_comp])
+            print('  queues', self.queuess[id_comp])
 
         return [(self.time_update.get_value(), self.process_step),
                 ]
 
     def process_step(self, process):
         simtime = process.simtime
-        print 79*'_'
-        print 'Compressors.process_step at', simtime
+        print(79*'_')
+        print('Compressors.process_step at', simtime)
         net = self.get_scenario().net
         edges = net.edges
         vehicles = self.parent.prtvehicles
@@ -276,19 +276,19 @@ class Compressors(am.ArrayObjman):
                    self.releasetimes_queues[ids],
                    ):
             n_queues = len(queues)
-            print '  '+30*'><'
-            print '  Compressor id_comp', id_comp, 'n_queues', n_queues
+            print('  '+30*'><')
+            print('  Compressor id_comp', id_comp, 'n_queues', n_queues)
             # check for new vehicle arrivals/departures
 
             ids_veh_entered_sumo, ids_veh_left_sumo,  ids_veh_new_sumo = vehicles.get_entered_left(
                 id_detectedge_sumo, ids_veh_detect_sumo)
 
             if 1:
-                print '  id_detectedge_sumo', id_detectedge_sumo
-                print '  ids_veh_detect_sumo', ids_veh_detect_sumo
-                print '  ids_veh_new_sumo', ids_veh_new_sumo
-                print '  ids_veh_entered_sumo=', ids_veh_entered_sumo
-                print '  ids_veh_left_sumo=', ids_veh_left_sumo
+                print('  id_detectedge_sumo', id_detectedge_sumo)
+                print('  ids_veh_detect_sumo', ids_veh_detect_sumo)
+                print('  ids_veh_new_sumo', ids_veh_new_sumo)
+                print('  ids_veh_entered_sumo=', ids_veh_entered_sumo)
+                print('  ids_veh_left_sumo=', ids_veh_left_sumo)
 
             if len(ids_veh_entered_sumo) > 0:
 
@@ -306,7 +306,7 @@ class Compressors(am.ArrayObjman):
                         # no platoon, it is a single vehicle
                         id_targetedge_sumo = traci.vehicle.getRoute(id_veh_entered_sumo)[-1]
                         ids_shuntedge_sumo = edges.ids_sumo[ids_shuntedge]
-                        print '    dispatch id_veh_entered_sumo %s' % id_veh_entered_sumo, id_targetedge_sumo, ids_edge_sumo_target
+                        print('    dispatch id_veh_entered_sumo %s' % id_veh_entered_sumo, id_targetedge_sumo, ids_edge_sumo_target)
 
                         is_found_queue = False
                         inds_queue = np.flatnonzero((np.array(ids_edge_sumo_target, object)
@@ -354,7 +354,7 @@ class Compressors(am.ArrayObjman):
                                 # print '      all queues are busy, let vehicle %s go ahead'%id_veh_entered_sumo
                                 pass
                             else:
-                                print '      configure target of new queue', ind_queue, id_targetedge_sumo
+                                print('      configure target of new queue', ind_queue, id_targetedge_sumo)
                                 ids_edge_sumo_target[ind_queue] = id_targetedge_sumo
                                 self._alloc_queue(queues[ind_queue],
                                                   queues_alloc[ind_queue],
@@ -388,10 +388,10 @@ class Compressors(am.ArrayObjman):
                         capacities, ids_edge_sumo_target,
                         edges.ids_sumo[ids_shuntedge], releasetime_queues):
                     if 0:
-                        print '    OOOO shunt %s --> target %s' % (id_shuntedge_sumo, id_edge_sumo_target)
-                        print '    simtime-releasetime_queue', simtime-releasetime_queue
-                        print '    queue', queue, id(queue)
-                        print '    queue_alloc', queue_alloc
+                        print('    OOOO shunt %s --> target %s' % (id_shuntedge_sumo, id_edge_sumo_target))
+                        print('    simtime-releasetime_queue', simtime-releasetime_queue)
+                        print('    queue', queue, id(queue))
+                        print('    queue_alloc', queue_alloc)
 
                     # check if allocated arrived
                     ids_veh_arrived = []
@@ -411,7 +411,7 @@ class Compressors(am.ArrayObjman):
                         # here we coukd also test timeout conditions
                         if ((len_queue == capacity) | ((simtime - releasetime_queue) > self.time_accumulation_max.get_value())) & (simtime - self.releasetimes[id_comp] > self.time_release_min.get_value()):
                             # queue is full
-                            print '  platoon and send vehicles:', queue
+                            print('  platoon and send vehicles:', queue)
                             # action 1
                             # platoon all vehicles in queue, starting from last in queue
                             for i in range(len_queue-1, 0, -1):
@@ -472,7 +472,7 @@ class Decompressors(Compressors):
         ])
 
     def prepare_sim(self, process):
-        print 'Decompressors.prepare_sim'
+        print('Decompressors.prepare_sim')
         net = self.get_scenario().net
         nodes = net.nodes
         edges = net.edges
@@ -521,7 +521,7 @@ class Decompressors(Compressors):
         self.ids_vehs_detect_sumo = np.zeros(n_id_max, dtype=np.object)
 
         for id_comp, ids_shuntedge in zip(ids, self.ids_shuntedges[ids]):
-            print '  id_comp', id_comp
+            print('  id_comp', id_comp)
             n_shunts = len(ids_shuntedge)  # first edge is not a real shunt!!
 
             queues = n_shunts*[None]
@@ -551,8 +551,8 @@ class Decompressors(Compressors):
 
     def process_step(self, process):
         simtime = process.simtime
-        print 79*'_'
-        print 'Deompressors.process_step at', simtime
+        print(79*'_')
+        print('Deompressors.process_step at', simtime)
         net = self.get_scenario().net
         edges = net.edges
         vehicles = self.parent.prtvehicles
@@ -580,17 +580,17 @@ class Decompressors(Compressors):
                    ):
             n_queues = len(queues)
             ids_shuntedge_sumo = edges.ids_sumo[ids_shuntedge]
-            print '  '+60*'|'
-            print '  Decompressor id_comp', id_comp, 'n_queues', n_queues
+            print('  '+60*'|')
+            print('  Decompressor id_comp', id_comp, 'n_queues', n_queues)
             # check for new vehicle arrivals/departures
 
             ids_veh_sumo = set(traci.edge.getLastStepVehicleIDs(id_detectedge_sumo))
             if 0:
-                print '  id_detectedge_sumo', id_detectedge_sumo
-                print '  ids_veh_detect_sumo', ids_veh_detect_sumo, ids_veh_detect_sumo != ids_veh_sumo
-                print '  ids_veh_sumo=', ids_veh_sumo
+                print('  id_detectedge_sumo', id_detectedge_sumo)
+                print('  ids_veh_detect_sumo', ids_veh_detect_sumo, ids_veh_detect_sumo != ids_veh_sumo)
+                print('  ids_veh_sumo=', ids_veh_sumo)
                 ids_veh_sumo_raw = traci.edge.getLastStepVehicleIDs(id_detectedge_sumo)
-                print '  ids_veh_sumo_raw=', ids_veh_sumo_raw
+                print('  ids_veh_sumo_raw=', ids_veh_sumo_raw)
 
             if ids_veh_detect_sumo != ids_veh_sumo:
                 # there are new vehicles
@@ -600,12 +600,12 @@ class Decompressors(Compressors):
                 ids_veh_entered = vehicles.get_ids_from_ids_sumo(ids_veh_entered_sumo)
 
                 if 1:
-                    print '  ids_veh_entered', ids_veh_entered, type(ids_veh_entered)
+                    print('  ids_veh_entered', ids_veh_entered, type(ids_veh_entered))
                     # print '  poss',poss
-                    print '  ids_veh_entered_sumo', ids_veh_entered_sumo
-                    print '  ids_leader', vehicles.ids_leader[ids_veh_entered]
-                    print '  ids_follower', vehicles.ids_follower[ids_veh_entered]
-                    print '  lengths_plat', vehicles.lengths_plat[ids_veh_entered]
+                    print('  ids_veh_entered_sumo', ids_veh_entered_sumo)
+                    print('  ids_leader', vehicles.ids_leader[ids_veh_entered])
+                    print('  ids_follower', vehicles.ids_follower[ids_veh_entered])
+                    print('  lengths_plat', vehicles.lengths_plat[ids_veh_entered])
 
                 for id_veh_entered, id_veh_entered_sumo, id_leader, length_plat\
                     in zip(ids_veh_entered, ids_veh_entered_sumo,
@@ -692,12 +692,12 @@ class Decompressors(Compressors):
                         ids_targetedges_sumo, capacities,
                         edges.ids_sumo[ids_shuntedge], releasetime_queues):
                     if 0:
-                        print '    QQQQQQQQQQQ shunt %s ' % (id_shuntedge_sumo)
-                        print '      simtime-releasetime_queue', simtime-releasetime_queue, (simtime - releasetime_queue > 15), (simtime - self.releasetimes[id_comp] > 10)
-                        print '      queue', queue, id(queue)
-                        print '      ids_targetedge_sumo', ids_targetedge_sumo
-                        print '      queue_alloc', queue_alloc
-                        print '      releasetime_queue', releasetime_queue, simtime - releasetime_queue, simtime - releasetime_queue > self.time_accumulation_max.get_value()
+                        print('    QQQQQQQQQQQ shunt %s ' % (id_shuntedge_sumo))
+                        print('      simtime-releasetime_queue', simtime-releasetime_queue, (simtime - releasetime_queue > 15), (simtime - self.releasetimes[id_comp] > 10))
+                        print('      queue', queue, id(queue))
+                        print('      ids_targetedge_sumo', ids_targetedge_sumo)
+                        print('      queue_alloc', queue_alloc)
+                        print('      releasetime_queue', releasetime_queue, simtime - releasetime_queue, simtime - releasetime_queue > self.time_accumulation_max.get_value())
                     # here we could also test timeout conditions
                     if (simtime - self.releasetimes[id_comp] > self.time_release_min.get_value()) & (simtime - releasetime_queue > self.time_accumulation_max.get_value()):
                         # if (simtime - self.releasetimes[id_comp]> self.time_release_min.get_value()):
@@ -776,7 +776,7 @@ class Decompressors(Compressors):
                                 del ids_targetedge_sumo[id_veh_arrived]
 
                             else:
-                                print '    platoon incomplete'
+                                print('    platoon incomplete')
                         else:
                             # print '      no leaders arrived in this quque'
                             pass
@@ -924,7 +924,7 @@ class Mergenodes(am.ArrayObjman):
         """
         Make merge node database from network.
         """
-        print 'Mergenodes.make_from_net'
+        print('Mergenodes.make_from_net')
         self.clear()
         id_prtmode = self.parent.id_prtmode
 
@@ -943,9 +943,9 @@ class Mergenodes(am.ArrayObjman):
 
         # debug
         ids_edge = edges.get_ids()
-        print 'distances:'
+        print('distances:')
         for id_edge, id_edge_sumo, length, dist in zip(ids_edge, edges.ids_sumo[ids_edge], edges.lengths[ids_edge], distances[ids_edge]):
-            print '  id_edge=%d id_edge_sumo=%s length=%.1f dist=%.1f' % (id_edge, id_edge_sumo, length, dist)
+            print('  id_edge=%d id_edge_sumo=%s length=%.1f dist=%.1f' % (id_edge, id_edge_sumo, length, dist))
 
         ids_shuntedges = set()
         ids_mainlinedges = set()
@@ -953,9 +953,9 @@ class Mergenodes(am.ArrayObjman):
         ids = compressors.get_ids()
         for id_unit, ids_edge in zip(ids, compressors.ids_shuntedges[ids]):
             # put in all shunts except for the bypass
-            print '    bypass of compressor', id_unit, '=', ids_edge[0]
+            print('    bypass of compressor', id_unit, '=', ids_edge[0])
             ids_mainlinedges.add(ids_edge[0])
-            print '    update ids_shuntedges with compressors', ids_edge[1:]
+            print('    update ids_shuntedges with compressors', ids_edge[1:])
             ids_shuntedges.update(ids_edge[1:])
 
         # collect decompressornodes, wich will not become entry merges
@@ -963,12 +963,12 @@ class Mergenodes(am.ArrayObjman):
         ids_node_decompressorout = []
         for id_unit, ids_edge in zip(ids, decompressors.ids_shuntedges[ids]):
             # put in all shunts except for the bypass
-            print '    bypass of decompressor', id_unit, '=', ids_edge[0], 'id_tonode', edges.ids_tonode[ids_edge[0]]
+            print('    bypass of decompressor', id_unit, '=', ids_edge[0], 'id_tonode', edges.ids_tonode[ids_edge[0]])
             ids_mainlinedges.add(ids_edge[0])
             ids_node_decompressorout.append(edges.ids_tonode[ids_edge[0]])
-            print '    update ids_shuntedges with decompressors', ids_edge[1:]
+            print('    update ids_shuntedges with decompressors', ids_edge[1:])
             ids_shuntedges.update(ids_edge[1:])
-        print '  ids_node_decompressorout', ids_node_decompressorout
+        print('  ids_node_decompressorout', ids_node_decompressorout)
         ids_node_compressorout = edges.ids_tonode[list(ids_mainlinedges)]
         ids_mainlinefromnodes = edges.ids_fromnode[list(ids_mainlinedges)]
 
@@ -978,7 +978,7 @@ class Mergenodes(am.ArrayObjman):
         #    print '  update ids_shuntedges with mainline incoming',edges.get_incoming(id_edge)
         #    ids_shuntedges.update(edges.get_incoming(id_edge))
 
-        print '  ids_shuntedges',  ids_shuntedges
+        print('  ids_shuntedges',  ids_shuntedges)
         #ids_ptstop = ptstops.get_ids()
         #id_mode_prt = self.parent.id_prtmode
 
@@ -988,7 +988,7 @@ class Mergenodes(am.ArrayObjman):
         #edgelengths = net.edges.lengths
 
         ids_node = nodes.get_ids()
-        print '  ids_node', ids_node
+        print('  ids_node', ids_node)
         for id_node, ids_edge_from, ids_edge_to, id_type in zip(
             ids_node,
             nodes.ids_incoming[ids_node],
@@ -999,15 +999,15 @@ class Mergenodes(am.ArrayObjman):
             if True:
                 #
 
-                print 79*'-'
-                print '  check node', id_node, nodes.ids_sumo[id_node], id_type, id_zippertype == id_type
-                print '    ids_edge_from', ids_edge_from
-                print '    ids_edge_to', ids_edge_to
+                print(79*'-')
+                print('  check node', id_node, nodes.ids_sumo[id_node], id_type, id_zippertype == id_type)
+                print('    ids_edge_from', ids_edge_from)
+                print('    ids_edge_to', ids_edge_to)
                 # id merge to be created, for debugging
                 id_merge = -1
 
                 if (ids_edge_from is None) | (ids_edge_to is None):
-                    print '    WARNING: isolate node: ids_edge_from,ids_edge_to', ids_edge_from, ids_edge_to
+                    print('    WARNING: isolate node: ids_edge_from,ids_edge_to', ids_edge_from, ids_edge_to)
                     pass
 
                 elif (len(ids_edge_from) == 2) & (len(ids_edge_to) == 1):
@@ -1018,13 +1018,13 @@ class Mergenodes(am.ArrayObjman):
                     # check accesslevels
                     id_edge1, id_edge2 = ids_edge_from
                     ids_lane1, ids_lane2 = edges.ids_lanes[ids_edge_from]
-                    print '    id_edge1', id_edge1, 'ids_lane1', ids_lane1, self.is_prt_only(ids_lane1, lanes)
-                    print '    id_edge2', id_edge2, 'ids_lane2', ids_lane2, self.is_prt_only(ids_lane2, lanes)
+                    print('    id_edge1', id_edge1, 'ids_lane1', ids_lane1, self.is_prt_only(ids_lane1, lanes))
+                    print('    id_edge2', id_edge2, 'ids_lane2', ids_lane2, self.is_prt_only(ids_lane2, lanes))
                     if self.is_prt_only(ids_lane1, lanes) & self.is_prt_only(ids_lane2, lanes):
-                        print '      +PRT merge with 2 PRT lines entering'
+                        print('      +PRT merge with 2 PRT lines entering')
 
                         if id_type != id_zippertype:
-                            print 'WARNING: PRT network node %d %s is NOT in zipper mode!' % (id_node, nodes.ids_sumo[id_node])
+                            print('WARNING: PRT network node %d %s is NOT in zipper mode!' % (id_node, nodes.ids_sumo[id_node]))
 
                         # elif not ids_mainlinedges.isdisjoint(ids_edge_from):
                         #    print '    one incoming line is the bypass'
@@ -1037,16 +1037,16 @@ class Mergenodes(am.ArrayObjman):
                         #                        )
 
                         else:
-                            print '    make regular merge'
-                            print '      branch 1:'
+                            print('    make regular merge')
+                            print('      branch 1:')
                             id_node_up1, dist1 = self.search_upstream_merge(
                                 id_edge1, edges, lanes, id_prtmode, distances=distances)
-                            print '        id_node_up1', id_node_up1, 'dist1', dist1
+                            print('        id_node_up1', id_node_up1, 'dist1', dist1)
 
-                            print '\n      branch 2:'
+                            print('\n      branch 2:')
                             id_node_up2, dist2 = self.search_upstream_merge(
                                 id_edge2, edges, lanes, id_prtmode, distances=distances)
-                            print '        id_node_up2', id_node_up1, 'dist2', dist2, '\n'
+                            print('        id_node_up2', id_node_up1, 'dist2', dist2, '\n')
 
                             ids_node_out = self.search_downstream_merges(
                                 ids_edge_to[0], edges, lanes, id_prtmode, ids_sinkedge=ids_shuntedges)
@@ -1066,7 +1066,7 @@ class Mergenodes(am.ArrayObjman):
                     #al_in = lanes.get_accesslevel(edges.ids_lanes[id_edge_from], id_prtmode)
                     #is_prt_in = lanes.ids_modes_allow[edges.ids_lanes[id_edge_from]] == id_prtmode
                     is_prt_in = self.is_prt_only(ids_lane_in, lanes)
-                    print '    one in, 2 out => diverge node, access is_prt_in', is_prt_in, 'is_platform_in', self.is_platform(ids_lane_in, lanes)
+                    print('    one in, 2 out => diverge node, access is_prt_in', is_prt_in, 'is_platform_in', self.is_platform(ids_lane_in, lanes))
 
                     # if id_edge_from in ids_detectoredges:
                     #    print '    fromnode is a detectoredge of a compressor'
@@ -1081,7 +1081,7 @@ class Mergenodes(am.ArrayObjman):
                     # check if node is outgoing node at a station
                     if 0:  # no longer considered
                         if is_prt_in & (id_node in ids_mainlinefromnodes):
-                            print '    Diverge node in front of a compressor/decompressorr.'
+                            print('    Diverge node in front of a compressor/decompressorr.')
                             id_node_up, dist = self.search_upstream_merge(id_edge_from, edges, lanes, id_prtmode)
 
                             id_edge1, id_edge2 = ids_edge_to
@@ -1100,19 +1100,19 @@ class Mergenodes(am.ArrayObjman):
                                          )
 
                     if self.is_platform(ids_lane_in, lanes):
-                        print '    mixed access level of incoming edge, check for platform exit node'
+                        print('    mixed access level of incoming edge, check for platform exit node')
 
                         id_edge1, id_edge2 = ids_edge_to
                         ids_lane1, ids_lane2 = edges.ids_lanes[ids_edge_to]
 
                         # here we could also decide on the number of lanes
                         # but this may not be robust in the future
-                        print '    out id_edge1', id_edge1, 'ids_lane1', ids_lane1, 'is_prt_only', self.is_prt_only(ids_lane1, lanes)
-                        print '    out id_edge2', id_edge2, 'ids_lane2', ids_lane2, 'is_prt_only', self.is_prt_only(ids_lane2, lanes)
+                        print('    out id_edge1', id_edge1, 'ids_lane1', ids_lane1, 'is_prt_only', self.is_prt_only(ids_lane1, lanes))
+                        print('    out id_edge2', id_edge2, 'ids_lane2', ids_lane2, 'is_prt_only', self.is_prt_only(ids_lane2, lanes))
                         # if self.is_prt_only(ids_lane1, lanes) & self.is_prt_only(ids_lane2, lanes):
                         if self.is_prt_only(ids_lane2, lanes):
 
-                            print '      Ped exit on outedge 1'
+                            print('      Ped exit on outedge 1')
                             #id_node_up, dist = self.search_upstream_merge(id_edge_from, edges, lanes, id_prtmode)
                             ids_node_out = self.search_downstream_merges(
                                 id_edge2, edges, lanes, id_prtmode, ids_sinkedge=ids_shuntedges)
@@ -1124,7 +1124,7 @@ class Mergenodes(am.ArrayObjman):
                                                     )
 
                         elif self.is_prt_only(ids_lane1, lanes):
-                            print '      Ped exit on outedge 2'
+                            print('      Ped exit on outedge 2')
                             #id_node_up, dist = self.search_upstream_merge(id_edge_from, edges, lanes, id_prtmode)
                             ids_node_out = self.search_downstream_merges(
                                 id_edge1, edges, lanes, id_prtmode, ids_sinkedge=ids_shuntedges)
@@ -1137,7 +1137,7 @@ class Mergenodes(am.ArrayObjman):
 
                 if id_merge >= 0:
                     self.print_attrs(ids=[id_merge, ])
-        print '\n  now check if merge has entry line form stations or compressors'
+        print('\n  now check if merge has entry line form stations or compressors')
 
         ids = self.get_ids()
         i = 0
@@ -1146,21 +1146,21 @@ class Mergenodes(am.ArrayObjman):
 
             id_node_in1 = self.ids_node_in1[id_merge]
             id_node_in2 = self.ids_node_in2[id_merge]
-            print 79*'-'
-            print '  check entry of id_merge', id_merge, 'id_node', self.ids_node[id_merge], ' no decomp', self.ids_node[id_merge] not in ids_node_decompressorout
+            print(79*'-')
+            print('  check entry of id_merge', id_merge, 'id_node', self.ids_node[id_merge], ' no decomp', self.ids_node[id_merge] not in ids_node_decompressorout)
             if (id_node_in1 > -1) & (id_node_in2 > -1)\
                     & (self.ids_node[id_merge] not in ids_node_decompressorout):
 
-                print '    id_node_in1', self.ids_node_in1[id_merge], nodes.ids_sumo[self.ids_node_in1[id_merge]], self.ids_node.has_index(self.ids_node_in1[id_merge])
-                print '    id_node_in2', self.ids_node_in2[id_merge], nodes.ids_sumo[self.ids_node_in2[id_merge]], self.ids_node.has_index(self.ids_node_in2[id_merge])
+                print('    id_node_in1', self.ids_node_in1[id_merge], nodes.ids_sumo[self.ids_node_in1[id_merge]], self.ids_node.has_index(self.ids_node_in1[id_merge]))
+                print('    id_node_in2', self.ids_node_in2[id_merge], nodes.ids_sumo[self.ids_node_in2[id_merge]], self.ids_node.has_index(self.ids_node_in2[id_merge]))
                 if 1:
 
-                    print '      self.ids_node._index_to_id', self.ids_node._index_to_id
+                    print('      self.ids_node._index_to_id', self.ids_node._index_to_id)
 
                     id_merge_in1 = self.ids_node.get_id_from_index(self.ids_node_in1[id_merge])
                     id_merge_in2 = self.ids_node.get_id_from_index(self.ids_node_in2[id_merge])
 
-                    print '    station check id_merge', id_merge, 'id_merge_in1', id_merge_in1, 'station', self.are_station[id_merge_in1], 'id_merge_in2', id_merge_in2, 'station', self.are_station[id_merge_in2]
+                    print('    station check id_merge', id_merge, 'id_merge_in1', id_merge_in1, 'station', self.are_station[id_merge_in1], 'id_merge_in2', id_merge_in2, 'station', self.are_station[id_merge_in2])
 
                     if self.are_station[id_merge_in2]:
                         self.are_entry[id_merge] = True
@@ -1186,7 +1186,7 @@ class Mergenodes(am.ArrayObjman):
         return self.parent.get_scenario()
 
     def prepare_sim(self, process):
-        print 'Mergenodes.prepare_sim'
+        print('Mergenodes.prepare_sim')
         net = self.get_scenario().net
         nodes = net.nodes
         edges = net.edges
@@ -1294,8 +1294,8 @@ class Mergenodes(am.ArrayObjman):
 
     def process_step(self, process):
         simtime = process.simtime
-        print 79*'_'
-        print 'Mergenodes.process_step at', simtime
+        print(79*'_')
+        print('Mergenodes.process_step at', simtime)
         net = self.get_scenario().net
         vehicles = self.parent.prtvehicles
 
@@ -1311,7 +1311,7 @@ class Mergenodes(am.ArrayObjman):
                 self.ids_vehs_out_sumo[ids],
                 self.are_entry[ids],
                 ):
-            print '  '+60*'.'
+            print('  '+60*'.')
 
             ####
             debug = False  # id_merge in [24,22,19]
@@ -1320,7 +1320,7 @@ class Mergenodes(am.ArrayObjman):
             #debug = debug |  (id_merge==17)|  ('gneJ29' in net.nodes.ids_sumo[ids_node_out])
 
             ###
-            print '  process id_merge', id_merge, ',id_node', id_node, net.nodes.ids_sumo[id_node], 'debug', debug
+            print('  process id_merge', id_merge, ',id_node', id_node, net.nodes.ids_sumo[id_node], 'debug', debug)
 
             # check for new vehicle arrivals/departures
             ids_veh_sumo = set(traci.edge.getLastStepVehicleIDs(id_edge_out))
@@ -1342,7 +1342,7 @@ class Mergenodes(am.ArrayObjman):
                 #ids_veh_left = vehicles.get_ids_from_ids_sumo(list(ids_veh_sumo_prev.difference(ids_veh_sumo)))
 
                 if debug:
-                    print '  ids_veh_entered', ids_veh_entered, type(ids_veh_entered)
+                    print('  ids_veh_entered', ids_veh_entered, type(ids_veh_entered))
                 # print '  ids_veh_entered_sumo',ids_veh_entered_sumo
                 # print '  ids_leader',vehicles.ids_leader[ids_veh_entered]
 
@@ -1367,11 +1367,11 @@ class Mergenodes(am.ArrayObjman):
                 id_veh_first, id_veh_last = self.ids_plat_wait_exit[id_merge]
                 if id_veh_first > -1:
                     if debug > 0:
-                        print '    platoon waiting for exit: id_veh_first prt.%d, id_veh_last prt.%d' % (id_veh_first, id_veh_last)
+                        print('    platoon waiting for exit: id_veh_first prt.%d, id_veh_last prt.%d' % (id_veh_first, id_veh_last))
                     inds_entered = np.flatnonzero(vehicles.ids_leader[ids_veh_entered] > -1)
                     if np.any(id_veh_last == ids_veh_entered[inds_entered]):
                         if debug > 0:
-                            print '    last vehicle of platoon left merge -> exit leader prt.%d' % id_veh_first
+                            print('    last vehicle of platoon left merge -> exit leader prt.%d' % id_veh_first)
                         self.exit_veh(id_veh_first, vehicles.get_id_sumo(id_veh_first), id_merge, vehicles, debug=debug)
                         self.ids_plat_wait_exit[id_merge] = [-1, -1]
 
@@ -1383,13 +1383,13 @@ class Mergenodes(am.ArrayObjman):
                     inds_entered = []
 
                 if debug:
-                    print '  inds_entered', inds_entered
+                    print('  inds_entered', inds_entered)
                 if len(inds_entered) > 0:
                     for ind_entered, id_veh in zip(inds_entered, ids_veh_entered[inds_entered]):
 
                         id_veh_sumo = ids_veh_entered_sumo[ind_entered]
                         if debug > 0:
-                            print '    >>try exiting vehicle', id_veh_sumo, 'is_leader', vehicles.ids_leader[id_veh] == -1, 'ids_node_out', ids_node_out, 'ids_merge_out', ids_merge_out
+                            print('    >>try exiting vehicle', id_veh_sumo, 'is_leader', vehicles.ids_leader[id_veh] == -1, 'ids_node_out', ids_node_out, 'ids_merge_out', ids_merge_out)
 
                         # print '      route_sumo',route_sumo
 
@@ -1400,15 +1400,15 @@ class Mergenodes(am.ArrayObjman):
                             if (id_veh_last != id_veh):
                                 if id_veh_last not in ids_veh_entered:
                                     if debug:
-                                        print '    wait for last plat vehicle', id_veh_last
+                                        print('    wait for last plat vehicle', id_veh_last)
                                     self.ids_plat_wait_exit[id_merge] = [id_veh, id_veh_last]
                                 else:
                                     if debug:
-                                        print '    last plat vehicle', id_veh_last, 'after merge node, exit', id_veh_sumo
+                                        print('    last plat vehicle', id_veh_last, 'after merge node, exit', id_veh_sumo)
                                     self.exit_veh(id_veh, id_veh_sumo, id_merge, vehicles, debug=debug)
                             else:
                                 if debug:
-                                    print '    vehicle', id_veh, 'has no platoon, exit', id_veh_sumo
+                                    print('    vehicle', id_veh, 'has no platoon, exit', id_veh_sumo)
                                 self.exit_veh(id_veh, id_veh_sumo, id_merge, vehicles, debug=debug)
 
                             # exit from previous merge
@@ -1416,7 +1416,7 @@ class Mergenodes(am.ArrayObjman):
                             #    print '    vehicle',id_veh_sumo,'exits id_merge',id_merge
 
                             if debug > 0:
-                                print '  check which out mergenode are on the current route of the vehicle'
+                                print('  check which out mergenode are on the current route of the vehicle')
 
                             if len(ids_merge_out) > 0:
 
@@ -1438,23 +1438,23 @@ class Mergenodes(am.ArrayObjman):
                                 mergeind = np.argmin(routeinds)
 
                                 if debug:  # debug>0:
-                                    print '      route_sumo', route_sumo
-                                    print '      routeinds', routeinds, 'downstream merge', routeinds[mergeind] < INFINT
+                                    print('      route_sumo', route_sumo)
+                                    print('      routeinds', routeinds, 'downstream merge', routeinds[mergeind] < INFINT)
                                     # print '      ids_edge_mergeout_sumo',ids_edge_mergeout_sumo
                                     # print '      mergeind,routeinds',mergeind,routeinds
                                     # print '      ids_merge_out[mergeind]',ids_merge_out[mergeind], ids_edge_mergeout_sumo[mergeind]
 
                                 if routeinds[mergeind] < INFINT:
                                     if debug:
-                                        print '      next merge is on the route'
+                                        print('      next merge is on the route')
                                     if self.are_entry[ids_merge_out[mergeind]]:
                                         if debug:
-                                            print '      call enter_veh_entry id_merge_out', ids_merge_out[mergeind]
+                                            print('      call enter_veh_entry id_merge_out', ids_merge_out[mergeind])
                                         self.enter_veh_entry(
                                             id_veh, id_veh_sumo, id_merge, ids_merge_out[mergeind], ids_edge_mergeout_sumo[mergeind], vehicles, debug=debug)
                                     else:
                                         if debug:
-                                            print '      call enter_veh id_merge_out', ids_merge_out[mergeind]
+                                            print('      call enter_veh id_merge_out', ids_merge_out[mergeind])
                                         self.enter_veh(
                                             id_veh, id_veh_sumo, id_merge, ids_merge_out[mergeind], ids_edge_mergeout_sumo[mergeind], vehicles, debug=debug)
                                 else:
@@ -1467,8 +1467,8 @@ class Mergenodes(am.ArrayObjman):
                         else:
                             # ids_node_out is  None
                             if debug:
-                                print '   There is a station or compressor shunt edges next'
-                                print '   completely disconnect from all merge and ghost controlls'
+                                print('   There is a station or compressor shunt edges next')
+                                print('   completely disconnect from all merge and ghost controlls')
 
                             # exit from previous merge
                             self.exit_veh(id_veh, id_veh_sumo, id_merge, vehicles)
@@ -1481,7 +1481,7 @@ class Mergenodes(am.ArrayObjman):
                 self.process_step_entry(id_merge, vehicles, debug)
 
         if 0:
-            print '========check mergeprocess'
+            print('========check mergeprocess')
             for id_merge, id_node_sumo, ids_veh_merged_sumo, ids_veh_merged in\
                 zip(ids,
                     net.nodes.ids_sumo[self.ids_node[ids]],
@@ -1489,11 +1489,11 @@ class Mergenodes(am.ArrayObjman):
                     self.ids_vehs_merged[ids]
                     ):
 
-                print '  ', id_merge, id_node_sumo, ids_veh_merged_sumo
+                print('  ', id_merge, id_node_sumo, ids_veh_merged_sumo)
                 # print '    ids_veh_merged',ids_veh_merged
 
     def exit_veh(self, id_veh, id_veh_sumo, id_merge_from, vehicles, is_remove_from_control=False, debug=0):
-        print 'exit_veh id_veh %s, id_merge_from %d ' % (id_veh_sumo, id_merge_from), 'entry', self.are_entry[id_merge_from], 'is_remove_from_control', is_remove_from_control
+        print('exit_veh id_veh %s, id_merge_from %d ' % (id_veh_sumo, id_merge_from), 'entry', self.are_entry[id_merge_from], 'is_remove_from_control', is_remove_from_control)
 
         # print '    check for platooned vehicles:'
         # vehicles.get_platoon(id_veh)
@@ -1519,10 +1519,10 @@ class Mergenodes(am.ArrayObjman):
                 id_veh_behind = self.ids_vehs_merged[id_merge_from][ind_pos+1]
                 id_veh_tail = vehicles.get_platoontail(id_veh)  # get last in platoon
                 if debug > 0:
-                    print '  del ghost from veh behind prt.%d to platoon tail prt.%d' % (id_veh_behind, id_veh_tail)
+                    print('  del ghost from veh behind prt.%d to platoon tail prt.%d' % (id_veh_behind, id_veh_tail))
                 vehicles.del_ghost(id_veh_behind, id_veh_tail)
                 if debug > 0:
-                    print '    check ghosts of behind prt.%d:' % id_veh_behind, vehicles.ids_ghosts[id_veh_behind]
+                    print('    check ghosts of behind prt.%d:' % id_veh_behind, vehicles.ids_ghosts[id_veh_behind])
                 # is there a vehicle in front of the removed vehicle
                 # this happens if a vehicle is interactively deviated
                 if ind_pos > 0:
@@ -1536,18 +1536,18 @@ class Mergenodes(am.ArrayObjman):
                     dist_to_merge_infront = get_traci_distance(
                         vehicles.get_id_sumo(id_veh_infront), id_edge_mergeout_sumo, 3.0)
                     if debug:
-                        print '   now let the vehicle behind %d, d=%.2f' % (id_veh_behind, dist_to_merge_behind), 'see the vehicle in front %d, d=%.2f' % (id_veh_infront, dist_to_merge_infront)
+                        print('   now let the vehicle behind %d, d=%.2f' % (id_veh_behind, dist_to_merge_behind), 'see the vehicle in front %d, d=%.2f' % (id_veh_infront, dist_to_merge_infront))
 
                     vehicles.add_ghost(id_veh_behind, id_veh_tail, dist_to_merge_behind, dist_to_merge_infront)
                     if debug > 0:
-                        print '    check ghosts of behind prt.%d:' % id_veh_behind, vehicles.ids_ghosts[id_veh_behind]
+                        print('    check ghosts of behind prt.%d:' % id_veh_behind, vehicles.ids_ghosts[id_veh_behind])
 
                 # remove any possible ghosts from this vehicle to vehicles behind
                 # this can happen if this vehicle passed by its ghost vehicle
                 # should no longer happen
                 # vehicles.del_ghosts(id_veh)
                 if debug > 0:
-                    print '    check ghosts of prt.%d (no ghosts from this merge?):' % id_veh, vehicles.ids_ghosts[id_veh]
+                    print('    check ghosts of prt.%d (no ghosts from this merge?):' % id_veh, vehicles.ids_ghosts[id_veh])
 
             self.ids_vehs_merged[id_merge_from].pop(ind_pos)  # remove(id_veh)
             self.ids_vehs_merged_sumo[id_merge_from].pop(ind_pos)  # remove(id_veh_sumo)
@@ -1561,7 +1561,7 @@ class Mergenodes(am.ArrayObjman):
                 self.ids_vehs_in1_sumo[id_merge_from].remove(id_veh_sumo)  # .pop()
                 if self.are_entry[id_merge_from]:
                     if debug:
-                        print '    vehicle is involved in entry merge processes?', self.vehicles_mains[id_merge_from].has_key(id_veh)
+                        print('    vehicle is involved in entry merge processes?', self.vehicles_mains[id_merge_from].has_key(id_veh))
 
                     if self.vehicles_mains[id_merge_from].has_key(id_veh):
                         if self.vehicles_entries[id_merge_from].has_key(id_veh):
@@ -1570,9 +1570,9 @@ class Mergenodes(am.ArrayObjman):
                                 id_veh_infront = state['id_veh_infront']
                                 id_veh_infront_sumo = vehicles.ids_sumo[id_veh_infront]
                                 id_veh_infront_sumo_eff, dist_eff = getLeader(id_veh_infront_sumo)
-                                print '      should have this veh in front:', id_veh_infront_sumo, 'leader', id_veh_infront_sumo_eff, 'd=%.1fm' % dist_eff
+                                print('      should have this veh in front:', id_veh_infront_sumo, 'leader', id_veh_infront_sumo_eff, 'd=%.1fm' % dist_eff)
                                 if id_veh_infront_sumo_eff != id_veh_infront_sumo:
-                                    print 'ERROR: faled merge of ', id_veh_sumo, 'exiting merge', id_merge_from
+                                    print('ERROR: faled merge of ', id_veh_sumo, 'exiting merge', id_merge_from)
                                     sys.exit(1)
                         #
                         #id_veh_entry = self.vehicles_mains[id_merge_from][id_veh]
@@ -1600,7 +1600,7 @@ class Mergenodes(am.ArrayObjman):
 
                 if self.are_entry[id_merge_from]:
                     if debug:
-                        print '    del veh prt.%s from vehicles_entries' % id_veh
+                        print('    del veh prt.%s from vehicles_entries' % id_veh)
                     del self.vehicles_entries[id_merge_from][id_veh]
             else:
                 pass
@@ -1615,12 +1615,12 @@ class Mergenodes(am.ArrayObjman):
             # just be sure that the vehicle is not in any queue
             # but actually this cannot happen
             if id_veh in self.ids_vehs_in1[id_merge_from]:
-                print 'WARNING in exit_veh: new veh %d should not be in inqueue 1' % id_veh
+                print('WARNING in exit_veh: new veh %d should not be in inqueue 1' % id_veh)
                 self.ids_vehs_in1[id_merge_from].remove(id_veh)
                 self.ids_vehs_in1_sumo[id_merge_from].remove(id_veh_sumo)
 
             if id_veh in self.ids_vehs_in2[id_merge_from]:
-                print 'WARNING in exit_veh: new veh %d should not be in inqueue 2' % id_veh
+                print('WARNING in exit_veh: new veh %d should not be in inqueue 2' % id_veh)
                 self.ids_vehs_in2[id_merge_from].remove(id_veh)
                 self.ids_vehs_in2_sumo[id_merge_from].remove(id_veh_sumo)
 
@@ -1645,34 +1645,34 @@ class Mergenodes(am.ArrayObjman):
         dist_max = max(dist1_min, dist1_max, dist2_min, dist2_max)+1
         #dist_min = min(dist1_min, dist1_max, dist2_min, dist2_max)
         #dist_diff = dist_max-dist_min+10.0
-        print 'print_vehs id_veh1', id_veh1, 'id_veh2', id_veh2
+        print('print_vehs id_veh1', id_veh1, 'id_veh2', id_veh2)
         # print '  dist1_min',dist1_min,'dist1_max',dist1_max
         # print '  dist2_min',dist2_min,'dist2_max',dist2_max
         # print '  min[dist1_min, dist1_max, dist2_min, dist2_max]>0.01',np.min([dist1_min, dist1_max, dist2_min, dist2_max])>0.01
         if np.min([dist1_min, dist1_max, dist2_min, dist2_max]) > 0.01:
             f = float(pos_max)/dist_max
             # print '  f',f
-            print '________________________'
-            print 'vehicle %s from line %d: %.f--%2f' % (id_veh1, lineind1, dist1_min, dist1_max)
+            print('________________________')
+            print('vehicle %s from line %d: %.f--%2f' % (id_veh1, lineind1, dist1_min, dist1_max))
             pos_min = int(dist1_min*f)
             pos_max = int(dist1_max*f)
-            print max(pos_min-1, 0)*' '+'<'+(pos_max-pos_min)*'X'+'|'
+            print(max(pos_min-1, 0)*' '+'<'+(pos_max-pos_min)*'X'+'|')
 
             pos_min = int(dist2_min*f)
             pos_max = int(dist2_max*f)
             # print '  pos_min',pos_min
             # print '  pos_max',pos_max
             # print '  max(pos_min-1,0)',max(pos_min-1,0),'(pos_max-pos_min)',(pos_max-pos_min)
-            print max(pos_min-1, 0)*' '+'<'+(pos_max-pos_min)*'X'+'|'
-            print 'vehicle %s from line %d: %.f--%2f' % (id_veh2, lineind2, dist2_min, dist2_max)
-            print '________________________'
+            print(max(pos_min-1, 0)*' '+'<'+(pos_max-pos_min)*'X'+'|')
+            print('vehicle %s from line %d: %.f--%2f' % (id_veh2, lineind2, dist2_min, dist2_max))
+            print('________________________')
         else:
-            print 'WARNING: some negative distances:'
-            print 'vehicle %s from line %d: %.f--%2f' % (id_veh1, lineind1, dist1_min, dist1_max)
-            print 'vehicle %s from line %d: %.f--%2f' % (id_veh2, lineind2, dist2_min, dist2_max)
+            print('WARNING: some negative distances:')
+            print('vehicle %s from line %d: %.f--%2f' % (id_veh1, lineind1, dist1_min, dist1_max))
+            print('vehicle %s from line %d: %.f--%2f' % (id_veh2, lineind2, dist2_min, dist2_max))
 
     def enter_veh(self, id_veh, id_veh_sumo, id_merge_from, id_merge_to, id_edge_merge_sumo, vehicles, debug=0):
-        print 'enter_veh id_veh %s, id_merge_from %d to id_merge_to %d' % (id_veh_sumo, id_merge_from, id_merge_to)
+        print('enter_veh id_veh %s, id_merge_from %d to id_merge_to %d' % (id_veh_sumo, id_merge_from, id_merge_to))
 
         # in id_merge_from: take vehicle out of merged queue and input queue
 
@@ -1709,7 +1709,7 @@ class Mergenodes(am.ArrayObjman):
 
         if indpos == -1:
             # vehicle is new and must be merged into   ids_vehs_merged
-            print '  merge prt.%d' % id_veh, 'lineind', lineind, 'dtm %.1fm' % dist_tomerge_head_new, 'n_plat', vehicles.get_platoonsize(id_veh), vehicles.lengths_plat[id_veh]/vehicles.length
+            print('  merge prt.%d' % id_veh, 'lineind', lineind, 'dtm %.1fm' % dist_tomerge_head_new, 'n_plat', vehicles.get_platoonsize(id_veh), vehicles.lengths_plat[id_veh]/vehicles.length)
 
             ids_vehs_merged = self.ids_vehs_merged[id_merge_to]
             ids_vehs_merged_sumo = self.ids_vehs_merged_sumo[id_merge_to]
@@ -1720,11 +1720,11 @@ class Mergenodes(am.ArrayObjman):
             is_insert = False
             id_veh_merged = -1
             if debug > 0:
-                print '  ids_vehs_merged_sumo[%d]' % id_merge_to, ids_vehs_merged_sumo
-                print '  lineinds_vehs_merged[%d]' % id_merge_to, lineinds_vehs_merged
+                print('  ids_vehs_merged_sumo[%d]' % id_merge_to, ids_vehs_merged_sumo)
+                print('  lineinds_vehs_merged[%d]' % id_merge_to, lineinds_vehs_merged)
             if (ind_insert == 0) | self.are_station[id_merge_to]:
                 if debug > 0:
-                    print '    new vehicle is the only vehicle or station', ind_insert, self.are_station[id_merge_to]
+                    print('    new vehicle is the only vehicle or station', ind_insert, self.are_station[id_merge_to])
 
                 # vehicles heading toward a station merge are not
                 # really merged because only one incoming line
@@ -1740,7 +1740,7 @@ class Mergenodes(am.ArrayObjman):
 
                 if debug > 0:
                     dist_tomerge_head_new2 = get_traci_distance(id_veh_sumo, id_edge_merge_sumo, 3.0)
-                    print '   compare dist_tomerge_head_new', dist_tomerge_head_new, 'dist_tomerge_head_new2', dist_tomerge_head_new2
+                    print('   compare dist_tomerge_head_new', dist_tomerge_head_new, 'dist_tomerge_head_new2', dist_tomerge_head_new2)
 
                 # get back to traci distance measurement
                 dist_tomerge_head_new = get_traci_distance(id_veh_sumo, id_edge_merge_sumo, 3.0)
@@ -1752,11 +1752,11 @@ class Mergenodes(am.ArrayObjman):
                 #dist_tomerge_tail_new = get_traci_distance(id_veh_tail_new_sumo, id_edge_merge_sumo, 3.0)
 
                 if debug > 0:
-                    print '    new prt.%d arriving from in %d at dist head %.2f /__| tail prt.%d %.2fm' % (id_veh, lineind, dist_tomerge_head_new, id_veh_tail_new, dist_tomerge_tail_new)
-                    print '    ids_vehs_merged_sumo', ids_vehs_merged_sumo
+                    print('    new prt.%d arriving from in %d at dist head %.2f /__| tail prt.%d %.2fm' % (id_veh, lineind, dist_tomerge_head_new, id_veh_tail_new, dist_tomerge_tail_new))
+                    print('    ids_vehs_merged_sumo', ids_vehs_merged_sumo)
                 for id_veh_merged, id_veh_merged_sumo, odo, lineind_merge in zip(ids_vehs_merged[::-1], ids_vehs_merged_sumo[::-1], odos_veh_merged[::-1], lineinds_vehs_merged[::-1]):
                     if debug > 0:
-                        print '     id_veh_merged_sumo', id_veh_merged_sumo
+                        print('     id_veh_merged_sumo', id_veh_merged_sumo)
                     # unprecise
                     #dist_tomerge_head2 = get_traci_distance(id_veh_merged_sumo, id_edge_merge_sumo, 3.0)
 
@@ -1769,7 +1769,7 @@ class Mergenodes(am.ArrayObjman):
 
                     if debug > 0:
                         dist_tomerge_head2 = get_traci_distance(id_veh_merged_sumo, id_edge_merge_sumo, 3.0)
-                        print '      compare', id_veh_merged_sumo, ' dist_tomerge_head %.1f' % dist_tomerge_head, 'dist_tomerge_head2 %.1f' % dist_tomerge_head2
+                        print('      compare', id_veh_merged_sumo, ' dist_tomerge_head %.1f' % dist_tomerge_head, 'dist_tomerge_head2 %.1f' % dist_tomerge_head2)
 
                     # get back to traci distance measurement
                     dist_tomerge_head = get_traci_distance(id_veh_merged_sumo, id_edge_merge_sumo, 3.0)
@@ -1778,7 +1778,7 @@ class Mergenodes(am.ArrayObjman):
                     else:
                         dist_node = self.distances_node_in2[id_merge_to]
                     if debug > 0:
-                        print '      M:odo_enter=%.1f odo=%.1f delta=%.f dist_node=%.1f line%d platl=%d' % (odo, get_traci_odo(id_veh_merged_sumo), get_traci_odo(id_veh_merged_sumo)-odo, dist_node, lineind_merge, vehicles.lengths_plat[id_veh_merged])
+                        print('      M:odo_enter=%.1f odo=%.1f delta=%.f dist_node=%.1f line%d platl=%d' % (odo, get_traci_odo(id_veh_merged_sumo), get_traci_odo(id_veh_merged_sumo)-odo, dist_node, lineind_merge, vehicles.lengths_plat[id_veh_merged]))
 
                     #stoppeddist_tomerge = dist-0.5/self.decel*get_traci_velocity(id_veh_merged_sumo)**2+vehicles.lengths_plat[id_veh]
                     #stoppeddist_tomerge = dist+vehicles.lengths_plat[id_veh]
@@ -1789,7 +1789,7 @@ class Mergenodes(am.ArrayObjman):
                     dist_tomerge_tail = get_traci_distance(id_veh_tail_sumo, id_edge_merge_sumo, 3.0)
                     #dist_tomerge_tail = dist_tomerge_head + vehicles.lengths_plat[id_veh_merged]+vehicles.length
                     if debug > 0:
-                        print '      compare lineind_merge', lineind_merge, '=?', lineinds_vehs_merged[ind_insert-1]
+                        print('      compare lineind_merge', lineind_merge, '=?', lineinds_vehs_merged[ind_insert-1])
 
                     if debug > 0:
                         self.print_vehs(id_veh, id_veh_merged,
@@ -1803,13 +1803,13 @@ class Mergenodes(am.ArrayObjman):
 
                     if lineind == lineinds_vehs_merged[ind_insert-1]:  # get this from
                         if debug > 0:
-                            print '  vehicle in front on same branch'
+                            print('  vehicle in front on same branch')
                         is_insert = True
                         break
 
                     if dist_tomerge_tail_new > dist_tomerge_tail:
                         if debug > 0:
-                            print '  distance of tail to merge of new vehicle is greater than existing'
+                            print('  distance of tail to merge of new vehicle is greater than existing')
                             # print '  =>insert new %s after existing %s'%(id_veh_sumo,id_veh_merged_sumo)
                         is_insert = True
                         break
@@ -1819,11 +1819,11 @@ class Mergenodes(am.ArrayObjman):
                 if is_insert:
                     # at least one vehicle is in front
                     if debug > 0:
-                        print '    insert veh %d behind veh %d, index %d' % (id_veh, id_veh_merged, ind_insert)
+                        print('    insert veh %d behind veh %d, index %d' % (id_veh, id_veh_merged, ind_insert))
                     # send control info to involved vehicles
                     if ind_insert == len(ids_vehs_merged):
                         if debug > 0:
-                            print '    appended vehicle after veh', id_veh_tail_sumo, 'with leader', ids_vehs_merged_sumo[ind_insert-1], 'dtm=%.2fm' % dist_tomerge_tail
+                            print('    appended vehicle after veh', id_veh_tail_sumo, 'with leader', ids_vehs_merged_sumo[ind_insert-1], 'dtm=%.2fm' % dist_tomerge_tail)
                         # V
                         # |
                         # G ind_insert-1
@@ -1847,7 +1847,7 @@ class Mergenodes(am.ArrayObjman):
                         #id_ghost2 = ids_vehs_merged[ind_insert-1]
                         id_ghost2 = id_veh_tail
                         if debug > 0:
-                            print '    vehicle will be inserted in front of', ids_vehs_merged_sumo[ind_insert], 'and in behind', id_veh_tail_sumo, 'with leader', ids_vehs_merged_sumo[ind_insert-1], 'dtm=%.2fm' % dist_tomerge_tail
+                            print('    vehicle will be inserted in front of', ids_vehs_merged_sumo[ind_insert], 'and in behind', id_veh_tail_sumo, 'with leader', ids_vehs_merged_sumo[ind_insert-1], 'dtm=%.2fm' % dist_tomerge_tail)
 
                         vehicles.del_ghost(id_ghost1, id_ghost2)
                         if lineinds_vehs_merged[ind_insert] != lineind:
@@ -1859,7 +1859,7 @@ class Mergenodes(am.ArrayObjman):
 
                 else:
                     if debug > 0:
-                        print '    prepend prt.%d in front of prt.%d, first index %d' % (id_veh, id_veh_merged, ind_insert)
+                        print('    prepend prt.%d in front of prt.%d, first index %d' % (id_veh, id_veh_merged, ind_insert))
                     # is vehicle and ghost in the same input line?
                     if lineinds_vehs_merged[ind_insert] != lineind:
                         id_veh_behind = ids_vehs_merged[ind_insert]  # last veh in queue
@@ -1880,7 +1880,7 @@ class Mergenodes(am.ArrayObjman):
             #    lineinds_vehs_merged[0] = lineind
 
     def enter_veh_entry(self, id_veh, id_veh_sumo, id_merge_from, id_merge_to, id_edge_merge_sumo, vehicles, debug=0):
-        print 'enter_veh_entry id_veh %s, id_merge_from %d to id_merge_to %d' % (id_veh_sumo, id_merge_from, id_merge_to)
+        print('enter_veh_entry id_veh %s, id_merge_from %d to id_merge_to %d' % (id_veh_sumo, id_merge_from, id_merge_to))
 
         # in id_merge_from: take vehicle out of merged queue and input queue
 
@@ -1913,8 +1913,8 @@ class Mergenodes(am.ArrayObjman):
         if lineind == 1:
             # from line 1 (main line)
             if debug > 0:
-                print '  Detected veh', id_veh_sumo, 'on mainline. Is new', indpos == -1
-                print '    check for platooned vehicles:', vehicles.get_platoon(id_veh)
+                print('  Detected veh', id_veh_sumo, 'on mainline. Is new', indpos == -1)
+                print('    check for platooned vehicles:', vehicles.get_platoon(id_veh))
 
             id_edge_out_sumo = self.ids_merge_to_ids_edge_out_sumo[id_merge_to]
             dist_tomerge = get_traci_distance(id_veh_sumo, id_edge_out_sumo, 3.0)
@@ -1926,18 +1926,18 @@ class Mergenodes(am.ArrayObjman):
 
             id_veh2, state2 = self.get_mergeveh_entry(id_merge_to, debug)
             if debug > 0:
-                print '  Conflict vehicle from entry line: prt.%d state' % (id_veh2,), state2
-                print '  Main line: ids_vehs_in1', ids_vehs_in1
-                print '    id_veh1_last', id_veh1_last
-                print '    dist_tomerge', dist_tomerge
+                print('  Conflict vehicle from entry line: prt.%d state' % (id_veh2,), state2)
+                print('  Main line: ids_vehs_in1', ids_vehs_in1)
+                print('    id_veh1_last', id_veh1_last)
+                print('    dist_tomerge', dist_tomerge)
 
             if id_veh2 == -1:
                 if debug > 0:
-                    print '  no vehicle to merge'
+                    print('  no vehicle to merge')
 
                 if id_veh1_last != -1:
                     if debug > 0:
-                        print '  control distance to last vehicle in main...by SUMO'
+                        print('  control distance to last vehicle in main...by SUMO')
                     pass
                     #
                     #id_veh_tail = vehicles.get_platoontail(id_veh1_last)
@@ -1949,14 +1949,14 @@ class Mergenodes(am.ArrayObjman):
 
                 else:
                     if debug > 0:
-                        print '  merge is empty'
+                        print('  merge is empty')
                     pass
 
             elif state2['status'] != 'wait':
                 # there is an approaching vehicle on entry line
                 if state2['status'] == 'accelerate':
                     if debug > 0:
-                        print '  conflict vehicle in acceleration mode', 'is veh behind', state2.has_key('id_veh_behind')
+                        print('  conflict vehicle in acceleration mode', 'is veh behind', state2.has_key('id_veh_behind'))
                     if state2.has_key('id_veh_behind'):
                         # accelerating vehicle has already a vehicle
                         # in front of which to merge
@@ -1971,7 +1971,7 @@ class Mergenodes(am.ArrayObjman):
 
                 if state2['status'] == 'sync':
                     if debug > 0:
-                        print '  conflict vehicle in sync mode'
+                        print('  conflict vehicle in sync mode')
                     if state2.has_key('id_veh_behind'):
                         # accelerating vehicle has already a vehicle
                         # in front of which to merge
@@ -1987,7 +1987,7 @@ class Mergenodes(am.ArrayObjman):
                         id_veh_tail = vehicles.get_platoontail(id_veh2)
                         id_veh_tail_sumo = vehicles.ids_sumo[id_veh_tail]
                         dist_tomerge_tail = get_traci_distance(id_veh_tail_sumo, id_edge_out_sumo, 3.0)
-                        print '  let look the new vehicle prt.%d look at the tail of the entering vehicle prt.%d' % (id_veh, id_veh_tail)
+                        print('  let look the new vehicle prt.%d look at the tail of the entering vehicle prt.%d' % (id_veh, id_veh_tail))
                         vehicles.add_ghost(id_veh, id_veh_tail, dist_tomerge, dist_tomerge_tail)
 
                         # let the entering vehicle see the new vehicle
@@ -2004,12 +2004,12 @@ class Mergenodes(am.ArrayObjman):
 
         elif lineind == 2:
             # from line 2 (entry line)
-            print '  Detected veh', id_veh_sumo, 'on entry line. Is new', indpos == -1
+            print('  Detected veh', id_veh_sumo, 'on entry line. Is new', indpos == -1)
 
             self.ids_vehs_in2[id_merge_to].append(id_veh)
             self.ids_vehs_in2_sumo[id_merge_to].append(id_veh_sumo)
 
-            print '    command vehicle to stop and wait further instructions'
+            print('    command vehicle to stop and wait further instructions')
             #vehicles.control_slow_down(id_veh, speed = 6.0/3.6)
             #traci.vehicle.setMaxSpeed(id_veh_sumo, 6.0/3.6)
             # print '    set speed to',traci.vehicle.getMaxSpeed(id_veh_sumo)
@@ -2019,9 +2019,9 @@ class Mergenodes(am.ArrayObjman):
 
             # prevent SUMO from reaccelerating vehicle
             # vehicles.switch_off_control(id_veh)
-            print '    set veh id_veh prt.%d' % id_veh
+            print('    set veh id_veh prt.%d' % id_veh)
             self.vehicles_entries[id_merge_to][id_veh] = {'status': 'wait'}
-            print '    vehicles_entries[', id_merge_to, ']=', self.vehicles_entries[id_merge_to]
+            print('    vehicles_entries[', id_merge_to, ']=', self.vehicles_entries[id_merge_to])
             #
             # self.vehicles_mains[id_merge_to][id_veh] = {}# later when used
 
@@ -2038,14 +2038,14 @@ class Mergenodes(am.ArrayObjman):
 
         vehicles_entries = self.vehicles_entries[id_merge]
         if debug > 0:
-            print 'get_mergeveh_entry vehicles_entries', vehicles_entries
+            print('get_mergeveh_entry vehicles_entries', vehicles_entries)
         if len(vehicles_entries) == 0:
             return -1, {'status': 'wait'}
         else:
             return vehicles_entries.keys()[0], vehicles_entries.values()[0]
 
     def process_step_entry(self, id_merge, vehicles, debug):
-        print 'process_step_entry id_merge', id_merge
+        print('process_step_entry id_merge', id_merge)
 
         #self.vehicles_entries[id_merge]= OrderedDict()
         # self.vehicles_mains[id_merge] = OrderedDict()
@@ -2061,9 +2061,9 @@ class Mergenodes(am.ArrayObjman):
         time_update = self.time_update.get_value()
 
         if debug:
-            print '  vehicles_entries=', self.vehicles_entries[id_merge]
-            print '  vehicles_mains', self.vehicles_mains[id_merge]
-            print '  ids_veh_in1', ids_veh_in1
+            print('  vehicles_entries=', self.vehicles_entries[id_merge])
+            print('  vehicles_mains', self.vehicles_mains[id_merge])
+            print('  ids_veh_in1', ids_veh_in1)
 
         i = 0
         #is_cont = len(ids_veh_entry)>0
@@ -2078,7 +2078,7 @@ class Mergenodes(am.ArrayObjman):
             lineinds_vehs_merged = self.lineinds_vehs_merged[id_merge]
             odos_veh_merged = self.odos_vehs_merged[id_merge]
             if debug:
-                print '  check id_veh_sumo', id_veh_sumo, 'status', state['status'], 'n vehs on main', len(ids_veh_in1)
+                print('  check id_veh_sumo', id_veh_sumo, 'status', state['status'], 'n vehs on main', len(ids_veh_in1))
             if state['status'] == 'wait':
                 if traci.vehicle.isStopped(id_veh_sumo):
                     # check potential conflict vehicle on main line
@@ -2086,7 +2086,7 @@ class Mergenodes(am.ArrayObjman):
                     n1 = len(ids_veh_in1)
                     if n1 == 0:
                         if debug:
-                            print '    main line is empty => accelerate immediately'
+                            print('    main line is empty => accelerate immediately')
                         for id_veh_plat in vehicles.get_platoon(id_veh):
                             vehicles.control_speedup(id_veh_plat)
                         state['status'] = 'accelerate'
@@ -2108,7 +2108,7 @@ class Mergenodes(am.ArrayObjman):
                             id_veh1_sumo = ids_veh_in1_sumo[i]
                             id_veh1 = ids_veh_in1[i]
                             if debug:
-                                print '    check', id_veh1_sumo, 'free', id_veh1 not in vehicles_main
+                                print('    check', id_veh1_sumo, 'free', id_veh1 not in vehicles_main)
 
                             if True:  # id_veh1 not in vehicles_main:
 
@@ -2124,7 +2124,7 @@ class Mergenodes(am.ArrayObjman):
                                                                        dist_in1, dist_in2,
                                                                        vehicles)
                                 if debug:
-                                    print '    potential veh %s (tail %s)' % (id_veh1_sumo, id_veh1_tail_sumo), 'at pos1_tail=%.1f>p_to=%.1f' % (pos1_tail, p_to), pos1_tail > p_to
+                                    print('    potential veh %s (tail %s)' % (id_veh1_sumo, id_veh1_tail_sumo), 'at pos1_tail=%.1f>p_to=%.1f' % (pos1_tail, p_to), pos1_tail > p_to)
 
                                 # here we check whether the tail of the vehicle on the main line
                                 # has passed the critical point p_to
@@ -2133,7 +2133,7 @@ class Mergenodes(am.ArrayObjman):
 
                                     if i == n1-1:  # last vehicle on main
                                         if debug:
-                                            print '      insert id_veh', id_veh_sumo, 'behind id_veh1', id_veh1_sumo, 'the only veh on main'
+                                            print('      insert id_veh', id_veh_sumo, 'behind id_veh1', id_veh1_sumo, 'the only veh on main')
                                         state['id_veh_infront'] = id_veh1
                                         if vehicles_main.has_key(id_veh1):
                                             vehicles_main[id_veh1]['id_veh_behind'] = id_veh
@@ -2151,7 +2151,7 @@ class Mergenodes(am.ArrayObjman):
                                         id_veh_behind_sumo = vehicles.ids_sumo[id_veh_behind]
                                         pos1 = dist_in1 - get_traci_distance(id_veh_behind_sumo, id_edge_out_sumo, 3.0)
                                         if debug:
-                                            print '      vehicle behind', id_veh_behind_sumo, 'pos=%.1f, p_from=%.1f' % (pos1, p_from), 'ok', pos1 < p_from
+                                            print('      vehicle behind', id_veh_behind_sumo, 'pos=%.1f, p_from=%.1f' % (pos1, p_from), 'ok', pos1 < p_from)
                                         if pos1 < p_from:
                                             state['id_veh_infront'] = id_veh1
                                             state['id_veh_behind'] = id_veh_behind
@@ -2170,7 +2170,7 @@ class Mergenodes(am.ArrayObjman):
                                             is_found = True
                                             j = ids_vehs_merged.index(id_veh1)+1
                                             if debug:
-                                                print '        j=', j
+                                                print('        j=', j)
                                             ids_vehs_merged.insert(j, id_veh)
                                             ids_vehs_merged_sumo.insert(j, id_veh_sumo)
                                             lineinds_vehs_merged.insert(j, 2)
@@ -2181,7 +2181,7 @@ class Mergenodes(am.ArrayObjman):
                                 elif pos1 < p_from:
                                     if i == 0:  # first vehicle on main
                                         if debug:
-                                            print '      insert id_veh', id_veh_sumo, 'in front of id_veh1', id_veh1_sumo, 'the only veh on main'
+                                            print('      insert id_veh', id_veh_sumo, 'in front of id_veh1', id_veh1_sumo, 'the only veh on main')
                                         state['id_veh_behind'] = id_veh1
                                         #vehicles_main[id_veh1] = id_veh
                                         if vehicles_main.has_key(id_veh1):
@@ -2198,7 +2198,7 @@ class Mergenodes(am.ArrayObjman):
                                         lineinds_vehs_merged.insert(j, 2)
                                         odos_veh_merged.insert(j, get_traci_odo(id_veh_sumo))
                                         if debug:
-                                            print '        ids_vehs_merged_sumo', ids_vehs_merged_sumo
+                                            print('        ids_vehs_merged_sumo', ids_vehs_merged_sumo)
                                     # elif i < n1-1: # there are others behind on main
                                     #    # ensure that gap is big enough
                                     #    id_veh_behind = ids_veh_in1[i+1]
@@ -2214,7 +2214,7 @@ class Mergenodes(am.ArrayObjman):
 
                         if is_found:
                             if debug:
-                                print '    suitable vehicle after which entry vehicle can run has been found'
+                                print('    suitable vehicle after which entry vehicle can run has been found')
                             # Note: if no vehicle has been found then
                             # nothing will happen and the vehicle will
                             # wait until the righ moment has arrived
@@ -2226,7 +2226,7 @@ class Mergenodes(am.ArrayObjman):
                 # test if speed reached
                 if traci.vehicle.getSpeed(id_veh_sumo) > 0.9*vehicles.speed_max.get_value():
                     if debug > 0:
-                        print '    synchronization reached for veh', id_veh_sumo
+                        print('    synchronization reached for veh', id_veh_sumo)
                     state['status'] = 'sync'
                     #id_veh_del = id_veh
                     # now create ghosts
@@ -2239,7 +2239,7 @@ class Mergenodes(am.ArrayObjman):
                         dist_tomerge_tail = get_traci_distance(id_veh_infront_tail_sumo, id_edge_out_sumo, 3.0)
 
                         if debug > 0:
-                            print '      add ghost to entering veh', id_veh_sumo, ' behind', id_veh_infront_tail_sumo, 'with leader', id_veh_in_front
+                            print('      add ghost to entering veh', id_veh_sumo, ' behind', id_veh_infront_tail_sumo, 'with leader', id_veh_in_front)
                         vehicles.add_ghost(id_veh, id_veh_infront_tail, dist_tomerge,
                                            dist_tomerge_tail, is_substitute=True)
 
@@ -2254,14 +2254,14 @@ class Mergenodes(am.ArrayObjman):
                         dist_tomerge_tail = get_traci_distance(id_veh_tail_sumo, id_edge_out_sumo, 3.0)
 
                         if debug > 0:
-                            print '      add ghost to mainline veh', id_veh_behind_sumo, ' behind', id_veh_tail_sumo, 'with leader', id_veh_sumo
+                            print('      add ghost to mainline veh', id_veh_behind_sumo, ' behind', id_veh_tail_sumo, 'with leader', id_veh_sumo)
                         vehicles.add_ghost(id_veh_behind, id_veh_tail, dist_tomerge_behind,
                                            dist_tomerge_tail, is_substitute=True)
 
                 else:
                     if 0:
                         speed = traci.vehicle.getSpeed(id_veh_sumo)
-                        print '    sync of veh', id_veh_sumo, ',v=%.1f, not yet reached: %.2f' % (speed, speed/vehicles.speed_max.get_value())
+                        print('    sync of veh', id_veh_sumo, ',v=%.1f, not yet reached: %.2f' % (speed, speed/vehicles.speed_max.get_value()))
 
                     if state.has_key('id_veh_behind'):
                         id_veh_behind_sumo = vehicles.ids_sumo[state['id_veh_behind']]
@@ -2300,7 +2300,7 @@ class Mergenodes(am.ArrayObjman):
         pos_to refers to the position of the tail of the platoon on the main line.
 
         """
-        print 'get_pos_crit_entry pos2=%.1f, v=%.1f, d1=%.1f, d2=%.1f' % (pos2, speed, dist1, dist2)
+        print('get_pos_crit_entry pos2=%.1f, v=%.1f, d1=%.1f, d2=%.1f' % (pos2, speed, dist1, dist2))
         # see 191030
         decel_emergency = vehicles.decel_emergency.get_value()
         decel_comfort = vehicles.decel_comfort.get_value()
@@ -2321,9 +2321,9 @@ class Mergenodes(am.ArrayObjman):
         Returns id_node, length to node
 
         """
-        print 'search_upstream_merge id_edge_start', id_edge_start
+        print('search_upstream_merge id_edge_start', id_edge_start)
         length = distances[id_edge_start]
-        print '        added id_edge', id_edge_start, 'dist', distances[id_edge_start], '=', length
+        print('        added id_edge', id_edge_start, 'dist', distances[id_edge_start], '=', length)
         is_merge = False
         id_edge_platform = -1
         id_edge = id_edge_start
@@ -2357,10 +2357,10 @@ class Mergenodes(am.ArrayObjman):
             if not is_merge:
                 id_edge = ids_edge_incoming[0]
                 length += distances[id_edge]
-                print '        added id_edge', id_edge, 'dist', distances[id_edge], '=', length
+                print('        added id_edge', id_edge, 'dist', distances[id_edge], '=', length)
 
             # print '    id_edge,is_merge',id_edge,is_merge
-        print '  found node', edges.ids_fromnode[id_edge]
+        print('  found node', edges.ids_fromnode[id_edge])
         return edges.ids_fromnode[id_edge], length
 
     def search_downstream_merges(self, id_edge_start, edges, lanes, id_prtmode, ids_sinkedge=set()):
@@ -2372,7 +2372,7 @@ class Mergenodes(am.ArrayObjman):
 
         ids_edge = set([id_edge_start])
         ids_mergenode = set()
-        print 'search_downstream_merges id_edge_start', id_edge_start, 'is sinkedge', id_edge_start in ids_sinkedge
+        print('search_downstream_merges id_edge_start', id_edge_start, 'is sinkedge', id_edge_start in ids_sinkedge)
 
         if id_edge_start in ids_sinkedge:
             return None  # np.array([], dtype = np.int32)
@@ -2424,7 +2424,7 @@ class Mergenodes(am.ArrayObjman):
 
         # if not is_cont:
         #    print '  endless!!id_edge_start,ids_edge',id_edge_start,ids_edge
-        print '  found ids_mergenode', ids_mergenode
+        print('  found ids_mergenode', ids_mergenode)
         return np.array(list(ids_mergenode), dtype=np.int32)
 
     def is_prt_only(self, ids_lane, lanes):
@@ -2554,7 +2554,7 @@ class PrtBerths(am.ArrayObjman):
                                      ))
 
     def set_allocate(self, ids_berth):
-        print 'set_allocate ids_berth', ids_berth, self.ids_veh[ids_berth]
+        print('set_allocate ids_berth', ids_berth, self.ids_veh[ids_berth])
         self.states[ids_berth] = BERTHSTATES['allocated']
 
     def set_alighting(self, id_berth, id_veh):
@@ -2572,7 +2572,7 @@ class PrtBerths(am.ArrayObjman):
 
     def set_waiting_routed(self, id_berth, simtime):
 
-        print 'set_waiting_routed', id_berth, 'prt.%d' % (self.ids_veh[id_berth]), 'simtime', simtime
+        print('set_waiting_routed', id_berth, 'prt.%d' % (self.ids_veh[id_berth]), 'simtime', simtime)
         self.states[id_berth] = BERTHSTATES['waiting_routed']
         self.times_routes[id_berth] = simtime
 
@@ -2757,7 +2757,7 @@ class PrtPlatoonStops(am.ArrayObjman):
         ptstops = net.ptstops
         lanes = net.lanes
         n = len(coords_from)
-        print 'get_closest_for_trip', n
+        print('get_closest_for_trip', n)
 
         times_stop_to_stop = self.parent.times_stop_to_stop[1:, 1:]
 
@@ -2792,11 +2792,11 @@ class PrtPlatoonStops(am.ArrayObjman):
                     # print '    walktimes_to',walktimes_to.shape
                     # print '    times_stop_to_stop',times_stop_to_stop.shape
 
-                    print '  id_person', id_person
-                    print '    coord_from, coord_to', coord_from, coord_to
-                    print '    times_door_to_door\n', times_door_to_door
-                    print '       ind_from, ind_to', ind_from, ind_to
-                    print '       id_stop_from, id_stop_to', ids_prtstop[ind_from], ids_prtstop[ind_to]
+                    print('  id_person', id_person)
+                    print('    coord_from, coord_to', coord_from, coord_to)
+                    print('    times_door_to_door\n', times_door_to_door)
+                    print('       ind_from, ind_to', ind_from, ind_to)
+                    print('       id_stop_from, id_stop_to', ids_prtstop[ind_from], ids_prtstop[ind_to])
 
             i += 1
 
@@ -2871,7 +2871,7 @@ class PrtPlatoonStops(am.ArrayObjman):
 
     def prepare_sim(self, process):
         simtime = process.simtime
-        print 'PrtStops.prepare_sim', simtime
+        print('PrtStops.prepare_sim', simtime)
         self.debug = True
         net = self.get_scenario().net
         ptstops = net.ptstops
@@ -2927,11 +2927,11 @@ class PrtPlatoonStops(am.ArrayObjman):
             if (firstberthpos-stoplinegap) > 0:
                 self.stoplines_in[id_stop] = firstberthpos-stoplinegap
 
-                print '  OK:id_stop', id_stop, 'stoplines_in', self.stoplines_in[id_stop]
+                print('  OK:id_stop', id_stop, 'stoplines_in', self.stoplines_in[id_stop])
                 self.capas_inqueue[id_stop] = int(self.stoplines_in[id_stop]/vehicles.length)
-                print '    capa_inqueue', self.capas_inqueue[id_stop]
+                print('    capa_inqueue', self.capas_inqueue[id_stop])
             else:
-                print 'WARNING in PrtStops.prepare_sim: stop ID %d has not enough space at before berth area.' % id_stop
+                print('WARNING in PrtStops.prepare_sim: stop ID %d has not enough space at before berth area.' % id_stop)
 
         # Determine stopline position  where vehicles actually start
         # running off the station
@@ -2946,14 +2946,14 @@ class PrtPlatoonStops(am.ArrayObjman):
             lastberthstoppos = berths.stoppositions[ids_board][-1]
             if (length_stopedge-lastberthstoppos) > stoplinegap+1:
                 self.stoplines[id_stop] = length_stopedge-stoplinegap
-                print '  OK:id_stop', id_stop, 'length_stopedge', length_stopedge, 'stopline', self.stoplines[id_stop]
+                print('  OK:id_stop', id_stop, 'length_stopedge', length_stopedge, 'stopline', self.stoplines[id_stop])
 
             elif length_stopedge > lastberthstoppos:
                 self.stoplines[id_stop] = 0.5*(length_stopedge+lastberthstoppos)
-                print '  Limit:id_stop', id_stop, 'length_stopedge', length_stopedge, 'stopline', self.stoplines[id_stop]
+                print('  Limit:id_stop', id_stop, 'length_stopedge', length_stopedge, 'stopline', self.stoplines[id_stop])
 
             self.capas_outqueue[id_stop] = int((self.stoplines[id_stop]-lastberthstoppos)/vehicles.length)
-            print '    capa_outqueue', self.capas_outqueue[id_stop]
+            print('    capa_outqueue', self.capas_outqueue[id_stop])
 
         self.ids_stop_to_ids_acceledge_sumo = np.zeros(np.max(ids)+1, dtype=np.object)
         for id_stop, id_stopedge in zip(ids, ids_stopedge):
@@ -3071,7 +3071,7 @@ class PrtPlatoonStops(am.ArrayObjman):
 
         # various initianilizations
         for id_stop, id_edge_sumo in zip(ids, self.ids_stop_to_ids_edge_sumo[ids]):
-            print '  initialize stop', id_stop
+            print('  initialize stop', id_stop)
 
             # initially all berth are avalable for allocation
             # print '    type(self.ids_berths[id_stop])',type(self.ids_berths[id_stop])
@@ -3118,8 +3118,8 @@ class PrtPlatoonStops(am.ArrayObjman):
 
     def process_step(self, process):
         simtime = process.simtime
-        print 79*'_'
-        print 'PrtStops.process_step at', simtime
+        print(79*'_')
+        print('PrtStops.process_step at', simtime)
 
         # vehicle station process:
         # >forewarding (def enter)
@@ -3142,9 +3142,9 @@ class PrtPlatoonStops(am.ArrayObjman):
             zip(ids, self.ids_stop_to_ids_edge_sumo[ids],
                 self.ids_vehs_sumo_prev[ids],
                 self.ids_persons_sumo_prev[ids]):
-            print '  '+60*'.'
+            print('  '+60*'.')
             fase = self.fases[id_stop]
-            print '  process id_stop', id_stop, 'id_edge_sumo', id_edge_sumo, 'fase', fase
+            print('  process id_stop', id_stop, 'id_edge_sumo', id_edge_sumo, 'fase', fase)
 
             if id_stop in [3]:
                 self.debug = 1
@@ -3156,34 +3156,34 @@ class PrtPlatoonStops(am.ArrayObjman):
 
             if self.debug:
 
-                print '    ids_berths_to_allocate', type(self.ids_berths_to_allocate[id_stop]), self.ids_berths_to_allocate[id_stop]
-                print '    ind_berth_allocated', self.inds_berth_allocated[id_stop]
-                print '    ids_vehs_inqueue', self.ids_vehs_inqueue[id_stop]
-                print '    Capa', self.get_capacity(id_stop), 'per 10 seconds', self.get_capacity(id_stop)/3600*10
+                print('    ids_berths_to_allocate', type(self.ids_berths_to_allocate[id_stop]), self.ids_berths_to_allocate[id_stop])
+                print('    ind_berth_allocated', self.inds_berth_allocated[id_stop])
+                print('    ids_vehs_inqueue', self.ids_vehs_inqueue[id_stop])
+                print('    Capa', self.get_capacity(id_stop), 'per 10 seconds', self.get_capacity(id_stop)/3600*10)
                 print
 
-                print '    ids_vehs_alight_forward', self.ids_vehs_alight_forward[id_stop]
-                print '    ids_vehs_alight_aproach', self.ids_vehs_alight_aproach[id_stop]
+                print('    ids_vehs_alight_forward', self.ids_vehs_alight_forward[id_stop])
+                print('    ids_vehs_alight_aproach', self.ids_vehs_alight_aproach[id_stop])
                 print
 
-                print '    ids_vehs_routed', self.ids_vehs_routed[id_stop]
-                print '    ids_berths_veh_wait_exit ', self.ids_berths_veh_wait_exit[id_stop]
-                print '    ids_vehs_pass_wait_exit ', self.ids_vehs_pass_wait_exit[id_stop]
-                print '    ids_vehs_berth_exit', self.ids_vehs_berth_exit[id_stop]
-                print '    ids_vehs_out', self.ids_vehs_out[id_stop]
-                print '    ids_veh_ready_for_departure', self.ids_vehs_ready_for_departure[id_stop]
+                print('    ids_vehs_routed', self.ids_vehs_routed[id_stop])
+                print('    ids_berths_veh_wait_exit ', self.ids_berths_veh_wait_exit[id_stop])
+                print('    ids_vehs_pass_wait_exit ', self.ids_vehs_pass_wait_exit[id_stop])
+                print('    ids_vehs_berth_exit', self.ids_vehs_berth_exit[id_stop])
+                print('    ids_vehs_out', self.ids_vehs_out[id_stop])
+                print('    ids_veh_ready_for_departure', self.ids_vehs_ready_for_departure[id_stop])
 
-                print '    Vehicles:'
+                print('    Vehicles:')
                 ids_veh = self.ids_vehs[id_stop]
                 for id_veh, state, id_berth, route in zip(ids_veh, vehicles.states[ids_veh], vehicles.ids_berth[ids_veh], vehicles.routes[ids_veh]):
                     # ,'len(route)',len(route)
-                    print '    id_veh', id_veh, 'state', state, 'id_berth', id_berth, 'route', route
+                    print('    id_veh', id_veh, 'state', state, 'id_berth', id_berth, 'route', route)
 
-                print '    Berths:'
+                print('    Berths:')
 
                 ids_berth = self.ids_berths[id_stop]
                 for id_berth, state, id_veh in zip(ids_berth, berths.states[ids_berth], berths.ids_veh[ids_berth]):
-                    print '    id_berth', id_berth, 'state', state, 'id_veh', id_veh
+                    print('    id_berth', id_berth, 'state', state, 'id_veh', id_veh)
                 # print '    flow_person',self.flows_person[id_stop]
                 # print '    waittimes_persons',self.waittimes_persons[id_stop]
 
@@ -3195,7 +3195,7 @@ class PrtPlatoonStops(am.ArrayObjman):
 
             if 0:
                 for id_veh_sumo in self.ids_vehs_sumo_prev[id_stop]:
-                    print '    stopstate ', id_veh_sumo, bin(traci.vehicle.getStopState(id_veh_sumo))[2:], traci.vehicle.getRoute(id_veh_sumo)
+                    print('    stopstate ', id_veh_sumo, bin(traci.vehicle.getStopState(id_veh_sumo))[2:], traci.vehicle.getRoute(id_veh_sumo))
 
             # check for new vehicle arrivals/departures
             ids_veh_sumo = set(traci.edge.getLastStepVehicleIDs(id_edge_sumo))
@@ -3273,7 +3273,7 @@ class PrtPlatoonStops(am.ArrayObjman):
                     ids_veh_remove.append(id_veh)
                     id_berth_alight = vehicles.ids_berth[id_veh]
                     if self.debug:
-                        print '    %s stopped inside berth %d and alights' % (id_veh_sumo, id_berth_alight)
+                        print('    %s stopped inside berth %d and alights' % (id_veh_sumo, id_berth_alight))
 
                     # vehicles.set_stop(  id_veh,
                     #                    id_edge_sumo,
@@ -3300,8 +3300,8 @@ class PrtPlatoonStops(am.ArrayObjman):
             if ids_person_sumo_prev != ids_person_sumo:
 
                 if 0:
-                    print '  change\n  id_person_sumo', ids_person_sumo
-                    print '  ids_person_sumo_prev', ids_person_sumo_prev
+                    print('  change\n  id_person_sumo', ids_person_sumo)
+                    print('  ids_person_sumo_prev', ids_person_sumo_prev)
                 # print '  dir(traci.person)',dir(traci.person)
                 # for id_person_sumo in ids_person_sumo:
                 #    print '  id_person_sumo',id_person_sumo,traci.person.getRoadID(id_person_sumo),traci.person.getVehicle(id_person_sumo)
@@ -3324,7 +3324,7 @@ class PrtPlatoonStops(am.ArrayObjman):
                             # check if next trip has origin edge equal to edge of this stop
                             if id_edge_sumo_dests[0][2] == id_edge_sumo:
                                 if self.debug:
-                                    print '  add to waittimes_persons', id_person_sumo, 'id_stop_dest', id_edge_sumo_dests[0][1], 'id_toedge_sumo', id_edge_sumo_dests[0][3]
+                                    print('  add to waittimes_persons', id_person_sumo, 'id_stop_dest', id_edge_sumo_dests[0][1], 'id_toedge_sumo', id_edge_sumo_dests[0][3])
                                 self.waittimes_persons[id_stop][id_person_sumo] = simtime
                                 n_enter += 1
 
@@ -3346,7 +3346,7 @@ class PrtPlatoonStops(am.ArrayObjman):
 
             if 0:
                 for id_person_sumo in ids_person_sumo_prev:
-                    print '    ids_person_sumo=%s pos = %.2f ' % (id_person_sumo, traci.person.getLanePosition(id_person_sumo))
+                    print('    ids_person_sumo=%s pos = %.2f ' % (id_person_sumo, traci.person.getLanePosition(id_person_sumo)))
                 # nomore print '    ids_persons_sumo_boarded',self.ids_persons_sumo_boarded[id_stop]
 
             # if vehicles.id_follower_probe != vehicles.ids_follower[271]:
@@ -3368,7 +3368,7 @@ class PrtPlatoonStops(am.ArrayObjman):
                         # this will put the vehicle in waiting or boarding mode
                         if vehicles.is_completed_alighting(id_veh):
                             if self.debug:
-                                print '    state of prt.%d: %d' % (id_veh, vehicles.states[id_veh])
+                                print('    state of prt.%d: %d' % (id_veh, vehicles.states[id_veh]))
                             if vehicles.states[id_veh] == VEHICLESTATES['boarding']:
                                 # print '    set id_berth_board',id_berth_board,'to state boarding'
                                 berths.set_boarding(id_berth_board)
@@ -3396,15 +3396,15 @@ class PrtPlatoonStops(am.ArrayObjman):
             if fase == FASE_MOVE_IN:
                 # stop is in move in fase
                 if self.debug:
-                    print '  >>timeout fase 0: dt=%.2f timeout=%.2f' % ((simtime - self.times_phase_in[id_stop]), self.time_fase_in_max.get_value()),\
+                    print('  >>timeout fase 0: dt=%.2f timeout=%.2f' % ((simtime - self.times_phase_in[id_stop]), self.time_fase_in_max.get_value()),
                         'TOUT', ((simtime - self.times_phase_in[id_stop]) > self.time_fase_in_max.get_value()
-                                 ), '|ALLOC', (len(self.ids_vehs_inqueue[id_stop]) > 0)
+                                 ), '|ALLOC', (len(self.ids_vehs_inqueue[id_stop]) > 0))
                     # print   '    ap',(len(self.ids_vehs_alight_aproach[id_stop]) == 0)
-                    print '    no forward, all vehicles moved into berth', (len(self.ids_vehs_alight_forward[id_stop]) == 0)
-                    print '    ids_vehs_inqueue', self.ids_vehs_inqueue[id_stop]
-                    print '    ids_veh_to_allocate', ids_veh_to_allocate
-                    print '    ids_veh_to_pass', ids_veh_to_pass
-                    print '    is_back_to_move_in ', self.are_back_to_move_in[id_stop]
+                    print('    no forward, all vehicles moved into berth', (len(self.ids_vehs_alight_forward[id_stop]) == 0))
+                    print('    ids_vehs_inqueue', self.ids_vehs_inqueue[id_stop])
+                    print('    ids_veh_to_allocate', ids_veh_to_allocate)
+                    print('    ids_veh_to_pass', ids_veh_to_pass)
+                    print('    is_back_to_move_in ', self.are_back_to_move_in[id_stop])
                 # if np.isnan(self.times_phase_in[id_stop]):
                 #    # only for initialization
                 #    self.times_phase_in[id_stop] = simtime - self.time_fase_in_max.get_value()
@@ -3430,15 +3430,15 @@ class PrtPlatoonStops(am.ArrayObjman):
                     # which means that there are no more free berth to allocate
                     # and all forwarded vehicles reached their berth to alight
                     if self.debug:
-                        print '   Switch from fase %d to fase %d' % (self.fases[id_stop], FASE_MOVE_OUT)
+                        print('   Switch from fase %d to fase %d' % (self.fases[id_stop], FASE_MOVE_OUT))
                     self.fases[id_stop] = FASE_MOVE_OUT
                     self.times_phase_out[id_stop] = simtime
 
             elif fase == FASE_MOVE_OUT:
                 # stop is in move out fase
                 if self.debug:
-                    print '  >>timeout fase 1: dt=%.2f timeout=%.2f' % ((simtime - self.times_phase_out[id_stop]), self.time_fase_out_max.get_value()), 'move out of berth', len(self.ids_vehs_berth_exit[id_stop])
-                    print '                    n_berth_exit', len(self.ids_vehs_berth_exit[id_stop]), 'n_veh_pass', len(ids_veh_to_pass), 'ids_veh_to_pass', ids_veh_to_pass
+                    print('  >>timeout fase 1: dt=%.2f timeout=%.2f' % ((simtime - self.times_phase_out[id_stop]), self.time_fase_out_max.get_value()), 'move out of berth', len(self.ids_vehs_berth_exit[id_stop]))
+                    print('                    n_berth_exit', len(self.ids_vehs_berth_exit[id_stop]), 'n_veh_pass', len(ids_veh_to_pass), 'ids_veh_to_pass', ids_veh_to_pass)
                 # check fase transition
                 # if np.isnan(self.times_phase_out[id_stop]):
                 #    # only for initialization
@@ -3453,7 +3453,7 @@ class PrtPlatoonStops(am.ArrayObjman):
                     self.are_back_to_move_in[id_stop] = False
 
                     if self.debug:
-                        print '   Switch from fase %d to fase %d' % (self.fases[id_stop], FASE_MOVE_IN), 'ind_berth_allocated', self.inds_berth_allocated[id_stop]
+                        print('   Switch from fase %d to fase %d' % (self.fases[id_stop], FASE_MOVE_IN), 'ind_berth_allocated', self.inds_berth_allocated[id_stop])
 
                     self.fases[id_stop] = FASE_MOVE_IN
                     self.times_phase_in[id_stop] = simtime
@@ -3478,7 +3478,7 @@ class PrtPlatoonStops(am.ArrayObjman):
                             # command vehicle to go to berth for alighting
                             if id_berth > -1:
                                 if self.debug:
-                                    print '     foreward queued vehicle id_veh prt.%d to id_berth %d at pos %.2fm' % (id_veh, id_berth, berths.stoppositions[id_berth])
+                                    print('     foreward queued vehicle id_veh prt.%d to id_berth %d at pos %.2fm' % (id_veh, id_berth, berths.stoppositions[id_berth]))
                                 vehicles.control_berth_position_enter(id_veh, id_berth,
                                                                       id_edge_sumo=self.ids_stop_to_ids_edge_sumo[id_stop],
                                                                       # needs to stop a bit before to move in
@@ -3522,7 +3522,7 @@ class PrtPlatoonStops(am.ArrayObjman):
         #id_veh_sumo = self.parent.prtvehicles.get_id_sumo(id_veh)
         n_pax = traci.vehicle.getPersonNumber(id_veh_sumo)
         if self.debug:
-            print 'route_trip_occupied id_stop', id_stop, 'id_berth', id_berth, 'veh=%s' % id_veh_sumo, 'simtime', simtime, 'n_pax', n_pax
+            print('route_trip_occupied id_stop', id_stop, 'id_berth', id_berth, 'veh=%s' % id_veh_sumo, 'simtime', simtime, 'n_pax', n_pax)
 
         # identify which of the boarding persons is in the
         # vehicle which completed boarding
@@ -3535,14 +3535,14 @@ class PrtPlatoonStops(am.ArrayObjman):
         if len(ids_person_sumo_inveh) > 0:
             id_person_sumo_inveh = ids_person_sumo_inveh[0]
             if self.debug:
-                print '  found person %s in veh prt.%s' % (id_person_sumo_inveh, id_veh_sumo)
+                print('  found person %s in veh prt.%s' % (id_person_sumo_inveh, id_veh_sumo))
 
             # program vehicle to person's destination
             # print '    found person,origs_dests',id_person_sumo_inveh,self.id_person_to_origs_dests[id_person_sumo_inveh]
             id_stop_orig, id_stop_dest, id_edge_sumo_from, id_edge_sumo_to = \
                 self.id_person_to_origs_dests[id_person_sumo_inveh].pop(0)
             if self.debug:
-                print '    found person %s' % id_person_sumo_inveh, 'from', id_stop_orig, id_edge_sumo_from, ' to', id_edge_sumo_to, id_stop_dest
+                print('    found person %s' % id_person_sumo_inveh, 'from', id_stop_orig, id_edge_sumo_from, ' to', id_edge_sumo_to, id_stop_dest)
 
             route, duration = self.route_stop_to_stop(id_stop_orig, id_stop_dest)
 
@@ -3576,7 +3576,7 @@ class PrtPlatoonStops(am.ArrayObjman):
             self.numbers_person_wait[id_stop] -= len(ids_person_sumo_inveh)
 
         else:
-            print 'WARNING: on stop %d edge %s, berth %d no person found inside vehicle prt.%d' % (id_stop, self.ids_stop_to_ids_edge_sumo[id_stop], id_berth, id_veh)
+            print('WARNING: on stop %d edge %s, berth %d no person found inside vehicle prt.%d' % (id_stop, self.ids_stop_to_ids_edge_sumo[id_stop], id_berth, id_veh))
             return None
 
     def get_surplus_veh(self, id_stop):
@@ -3594,7 +3594,7 @@ class PrtPlatoonStops(am.ArrayObjman):
 
     def get_vehs_waiting(self, id_stop):
         """Returns lists of empty and occupied waiting vehicles, as well as their respective berth IDs."""
-        print 'get_vehs_waiting id_stop', id_stop
+        print('get_vehs_waiting id_stop', id_stop)
         ids_berth_waiting = self.get_berths_with_state(id_stop, BERTHSTATES['waiting'])
 
         ids_veh_waiting = self.get_berths().ids_veh[ids_berth_waiting]
@@ -3605,7 +3605,7 @@ class PrtPlatoonStops(am.ArrayObjman):
         for id_berth, id_veh, id_veh_sumo in zip(ids_berth_waiting, ids_veh_waiting, self.parent.prtvehicles.ids_sumo[ids_veh_waiting]):
             # check here if these vehicles are still waiting or if
             # there has bee a person sitting in
-            print '    check id_veh_sumo', id_veh_sumo, 'n_pers', traci.vehicle.getPersonNumber(id_veh_sumo)
+            print('    check id_veh_sumo', id_veh_sumo, 'n_pers', traci.vehicle.getPersonNumber(id_veh_sumo))
             if traci.vehicle.getPersonNumber(id_veh_sumo) == 0:
                 ids_veh_waiting_empty.append(id_veh)
                 ids_berth_empty.append(id_berth)
@@ -3613,7 +3613,7 @@ class PrtPlatoonStops(am.ArrayObjman):
                 ids_veh_waiting_occup.append(id_veh)
                 ids_berth_occup.append(id_berth)
 
-        print '  ids_veh_waiting_empty', ids_veh_waiting_empty
+        print('  ids_veh_waiting_empty', ids_veh_waiting_empty)
         return ids_veh_waiting_empty, ids_veh_waiting_occup, ids_berth_empty, ids_berth_occup
 
     def route_empties(self, id_stop, id_stop_target, n_move, simtime):
@@ -3622,19 +3622,19 @@ class PrtPlatoonStops(am.ArrayObjman):
         Route also newly occupied vehicles if present.
         Called by vehman
         """
-        print 'route_empties id_stop', id_stop, '>id_stop_target', id_stop_target, 'n_move', n_move
+        print('route_empties id_stop', id_stop, '>id_stop_target', id_stop_target, 'n_move', n_move)
         berths = self.get_berths()
         vehicles = self.parent.prtvehicles
         ids_veh_empty, ids_veh_waiting_occup, ids_berth, ids_berth_occup = self.get_vehs_waiting(id_stop)
         n_veh_empty = len(ids_veh_empty)
         n_move_eff = min(n_move, n_veh_empty)
-        print '  =>n_veh_empty', n_veh_empty, 'n_move_eff', n_move_eff
+        print('  =>n_veh_empty', n_veh_empty, 'n_move_eff', n_move_eff)
 
         # if n_move <= n_veh_empty:
 
         for id_berth, id_veh in zip(ids_berth[:n_move], ids_veh_empty[:n_move]):
             if self.debug:
-                print '    route empty veh prt.%d' % id_veh, 'at berth', id_berth, 'from stop', id_stop, ' to', id_stop_target
+                print('    route empty veh prt.%d' % id_veh, 'at berth', id_berth, 'from stop', id_stop, ' to', id_stop_target)
 
             route, duration = self.route_stop_to_stop(id_stop, id_stop_target)
 
@@ -3656,7 +3656,7 @@ class PrtPlatoonStops(am.ArrayObjman):
         if 0:  # not necessary, process step will take care of it
             for id_berth, id_veh in zip(ids_berth_occup, ids_veh_waiting_occup):
                 if self.debug:
-                    print '    route occupied veh prt.%d' % id_veh, 'at berth', id_berth, 'from stop', id_stop, ' to', id_stop_target
+                    print('    route occupied veh prt.%d' % id_veh, 'at berth', id_berth, 'from stop', id_stop, ' to', id_stop_target)
 
                 route, duration = self.route_stop_to_stop(id_stop, id_stop_target)
 
@@ -3700,7 +3700,7 @@ class PrtPlatoonStops(am.ArrayObjman):
         ids_veh_out = self.ids_vehs_out[id_stop]
         capa_out = self.capas_outqueue[id_stop]
         n_veh = len(ids_veh_berth_exit)
-        print 'foreward_vehicles_exit check', n_veh
+        print('foreward_vehicles_exit check', n_veh)
 
         if n_veh == 0:
             return False
@@ -3729,14 +3729,14 @@ class PrtPlatoonStops(am.ArrayObjman):
 
             are_stopped[i] = is_stopped | (state == VEHICLESTATES['forewarding_passthrough'])
             if self.debug:
-                print '    %s' % id_veh_sumo, 'are_stopped', are_stopped[i], 'stop', traci.vehicle.isStopped(id_veh_sumo), 'state', state, 'laneindex', traci.vehicle.getLaneIndex(id_veh_sumo)
+                print('    %s' % id_veh_sumo, 'are_stopped', are_stopped[i], 'stop', traci.vehicle.isStopped(id_veh_sumo), 'state', state, 'laneindex', traci.vehicle.getLaneIndex(id_veh_sumo))
 
         if self.debug:
-            print '  are_stopped', are_stopped
+            print('  are_stopped', are_stopped)
 
         if np.all(are_stopped):
             if self.debug:
-                print '    all vehicles are moved out of the berth'
+                print('    all vehicles are moved out of the berth')
 
             # foreward to exit
             #ids_veh_out = self.ids_vehs_out[id_stop]
@@ -3751,7 +3751,7 @@ class PrtPlatoonStops(am.ArrayObjman):
 
             if self.debug:
                 if (len(ids_veh_out) < capa_out):
-                    print '  Out buffer capacity exceeded, left veh:', ids_veh_berth_exit
+                    print('  Out buffer capacity exceeded, left veh:', ids_veh_berth_exit)
 
             #self.ids_vehs_berth_exit[id_stop] = []
 
@@ -3772,7 +3772,7 @@ class PrtPlatoonStops(am.ArrayObjman):
                                           laneindex=2,
                                           )
         if self.debug:
-            print '    append prt.%d to output queue' % id_veh
+            print('    append prt.%d to output queue' % id_veh)
         ids_veh_out.append((id_veh, stoppos))
 
     def get_vehicles_ready_for_departure(self, id_stop):
@@ -3785,21 +3785,21 @@ class PrtPlatoonStops(am.ArrayObjman):
         n_veh = len(ids_veh_out)
         ids_veh_ready = self.ids_vehs_ready_for_departure[id_stop]
         is_veh_ready = len(ids_veh_ready) > 0
-        print 'get_vehicles_ready_for_departure check id_stop', id_stop, ' len(ids_vehs_out)', n_veh, 'capa', self.capas_outqueue[id_stop]
+        print('get_vehicles_ready_for_departure check id_stop', id_stop, ' len(ids_vehs_out)', n_veh, 'capa', self.capas_outqueue[id_stop])
         if is_veh_ready:
             if self.debug:
-                print '  there are still vehicles ready to be launched'
-                print '     ids_veh_ready', ids_veh_ready
+                print('  there are still vehicles ready to be launched')
+                print('     ids_veh_ready', ids_veh_ready)
             return []
 
         berths = self.get_berths()
         vehicles = self.parent.prtvehicles
         if self.debug:
-            print '  ids_berths_veh_wait_exit', type(self.ids_berths_veh_wait_exit[id_stop]), self.ids_berths_veh_wait_exit[id_stop], 'ids_veh_berth_wait', berths.ids_veh[self.ids_berths_veh_wait_exit[id_stop]]
+            print('  ids_berths_veh_wait_exit', type(self.ids_berths_veh_wait_exit[id_stop]), self.ids_berths_veh_wait_exit[id_stop], 'ids_veh_berth_wait', berths.ids_veh[self.ids_berths_veh_wait_exit[id_stop]])
 
         if (n_veh == 0):
             if self.debug:
-                print '  no vehicles in output queue'
+                print('  no vehicles in output queue')
             return []
 
         # search after ready vehicles, that will be launched shortly
@@ -3814,11 +3814,11 @@ class PrtPlatoonStops(am.ArrayObjman):
                 id_stopedge_target = vehicles.routes[id_veh][-1]
                 if self.debug:
                     # ,'is_stopped',is_stopped
-                    print '   %d Leader prt.%d' % (i, id_veh), 'id_stopedge_target', id_stopedge_target
+                    print('   %d Leader prt.%d' % (i, id_veh), 'id_stopedge_target', id_stopedge_target)
 
             else:
                 if self.debug:
-                    print '   %d Follower prt.%d' % (i, id_veh), 'is_cont next', vehicles.routes[id_veh][-1] == id_stopedge_target
+                    print('   %d Follower prt.%d' % (i, id_veh), 'is_cont next', vehicles.routes[id_veh][-1] == id_stopedge_target)
 
             if vehicles.routes[id_veh][-1] == id_stopedge_target:
                 ids_veh_platoon.append((id_veh, stoppos))
@@ -3830,19 +3830,19 @@ class PrtPlatoonStops(am.ArrayObjman):
             if ((len(self.ids_berths_veh_wait_exit[id_stop]) > 0) | (len(self.ids_vehs_pass_wait_exit[id_stop]) > 0))\
                     & (i < self.capas_outqueue[id_stop]-1):
                 if self.debug:
-                    print '  Maybe incomplete platoon, wait till all vehicles are kicked out of berths'
-                    print '  len(ids_berths_veh_wait_exit)', len(self.ids_berths_veh_wait_exit[id_stop]), 'len(ids_vehs_pass_wait_exit)', len(self.ids_vehs_pass_wait_exit[id_stop]), "i", i
+                    print('  Maybe incomplete platoon, wait till all vehicles are kicked out of berths')
+                    print('  len(ids_berths_veh_wait_exit)', len(self.ids_berths_veh_wait_exit[id_stop]), 'len(ids_vehs_pass_wait_exit)', len(self.ids_vehs_pass_wait_exit[id_stop]), "i", i)
                 return []
             else:
                 # the entire out queue has the same destination
                 # and will leave the stop
                 if self.debug:
-                    print '  entire out queue same dest and ready for departure'
+                    print('  entire out queue same dest and ready for departure')
                 #is_update_outqueue = False
         else:
             # only a part of te out-queue departs, update position of rest
             if self.debug:
-                print '  partial out queue ready for departure'
+                print('  partial out queue ready for departure')
             #is_update_outqueue = True
 
         # Check if all vehicles in the platoon are stopped at the
@@ -3852,13 +3852,13 @@ class PrtPlatoonStops(am.ArrayObjman):
         are_finalpos = True
         ids_veh_ready_new = []
         if self.debug:
-            print '  position check/update ids_veh_platoon', ids_veh_platoon
+            print('  position check/update ids_veh_platoon', ids_veh_platoon)
         for id_veh, stoppos in ids_veh_platoon:
 
             id_veh_sumo = vehicles.get_id_sumo(id_veh)
             is_stopped = traci.vehicle.isStopped(id_veh_sumo)
             if self.debug:
-                print '    stopcheck ', id_veh_sumo, 'are_stopped', are_stopped, 'is_stopped', is_stopped
+                print('    stopcheck ', id_veh_sumo, 'are_stopped', are_stopped, 'is_stopped', is_stopped)
 
             if is_stopped:
                 # check if stopposition is correct
@@ -3871,7 +3871,7 @@ class PrtPlatoonStops(am.ArrayObjman):
                         # vehicle is stopped but not at correct position
                         are_stopped = False
                         if self.debug:
-                            print '      update stoppos of prt.%s:' % id_veh_sumo, 'from curpos', pos_veh, 'stoppos', stoppos
+                            print('      update stoppos of prt.%s:' % id_veh_sumo, 'from curpos', pos_veh, 'stoppos', stoppos)
                         # vehicle has stopped but not at the correct stop position
                         # =>foreward vehicle to the correct position
                         vehicles.control_forewarding_exit(id_veh,
@@ -3886,26 +3886,26 @@ class PrtPlatoonStops(am.ArrayObjman):
             # print '    Veh',id_veh_sumo,'is_stopped',is_stopped
             # if not is_veh_ready:# means that there are not already vehicles ready
             if self.debug:
-                print '      append prt.%d to ids_veh_ready_new' % (id_veh)
+                print('      append prt.%d to ids_veh_ready_new' % (id_veh))
             ids_veh_ready_new.append(id_veh)
 
         if self.debug:
-            print '  ready? are_stopped %s,' % (are_stopped), 'ids_veh_ready_new', ids_veh_ready_new
+            print('  ready? are_stopped %s,' % (are_stopped), 'ids_veh_ready_new', ids_veh_ready_new)
 
         # value if platoon is ready to leave
         if (not is_veh_ready) & are_stopped:
             if self.debug:
-                print '  all vehicles of the platoon are stopped, platoon ready.'
+                print('  all vehicles of the platoon are stopped, platoon ready.')
             return ids_veh_ready_new
 
         else:
             if not are_finalpos:
                 self.are_reposition_out[id_stop] = True
                 if self.debug:
-                    print '  vehicles of platoon not stopped at coorect position or previous ready vehicles not launched.'
+                    print('  vehicles of platoon not stopped at coorect position or previous ready vehicles not launched.')
             else:
                 if self.debug:
-                    print '  not all vehicles of platoon stopped or previous ready vehicles not launched.'
+                    print('  not all vehicles of platoon stopped or previous ready vehicles not launched.')
             return []
 
     def _reposition_outqueue(self, id_stop):
@@ -3949,7 +3949,7 @@ class PrtPlatoonStops(am.ArrayObjman):
         """
         #ids_veh_out = self.ids_vehs_out[id_stop]
         n_veh = len(ids_veh)
-        print 'prepare_vehs_for_departure id_stop', id_stop, 'n_veh', n_veh
+        print('prepare_vehs_for_departure id_stop', id_stop, 'n_veh', n_veh)
         ids_veh_out = self.ids_vehs_out[id_stop]
         if n_veh == 0:
             return False
@@ -3962,10 +3962,10 @@ class PrtPlatoonStops(am.ArrayObjman):
                 vehicles.concatenate(id_veh, id_veh_infront)
 
         if self.debug:
-            print '  prepared:'
+            print('  prepared:')
             for id_veh, route in zip(ids_veh, vehicles.routes[ids_veh]):
                 id_stopedge = route[-1]
-                print '     prep. prt.%d' % id_veh, 'with id_stopedge', id_stopedge, 'id_stop', self.id_edge_to_id_stop[id_stopedge]
+                print('     prep. prt.%d' % id_veh, 'with id_stopedge', id_stopedge, 'id_stop', self.id_edge_to_id_stop[id_stopedge])
 
         id_veh_lead = ids_veh[0]
         id_stopedge_target = vehicles.routes[id_veh_lead][-1]
@@ -3980,7 +3980,7 @@ class PrtPlatoonStops(am.ArrayObjman):
 
         if len(ids_veh_out) > 0:
             if self.debug:
-                print '  position update for remaining ids_veh_out', ids_veh_out
+                print('  position update for remaining ids_veh_out', ids_veh_out)
             # move foreward stoplines of remaining vehicles in output queue
             stopline = self.stoplines[id_stop]
             id_edge_sumo = self.ids_stop_to_ids_edge_sumo[id_stop]
@@ -3995,7 +3995,7 @@ class PrtPlatoonStops(am.ArrayObjman):
 
                 if self.debug:
                     id_veh_sumo = 'prt.%s' % id_veh
-                    print '    update stoppos of prt.%s:' % id_veh_sumo, 'from curpos', traci.vehicle.getLanePosition(id_veh_sumo), 'to stoppos', stoppos
+                    print('    update stoppos of prt.%s:' % id_veh_sumo, 'from curpos', traci.vehicle.getLanePosition(id_veh_sumo), 'to stoppos', stoppos)
                 # print '      stopinfo:',traci.vehicle.getNextStops(id_veh_sumo)
                 ids_veh_out[ind] = (id_veh, stoppos)
 
@@ -4006,16 +4006,16 @@ class PrtPlatoonStops(am.ArrayObjman):
         """
         Method called from vehicle management when vehicles are allowed to depart.
         """
-        print 'launch_vehs at id_stop', id_stop
+        print('launch_vehs at id_stop', id_stop)
         ids_veh = self.ids_vehs_ready_for_departure[id_stop]
         #ids_veh_out = self.ids_vehs_out[id_stop]
         vehicles = self.parent.prtvehicles
         #ids_veh = self.ids_vehs_ready_for_departure[id_stop]
         # if self.debug:
-        print '  to launch: ids_veh', ids_veh  # ,'with ids_stopedge_next',vehicles.routes[ids_veh]
+        print('  to launch: ids_veh', ids_veh)  # ,'with ids_stopedge_next',vehicles.routes[ids_veh]
 
         if len(ids_veh) == 0:
-            print 'WARNING in launch_vehs: there are no vehicles to lauche at id_stop', id_stop
+            print('WARNING in launch_vehs: there are no vehicles to lauche at id_stop', id_stop)
 
         # here may check if destination stop  is correct
 
@@ -4024,7 +4024,7 @@ class PrtPlatoonStops(am.ArrayObjman):
 
             #id_veh_out, stoppos = ids_veh_out.pop(0)
             # if self.debug:
-            print '  launched prt.%d to id_stopedge_target %d' % (id_veh, vehicles.routes[id_veh][-1])
+            print('  launched prt.%d to id_stopedge_target %d' % (id_veh, vehicles.routes[id_veh][-1]))
             # if id_veh_out != id_veh:
             #    print 'WARNING: wrong vehicle from output queue'
             #    sys.exit(0)
@@ -4046,7 +4046,7 @@ class PrtPlatoonStops(am.ArrayObjman):
         the last berth of the stop"""
 
         pos_lastberth = self.get_berths().stoppositions[self.ids_berths[id_stop]][-1]
-        print 'is_outputqueue_compact n_outqueue', len(self.ids_vehs_out[id_stop]), 'pos_lastberth %.2f' % pos_lastberth
+        print('is_outputqueue_compact n_outqueue', len(self.ids_vehs_out[id_stop]), 'pos_lastberth %.2f' % pos_lastberth)
 
         vehicles = self.parent.prtvehicles
         is_compact = True
@@ -4070,7 +4070,7 @@ class PrtPlatoonStops(am.ArrayObjman):
                     break
 
         if self.debug:
-            print '   is_compact', is_compact
+            print('   is_compact', is_compact)
         return is_compact
 
     def try_start_vehicles(self, id_stop, simtime, n_plat_min=-1):
@@ -4079,42 +4079,42 @@ class PrtPlatoonStops(am.ArrayObjman):
         while maximizing platooning. 
         """
 
-        print 'try_start_vehicles id_stop', id_stop, 'veh exiting', len(self.ids_vehs_berth_exit[id_stop]),\
+        print('try_start_vehicles id_stop', id_stop, 'veh exiting', len(self.ids_vehs_berth_exit[id_stop]),
             'wait from berth', len(self.ids_berths_veh_wait_exit[id_stop]), 'wait to pass', len(
-                self.ids_vehs_pass_wait_exit[id_stop])
+                self.ids_vehs_pass_wait_exit[id_stop]))
 
         n_plat_max = self.capas_inqueue[id_stop] - \
             (len(self.ids_vehs_out[id_stop])+len(self.ids_vehs_ready_for_departure[id_stop]))
         if self.debug:
-            print '  n_plat_max', n_plat_max
+            print('  n_plat_max', n_plat_max)
         if n_plat_max == 0:
             if self.debug:
-                print '  insufficient sapce in output queue'
+                print('  insufficient sapce in output queue')
             return False
 
         if len(self.ids_vehs_berth_exit[id_stop]) > 0:
             if self.debug:
-                print '  there are still vehicles moving out of berth'
+                print('  there are still vehicles moving out of berth')
             return False
 
         elif not self.is_outputqueue_compact(id_stop):
             if self.debug:
-                print '  there are still vehicles in berth area toward exit queue'
+                print('  there are still vehicles in berth area toward exit queue')
             return False
 
         if self.debug:
-            print '  len(ids_veh_inqueue)', len(self.ids_vehs_inqueue[id_stop])
+            print('  len(ids_veh_inqueue)', len(self.ids_vehs_inqueue[id_stop]))
         if len(self.ids_vehs_inqueue[id_stop]) > 0:
             ids_veh_pass = self.get_ids_veh_to_pass(id_stop)
             if self.debug:
-                print '    found ids_veh_pass', ids_veh_pass, 'not yet started!'
+                print('    found ids_veh_pass', ids_veh_pass, 'not yet started!')
         else:
             ids_veh_pass = []
 
         n_veh_pass = len(ids_veh_pass)
         n_veh_pass_wait = len(self.ids_vehs_pass_wait_exit[id_stop])
         if self.debug:
-            print '  n_veh_pass', n_veh_pass, 'n_veh_pass_wait', n_veh_pass_wait
+            print('  n_veh_pass', n_veh_pass, 'n_veh_pass_wait', n_veh_pass_wait)
 
         berths = self.get_berths()
         vehicles = self.parent.prtvehicles
@@ -4126,8 +4126,8 @@ class PrtPlatoonStops(am.ArrayObjman):
 
         if n_veh_pass_wait > 0:
             if self.debug:
-                print '  there are passthrough vehicle in the input queue waiting to get started', self.ids_vehs_pass_wait_exit[id_stop]
-                print '    ids_veh_pass_wait_exit', self.ids_vehs_pass_wait_exit[id_stop]
+                print('  there are passthrough vehicle in the input queue waiting to get started', self.ids_vehs_pass_wait_exit[id_stop])
+                print('    ids_veh_pass_wait_exit', self.ids_vehs_pass_wait_exit[id_stop])
             # these vehicles have a common target
             ids_veh_pass_wait_exit = self.ids_vehs_pass_wait_exit[id_stop]
             while len(ids_veh_pass_wait_exit) > 0:
@@ -4142,7 +4142,7 @@ class PrtPlatoonStops(am.ArrayObjman):
         elif len(self.ids_berths_veh_wait_exit[id_stop]) > 0:
             ids_berth_veh_wait_exit = self.ids_berths_veh_wait_exit[id_stop]
             if self.debug:
-                print '  there are vehicles in berth which are listed to start.', ids_berth_veh_wait_exit
+                print('  there are vehicles in berth which are listed to start.', ids_berth_veh_wait_exit)
             # do start them, sorted by final destination
 
             # print '    ids_berth_veh_wait_exit',ids_berth_veh_wait_exit
@@ -4154,7 +4154,7 @@ class PrtPlatoonStops(am.ArrayObjman):
             ids_stop_target = vehicles.ids_stop_target[ids_veh]
             inds_start = ids_stop_target == ids_stop_target[0]
             if self.debug:
-                print '    start waiting vehicles', ids_veh[inds_start], 'to final id_stop_target', ids_stop_target[0]
+                print('    start waiting vehicles', ids_veh[inds_start], 'to final id_stop_target', ids_stop_target[0])
             self._kick_out_of_berth(id_stop, ids_veh[inds_start], np.array(
                 ids_berth_veh_wait_exit, dtype=np.int32)[inds_start], vehicles, berths)
             for id_berth in np.array(ids_berth_veh_wait_exit, dtype=np.int32)[inds_start]:
@@ -4164,7 +4164,7 @@ class PrtPlatoonStops(am.ArrayObjman):
         if ((simtime - self.times_phase_out[id_stop]) > self.time_fase_out_max.get_value()) & (n_veh_pass == 0):
             # stop starting if move in phase is timed out
             if self.debug:
-                print '  fase move out timeout, stop starting'
+                print('  fase move out timeout, stop starting')
             return False
 
         # berth in reverse order means that the berth closest to the exit comes first
@@ -4198,18 +4198,18 @@ class PrtPlatoonStops(am.ArrayObjman):
             overtime = simtime - berths.times_routes[ids_berth_ready]-self.time_wait_berth_max.get_value()
             overtime_berth_ready = overtime * (overtime > 0)
             if self.debug:
-                print '  vehicles ready to leave berth n_veh %d including input n_veh_all %d' % (n_veh, n_veh_all)
-                print '  ids_stop_target from berths', ids_stop_target
-                print '  ids_berth', berths.states[ids_berth]
-                print '  berths.state', berths.states[ids_berth]
-                print '  ids_berth_ready', ids_berth_ready
-                print '  ids_veh_ready', ids_veh_ready
-                print '  ids_veh_ready_all', ids_veh_ready_all
+                print('  vehicles ready to leave berth n_veh %d including input n_veh_all %d' % (n_veh, n_veh_all))
+                print('  ids_stop_target from berths', ids_stop_target)
+                print('  ids_berth', berths.states[ids_berth])
+                print('  berths.state', berths.states[ids_berth])
+                print('  ids_berth_ready', ids_berth_ready)
+                print('  ids_veh_ready', ids_veh_ready)
+                print('  ids_veh_ready_all', ids_veh_ready_all)
                 print
-                print '  simtime', simtime
-                print '  overtime_berth_ready', overtime_berth_ready
-                print '  berths.times_routes[ids_berth_ready]', berths.times_routes[ids_berth_ready]
-                print '  time_wait_berth_max', self.time_wait_berth_max.get_value()
+                print('  simtime', simtime)
+                print('  overtime_berth_ready', overtime_berth_ready)
+                print('  berths.times_routes[ids_berth_ready]', berths.times_routes[ids_berth_ready])
+                print('  time_wait_berth_max', self.time_wait_berth_max.get_value())
 
             # if 0: # deal with this case in platoon optimizarion
             #    print '  there are vehhicles in the input queue'
@@ -4218,7 +4218,7 @@ class PrtPlatoonStops(am.ArrayObjman):
 
             if n_veh_pass > 0:
                 if self.debug:
-                    print '  There is at least one passthrough vehicle which needs to get launched'
+                    print('  There is at least one passthrough vehicle which needs to get launched')
                 #id_edge_target_max = vehicles.get_targetedge_current(ids_veh_pass[0])
                 id_stop_target_max = vehicles.ids_stop_target[ids_veh_pass[0]]
 
@@ -4235,7 +4235,7 @@ class PrtPlatoonStops(am.ArrayObjman):
                         ids_berth_plat = np.array([])
 
                 if self.debug:
-                    print '    vehs with same dest as pass', ids_veh_plat
+                    print('    vehs with same dest as pass', ids_veh_plat)
 
                 self._kick_out_of_berth(id_stop, ids_veh_plat, ids_berth_plat, vehicles, berths)
 
@@ -4249,7 +4249,7 @@ class PrtPlatoonStops(am.ArrayObjman):
 
             elif (np.any(overtime_berth_ready) > 0) & (n_veh_pass == 0):
                 if self.debug:
-                    print '  at some berth maximum wait time has been exceeded'
+                    print('  at some berth maximum wait time has been exceeded')
 
                 # TODO: launche all vehicles with overtime putting them into  self.ids_berths_veh_wait_exit[id_stop]
                 # take vehicle with maximum wait  time and try to create a platoon
@@ -4291,7 +4291,7 @@ class PrtPlatoonStops(am.ArrayObjman):
 
             else:  # if n_veh > n_plat_min:
 
-                print '  Maximize platoon length'
+                print('  Maximize platoon length')
 
                 edgeutilities = self.get_scenario().net.edges.lengths
                 # utilities = np.sum(edgeutilities[routes_common],1)*counts_common
@@ -4306,7 +4306,7 @@ class PrtPlatoonStops(am.ArrayObjman):
                     ids_edges[i, :len(route)] = route
 
                 if self.debug > 9:
-                    print '  ids_edges=\n', ids_edges
+                    print('  ids_edges=\n', ids_edges)
                 n_veh_all, n_edge_max = ids_edges.shape
 
                 is_cont = True  # not used
@@ -4322,10 +4322,10 @@ class PrtPlatoonStops(am.ArrayObjman):
 
                     inds_stop = np.flatnonzero(ids_edges[:, j] == -1)
                     if self.debug:
-                        print '   j=', j, 'inds_stop', inds_stop
+                        print('   j=', j, 'inds_stop', inds_stop)
                     if len(inds_stop) > 0:
                         if self.debug:
-                            print '    create set of routes that lead to one of the stops'
+                            print('    create set of routes that lead to one of the stops')
                         occurencies = OrderedDict()
 
                         for ids_edge, ind_stop in zip(ids_edges[inds_stop, 0:j-2], inds_stop):
@@ -4369,8 +4369,8 @@ class PrtPlatoonStops(am.ArrayObjman):
 
                 # print '-'*10
                 if self.debug:
-                    print '  utility_max', utility_max
-                    print '  route_common_max', route_common_max, type(route_common_max)
+                    print('  utility_max', utility_max)
+                    print('  route_common_max', route_common_max, type(route_common_max))
 
                 j_max = len(route_common_max)+2
 
@@ -4384,7 +4384,7 @@ class PrtPlatoonStops(am.ArrayObjman):
                         break
 
                 if self.debug:
-                    print '  route_max', route_max
+                    print('  route_max', route_max)
 
                 inds_veh_plat_deviate = []
                 inds_veh_plat_nodeviate = []
@@ -4416,27 +4416,27 @@ class PrtPlatoonStops(am.ArrayObjman):
                 iinds_plat_passthrough = inds_veh_plat >= n_veh
                 # print '  ids_edges_out\n',ids_edges_out
                 if self.debug:
-                    print '  inds_veh_plat\n', inds_veh_plat
-                    print '  inds_veh_plat_deviate\n', inds_veh_plat_deviate
-                    print '  inds_veh_plat_nodeviate\n', inds_veh_plat_nodeviate
-                    print '  inds_veh_plat_deviate_berth\n', inds_veh_plat_deviate[iinds_plat_deviate_berth]
-                    print '  inds_veh_plat_nodeviate_berth\n', inds_veh_plat_nodeviate[iinds_plat_nodeviate_berth]
-                    print '  iinds_plat_passthrough\n', iinds_plat_passthrough
-                    print '  inds_veh_plat_passthrough\n', inds_veh_plat[iinds_plat_passthrough]
+                    print('  inds_veh_plat\n', inds_veh_plat)
+                    print('  inds_veh_plat_deviate\n', inds_veh_plat_deviate)
+                    print('  inds_veh_plat_nodeviate\n', inds_veh_plat_nodeviate)
+                    print('  inds_veh_plat_deviate_berth\n', inds_veh_plat_deviate[iinds_plat_deviate_berth])
+                    print('  inds_veh_plat_nodeviate_berth\n', inds_veh_plat_nodeviate[iinds_plat_nodeviate_berth])
+                    print('  iinds_plat_passthrough\n', iinds_plat_passthrough)
+                    print('  inds_veh_plat_passthrough\n', inds_veh_plat[iinds_plat_passthrough])
 
                 n_veh_plat = len(inds_veh_plat)
                 # print '  id_edge_target_max',id_edge_target_max,'n_veh_plat',n_veh_plat,n_veh_plat >= n_plat_min
 
                 if (n_veh_plat >= n_plat_min) | (np.max(inds_veh_plat) >= n_veh):
                     if self.debug:
-                        print '  platoon formation long enough n_veh_plat', n_veh_plat, 'or passthrough', (np.max(inds_veh_plat) >= n_veh)
+                        print('  platoon formation long enough n_veh_plat', n_veh_plat, 'or passthrough', (np.max(inds_veh_plat) >= n_veh))
 
-                        print '    deviate vehicles berth', ids_veh_ready_all[inds_veh_plat_deviate[iinds_plat_deviate_berth]]
+                        print('    deviate vehicles berth', ids_veh_ready_all[inds_veh_plat_deviate[iinds_plat_deviate_berth]])
                     for id_veh in ids_veh_ready_all[inds_veh_plat_deviate[iinds_plat_deviate_berth]]:
                         # note that all routed vehicles are already disengaged
                         vehicles.set_route_target(id_veh, route_max, is_disengage_from_berth=False)
                     if self.debug:
-                        print '    deviate vehicles passthrough', ids_veh_ready_all[inds_veh_plat_deviate[np.logical_not(iinds_plat_deviate_berth)]]
+                        print('    deviate vehicles passthrough', ids_veh_ready_all[inds_veh_plat_deviate[np.logical_not(iinds_plat_deviate_berth)]])
                     for id_veh in ids_veh_ready_all[inds_veh_plat_deviate[np.logical_not(iinds_plat_deviate_berth)]]:
                         vehicles.set_route_target(id_veh, route_max)
                     # ?here next stop is identical with final route
@@ -4446,8 +4446,8 @@ class PrtPlatoonStops(am.ArrayObjman):
 
                     # start immediately vehicles with final destination from berths
                     if self.debug:
-                        print '    kick out ids_veh', ids_veh_ready[inds_veh_plat_nodeviate[iinds_plat_nodeviate_berth]]
-                        print '    from berths     ', ids_berth_ready[inds_veh_plat_nodeviate[iinds_plat_nodeviate_berth]]
+                        print('    kick out ids_veh', ids_veh_ready[inds_veh_plat_nodeviate[iinds_plat_nodeviate_berth]])
+                        print('    from berths     ', ids_berth_ready[inds_veh_plat_nodeviate[iinds_plat_nodeviate_berth]])
                     self._kick_out_of_berth(id_stop, ids_veh_ready[inds_veh_plat_nodeviate[iinds_plat_nodeviate_berth]],
                                             ids_berth_ready[inds_veh_plat_nodeviate[iinds_plat_nodeviate_berth]], vehicles, berths)
 
@@ -4455,17 +4455,17 @@ class PrtPlatoonStops(am.ArrayObjman):
                     # they will be started later while being sorted by final
                     # destination
                     if self.debug:
-                        print '    ids_berths_veh_wait_exit before', self.ids_berths_veh_wait_exit[id_stop]
+                        print('    ids_berths_veh_wait_exit before', self.ids_berths_veh_wait_exit[id_stop])
                     self.ids_berths_veh_wait_exit[id_stop] += ids_berth_ready[inds_veh_plat_deviate[iinds_plat_deviate_berth]].tolist()
                     if self.debug:
-                        print '    ids_berths_veh_wait_exit after ', self.ids_berths_veh_wait_exit[id_stop]
-                        print '    ids_berth_ready', ids_berth_ready
+                        print('    ids_berths_veh_wait_exit after ', self.ids_berths_veh_wait_exit[id_stop])
+                        print('    ids_berth_ready', ids_berth_ready)
                     # ATTENTION: vehicles waiting in input queue cannot be sorted by destination...
                     # but they are supposed to be sorted already?
 
                     self.ids_vehs_pass_wait_exit[id_stop] += ids_veh_ready_all[inds_veh_plat[iinds_plat_passthrough]].tolist()
                     if self.debug:
-                        print '    ids_vehs_pass_wait_exit after ', self.ids_vehs_pass_wait_exit[id_stop]
+                        print('    ids_vehs_pass_wait_exit after ', self.ids_vehs_pass_wait_exit[id_stop])
 
                     # get the destination stop from final stop of the undevieted winner
                     id_stop_target_max = vehicles.ids_stop_target[ids_veh_ready_all[inds_veh_plat_nodeviate[0]]]
@@ -4475,12 +4475,12 @@ class PrtPlatoonStops(am.ArrayObjman):
 
                 else:
                     if self.debug:
-                        print '  platoon too short'
+                        print('  platoon too short')
                     return False
 
         else:
             if self.debug:
-                print '  no vehicles finished boarding'
+                print('  no vehicles finished boarding')
             return False
 
     def _is_stop(self, j, ids_edge):
@@ -4493,7 +4493,7 @@ class PrtPlatoonStops(am.ArrayObjman):
 
     def _kick_out_of_berth(self, id_stop, ids_veh_plat, ids_berth_plat, vehicles, berths):
         for id_veh, id_berth in zip(ids_veh_plat, ids_berth_plat):
-            print '    kick veh %d out of berth %d and set berth free' % (id_veh, id_berth)
+            print('    kick veh %d out of berth %d and set berth free' % (id_veh, id_berth))
             berths.set_free(id_berth)
             vehicles.control_berth_position_exit(id_veh,
                                                  id_edge_sumo=self.ids_stop_to_ids_edge_sumo[id_stop],\
@@ -4518,7 +4518,7 @@ class PrtPlatoonStops(am.ArrayObjman):
         return ids_berth[self.get_berths().states[ids_berth] == state]
 
     def enter(self, id_stop, ids_veh, fase, simtime):
-        print 'enter  ids_veh', ids_veh
+        print('enter  ids_veh', ids_veh)
 
         vehicles = self.parent.prtvehicles
 
@@ -4542,7 +4542,7 @@ class PrtPlatoonStops(am.ArrayObjman):
             # or wether it is a pass through
             route = vehicles.routes[id_veh]
             if self.debug:
-                print '  enter prt.%d' % id_veh, 'with id_stop_target', vehicles.ids_stop_target[id_veh], 'route', route
+                print('  enter prt.%d' % id_veh, 'with id_stop_target', vehicles.ids_stop_target[id_veh], 'route', route)
             if len(route) == 0:
                 # vehicle just initialized
                 are_completed[i] = True
@@ -4574,14 +4574,14 @@ class PrtPlatoonStops(am.ArrayObjman):
         n_veh_completed = len(ids_veh_completed)
         ids_berth = -1*np.ones(n_veh, dtype=np.int32)
         if self.debug:
-            print '  n_veh_completed', n_veh_completed, 'no Timeout', ((simtime - self.times_phase_in[id_stop]) < self.time_fase_in_max.get_value()), 'veh input', self.ids_vehs_inqueue[id_stop]
+            print('  n_veh_completed', n_veh_completed, 'no Timeout', ((simtime - self.times_phase_in[id_stop]) < self.time_fase_in_max.get_value()), 'veh input', self.ids_vehs_inqueue[id_stop])
         # if fase == FASE_MOVE_IN:
         #    print '  timeout fase 0: dt=%.2f timeout=%.2f'%((simtime - self.times_phase_in[id_stop]), self.time_fase_in_max.get_value())
         if n_veh_completed > 0:
             # (simtime - self.times_phase_in[id_stop]), self.time_fase_in_max.get_value())
             if self.debug:
                 # ,(len(self.ids_vehs_inqueue[id_stop]) == 0),((simtime - self.times_phase_in[id_stop]) > self.time_fase_in_max.get_value())
-                print '    fase', fase
+                print('    fase', fase)
             if (fase == FASE_MOVE_IN) & (len(self.ids_vehs_inqueue[id_stop]) == 0)\
                     & ((simtime - self.times_phase_in[id_stop]) < self.time_fase_in_max.get_value()):
                 # here vehicles are sent to berth, if available
@@ -4592,22 +4592,22 @@ class PrtPlatoonStops(am.ArrayObjman):
                 # allocate berth only for vehicles which completed trip at this stop
                 ids_berth_completed = self.allocate_alight(id_stop, n_veh_completed)
                 if self.debug:
-                    print '  ids_berth_completed', ids_berth_completed
+                    print('  ids_berth_completed', ids_berth_completed)
                 ids_berth[are_completed] = ids_berth_completed
 
         is_stop_moving_in = False
         for id_veh, state, id_berth, is_completed in zip(ids_veh, vehicles.states[ids_veh], ids_berth, are_completed):
             if self.debug:
-                print '  check id_veh', id_veh, 'id_berth', id_berth, 'is_completed', is_completed, 'state', state
+                print('  check id_veh', id_veh, 'id_berth', id_berth, 'is_completed', is_completed, 'state', state)
 
             if not is_completed:
                 # will be send directly to output queue
                 if self.debug:
-                    print '  passthrough, not final destination of vehicle.'
+                    print('  passthrough, not final destination of vehicle.')
 
                 is_stop_moving_in = True
                 if self.debug:
-                    print '    stop before first berths, wait for try_start at %.1fm' % (self.stoplines_in[id_stop])
+                    print('    stop before first berths, wait for try_start at %.1fm' % (self.stoplines_in[id_stop]))
 
                 # this vehicle does not get allocated to a berth
                 # but will wait until vehicles with same destination move out
@@ -4639,10 +4639,10 @@ class PrtPlatoonStops(am.ArrayObjman):
 
             elif id_berth == -1:
                 if self.debug:
-                    print '    trip is completed but no berth => stop vehicles from moving in'
+                    print('    trip is completed but no berth => stop vehicles from moving in')
                 is_stop_moving_in = True
                 if self.debug:
-                    print '    stop before first berths and wait for allocation at %.1fm' % (self.stoplines_in[id_stop])
+                    print('    stop before first berths and wait for allocation at %.1fm' % (self.stoplines_in[id_stop]))
                 self.ids_vehs_inqueue[id_stop].append(id_veh)
                 vehicles.control_stopline_enter(id_veh,
                                                 self.ids_stop_to_ids_edge_sumo[id_stop],
@@ -4651,7 +4651,7 @@ class PrtPlatoonStops(am.ArrayObjman):
 
             elif (not is_stop_moving_in) & (id_berth != -1):
                 if self.debug:
-                    print '     forewrard entering vehicle id_veh %d to id_berth_alight %d at pos %.2fm' % (id_veh, id_berth, self.get_berths().stoppositions[id_berth])
+                    print('     forewrard entering vehicle id_veh %d to id_berth_alight %d at pos %.2fm' % (id_veh, id_berth, self.get_berths().stoppositions[id_berth]))
                 self.ids_vehs_alight_forward[id_stop].append(id_veh)
                 vehicles.control_berth_position_enter(
                     id_veh, id_berth,
@@ -4660,7 +4660,7 @@ class PrtPlatoonStops(am.ArrayObjman):
                     laneindex=2,
                 )
         if self.debug:
-            print '    ids_vehs_inqueue (after)', self.ids_vehs_inqueue[id_stop]
+            print('    ids_vehs_inqueue (after)', self.ids_vehs_inqueue[id_stop])
 
     def get_ids_veh_to_allocate(self, id_stop):
         """Returns vehicle in input queue that needs berth allocation.
@@ -4721,7 +4721,7 @@ class PrtPlatoonStops(am.ArrayObjman):
             return []
 
     def exit(self, id_stop, id_veh, fase):
-        print 'exit prt.%d at stop %d fase %d' % (id_veh, id_stop, fase)
+        print('exit prt.%d at stop %d fase %d' % (id_veh, id_stop, fase))
         self.ids_vehs[id_stop].remove(id_veh)
         self.ids_vehs_ready_for_departure[id_stop].remove(id_veh)
         #id_stop_target = self.parent.vehicleman.start_trip(id_veh, id_stop)
@@ -4764,71 +4764,71 @@ class PrtPlatoonStops(am.ArrayObjman):
         # default berth ID is -1 means no merth available
         ids_berth_alloc = -1*np.ones(n_alloc, dtype=np.int32)
 
-        print 'allocate_alight n_alloc', n_alloc, 'n_berth_to_allocate', n_berth_to_allocate, 'ind_berth_to_allocate', ind_berth_to_allocate
+        print('allocate_alight n_alloc', n_alloc, 'n_berth_to_allocate', n_berth_to_allocate, 'ind_berth_to_allocate', ind_berth_to_allocate)
         if self.debug:
-            print '  ids_berth_to_allocate', ids_berth_to_allocate
+            print('  ids_berth_to_allocate', ids_berth_to_allocate)
 
         if ind_berth_to_allocate == -1:
             if self.debug:
-                print '  no free berth :('
+                print('  no free berth :(')
             return ids_berth_alloc
 
         elif n_berth_to_allocate <= n_alloc:
             if self.debug:
-                print '  there is a less or equal number of free berth than requested'
+                print('  there is a less or equal number of free berth than requested')
             # => use all berth available for allocatation
             ids_berth_alloc[0:n_berth_to_allocate] = ids_berth_to_allocate[0:n_berth_to_allocate]
             self.inds_berth_allocated[id_stop] = -1
 
         else:
             if self.debug:
-                print '  there are more berths available than vehicles to allocate'
+                print('  there are more berths available than vehicles to allocate')
             # -> prefer berth with person queues
             queues = self.get_berthqueues(id_stop, ids_berth_to_allocate)
             #inds_nonzeroqueues = np.flatnonzero(ids_berth_to_allocate[::-1])
 
             ind_alloc_eff = -1  # effective allocation index for result vector
             for i, queue, id_berth in zip(xrange(n_berth_to_allocate), queues[::-1], ids_berth_to_allocate[::-1]):
-                print '  index i', i, 'id_berth', id_berth, 'queue', queue
+                print('  index i', i, 'id_berth', id_berth, 'queue', queue)
                 self.inds_berth_allocated[id_stop] -= 1
                 if queue == 0:
                     if self.debug:
-                        print '    no passengers waiting'
+                        print('    no passengers waiting')
 
                     # allocate this berth only if the number of the remaining
                     # available berth is less or equal the number of berth
                     # that remain to be allocated
                     is_allzero = not np.any(queues[::-1][i:])
                     if self.debug:
-                        print '      remaining berth to alloc', ids_berth_to_allocate[::-1][i:]
-                        print '      remaining queus to alloc', queues[::-1][i:]
-                        print '      rem avail', n_berth_to_allocate-(i+1), 'rem to alloc', n_alloc-(ind_alloc_eff + 1), 'is_allzero', is_allzero
+                        print('      remaining berth to alloc', ids_berth_to_allocate[::-1][i:])
+                        print('      remaining queus to alloc', queues[::-1][i:])
+                        print('      rem avail', n_berth_to_allocate-(i+1), 'rem to alloc', n_alloc-(ind_alloc_eff + 1), 'is_allzero', is_allzero)
                     if is_allzero | ((n_berth_to_allocate-(i+1)) < (n_alloc-(ind_alloc_eff + 1))):
                         ind_alloc_eff += 1
                         ids_berth_alloc[ind_alloc_eff] = id_berth
                         if self.debug:
-                            print '      allocate id_berth', id_berth, 'at index', i
+                            print('      allocate id_berth', id_berth, 'at index', i)
                 else:
                     if self.debug:
-                        print '    passengers waiting, allocate'
+                        print('    passengers waiting, allocate')
                     ind_alloc_eff += 1
                     ids_berth_alloc[ind_alloc_eff] = id_berth
 
                     if self.debug:
-                        print '     allocate id_berth', id_berth, 'at index', i
+                        print('     allocate id_berth', id_berth, 'at index', i)
 
                 if n_alloc == ind_alloc_eff + 1:
                     if self.debug:
-                        print '      all vehicles allocated. Stop allocating.'
+                        print('      all vehicles allocated. Stop allocating.')
                     break
 
             if self.debug:
-                print '    finished allocating i', i, 'ind_berth_to_allocate', ind_berth_to_allocate, 'rem', n_berth_to_allocate-(i+1)
+                print('    finished allocating i', i, 'ind_berth_to_allocate', ind_berth_to_allocate, 'rem', n_berth_to_allocate-(i+1))
 
             # print '    inds_berth_allocated',self.inds_berth_allocated [id_stop],n_berth_to_allocate-(i+1)
             #self.inds_berth_allocated [id_stop] = n_berth_to_allocate-(i+1)
         if self.debug:
-            print '  ids_berth_alloc', ids_berth_alloc
+            print('  ids_berth_alloc', ids_berth_alloc)
         # set allocated to found berth only
         self.get_berths().set_allocate(ids_berth_alloc[ids_berth_alloc > -1])
 
@@ -4852,7 +4852,7 @@ class PrtPlatoonStops(am.ArrayObjman):
         return is_queue
 
     def get_berthqueues(self, id_stop, ids_berth):
-        print 'get_berthqueues ids_berth', ids_berth
+        print('get_berthqueues ids_berth', ids_berth)
         # currently not used
         # print 'get_berthqueues',id_stop
         # TODO: use stop angle and person angle to detect waiting persons
@@ -4862,7 +4862,7 @@ class PrtPlatoonStops(am.ArrayObjman):
         for id_person_sumo in self.waittimes_persons[id_stop].keys():
             stage = traci.person.getStage(id_person_sumo, 0)
             if self.debug:
-                print '  check id_person_sumo', id_person_sumo, 'Stagetype', stage.type, 'pos', traci.person.getLanePosition(id_person_sumo)
+                print('  check id_person_sumo', id_person_sumo, 'Stagetype', stage.type, 'pos', traci.person.getLanePosition(id_person_sumo))
             # check if person is in wait pos! Actually this is stage type driving = 3
             if stage.type == 3:
                 position = traci.person.getLanePosition(id_person_sumo)
@@ -4880,7 +4880,7 @@ class PrtPlatoonStops(am.ArrayObjman):
         """
         Make prt stop database from PT stops in network.
         """
-        print 'make_from_net'
+        print('make_from_net')
         self.clear()
         net = self.get_scenario().net
         ptstops = net.ptstops
@@ -4906,7 +4906,7 @@ class PrtPlatoonStops(am.ArrayObjman):
             ptstops.positions_to[ids_ptstop],
             edgelengths
         ):
-            print '  check', id_stop, 'number of lanes', len(ids_lane), ids_lane
+            print('  check', id_stop, 'number of lanes', len(ids_lane), ids_lane)
 
             ids_mode_allow = ids_modes_allow[ids_lane]
             if len(ids_lane) == 3:
@@ -4941,7 +4941,7 @@ class PrtPlatoonStops(am.ArrayObjman):
 
 class VehicleAdder(Process):
     def __init__(self,  vehicles, logger=None, **kwargs):
-        print 'VehicleAdder.__init__', vehicles, vehicles.parent.get_ident()
+        print('VehicleAdder.__init__', vehicles, vehicles.parent.get_ident())
         self._init_common('vehicleadder', name='Vehicle adder',
                           logger=logger,
                           info='Add vehicles to PRT stops of network.',
@@ -5091,7 +5091,7 @@ class PrtVehicles(am.ArrayObjman):
 
         vtypes = self.get_scenario().demand.vtypes
         prttype = 'HCPRT'
-        print 'make_vtype HPRT', prttype
+        print('make_vtype HPRT', prttype)
         # speedmode
         # https://sumo.dlr.de/docs/TraCI/Change_Vehicle_State.html
         # bit0: Regard safe speed
@@ -5129,10 +5129,10 @@ class PrtVehicles(am.ArrayObjman):
         if vtypes.ids_sumo.has_index(prttype):
             id_vtype = vtypes.ids_sumo.get_id_from_index(prttype)
             vtypes.del_row(id_vtype)
-            print '   deleted', prttype, 'id_vtype', id_vtype
+            print('   deleted', prttype, 'id_vtype', id_vtype)
 
         if (not vtypes.ids_sumo.has_index(prttype)) | is_reset_vtype:
-            print '  set default PRT values decel', self._decel_leader, 'decel_emergency', self._decel_emergency_leader
+            print('  set default PRT values decel', self._decel_leader, 'decel_emergency', self._decel_emergency_leader)
             id_vtype = vtypes.add_vtype(prttype,
                                         accel=self._accel_leader,
                                         decel=self._decel_leader,
@@ -5181,7 +5181,7 @@ class PrtVehicles(am.ArrayObjman):
                                         speed_charging=0.03,
                                         )
         else:
-            print '  PRT type existing'
+            print('  PRT type existing')
             id_vtype = vtypes.ids_sumo.get_id_from_index(prttype)
         return id_vtype
 
@@ -5194,7 +5194,7 @@ class PrtVehicles(am.ArrayObjman):
         return vtypes.lengths[id_vtype]
 
     def prepare_sim(self, process):
-        print 'PrtVehicles.prepare_sim'
+        print('PrtVehicles.prepare_sim')
         if len(self) == 0:
             return []
 
@@ -5288,12 +5288,12 @@ class PrtVehicles(am.ArrayObjman):
         # else:
         # add new ghost
         # ,self.ids_ghosts.shape
-        print 'add_ghost veh prt.%d ghost prt.%d dtm = %.1f dtmg = %.1f d0=%.1f' % (id_veh, id_ghost, dist_to_merge_veh, dist_to_merge_ghost, dist_to_merge_veh - dist_to_merge_ghost)
+        print('add_ghost veh prt.%d ghost prt.%d dtm = %.1f dtmg = %.1f d0=%.1f' % (id_veh, id_ghost, dist_to_merge_veh, dist_to_merge_ghost, dist_to_merge_veh - dist_to_merge_ghost))
 
         if -1 not in ids_ghosts:
-            print 'ERROR: no more ghosts available, ids_ghosts', ids_ghosts
+            print('ERROR: no more ghosts available, ids_ghosts', ids_ghosts)
             # sys.exit(1)
-            print '  overwrite last ghost'
+            print('  overwrite last ghost')
             # here we could sunstitute the ghost with the longest distance
             ind_ghost = len(ids_ghosts)-1
         else:
@@ -5307,7 +5307,7 @@ class PrtVehicles(am.ArrayObjman):
                         ind_ghost -= 1
 
         if ind_ghost > 0:
-            print 'WARNING: unusual number of ghosts, ids_ghosts', ids_ghosts
+            print('WARNING: unusual number of ghosts, ids_ghosts', ids_ghosts)
             # sys.exit(1)
 
         self.ids_ghosts[id_veh][ind_ghost] = id_ghost
@@ -5335,7 +5335,7 @@ class PrtVehicles(am.ArrayObjman):
                     self.del_ghost(id_veh, id_ghost)
 
     def del_ghost(self, id_veh, id_ghost):
-        print 'del_ghost id_veh %d id_ghost %d' % (id_veh, id_ghost)
+        print('del_ghost id_veh %d id_ghost %d' % (id_veh, id_ghost))
         if id_ghost in self.ids_ghosts[id_veh]:
 
             ind_ghost = list(self.ids_ghosts[id_veh]).index(id_ghost)
@@ -5368,12 +5368,12 @@ class PrtVehicles(am.ArrayObjman):
 
     def switch_off_control(self, id_veh):
         """Direct way to switch of SUMO control of vehicles"""
-        print 'switch_off_control id_veh', id_veh
+        print('switch_off_control id_veh', id_veh)
         traci.vehicle.setSpeedMode(self.ids_sumo[id_veh], 6)  # 6=respect max accel/decel
 
     def switch_on_control(self, id_veh):
         """Direct way to switch of SUMO control of vehicles"""
-        print 'switch_on_control id_veh', id_veh
+        print('switch_on_control id_veh', id_veh)
         traci.vehicle.setSpeedMode(self.ids_sumo[id_veh], self._speedmode_leader)
 
     def start_update(self, id_veh):
@@ -5394,8 +5394,8 @@ class PrtVehicles(am.ArrayObjman):
 
     def process_step(self, process):
         simtime = process.simtime
-        print 79*'_'
-        print 'PrtVehicles.process_step at', simtime
+        print(79*'_')
+        print('PrtVehicles.process_step at', simtime)
         net = self.get_scenario().net
         vehicles = self.parent.prtvehicles
         ids = self.get_ids()
@@ -5403,24 +5403,24 @@ class PrtVehicles(am.ArrayObjman):
             return
         time_update = self.time_update.get_value()
         decel_emergency = self.decel_emergency.get_value()
-        print '  update', len(np.flatnonzero(self.are_update[ids])), 'vehicles'
+        print('  update', len(np.flatnonzero(self.are_update[ids])), 'vehicles')
         ids_update = ids[self.are_update[ids]]
-        print '  ids_update', ids_update
+        print('  ids_update', ids_update)
         #ids_debug = [324,251,417,400]
         #ids_debug = [182,133,204,170]
         #ids_debug = [271, 304]
         ids_debug = [482, 483, 484]
         if 1:
-            print '  *Debug:'
+            print('  *Debug:')
             #ids_debug = [307, 236, 41, 231, 208, 44, 249, 229, 136]
             #ids_debug = [56, 271, 264, 244, 256, 253, 240, 251, 163, 150]
             #ids_debug = [26,242,139,79,138]
             #ids_debug = [2,482,44,63,67]
             for id_veh, id_veh_sumo, id_follower, id_leader in zip(ids_debug, self.ids_sumo[ids_debug], self.ids_follower[ids_debug], self.ids_leader[ids_debug]):
-                print '  *id_veh prt.%d' % id_veh, 'id_follower', id_follower, 'id_leader', id_leader, 'ids_ghost', self.ids_ghosts[id_veh]
-                print '      id_stop_target', self.ids_stop_target[id_veh], 'lp=%.1fm' % self.lengths_plat[id_veh]
+                print('  *id_veh prt.%d' % id_veh, 'id_follower', id_follower, 'id_leader', id_leader, 'ids_ghost', self.ids_ghosts[id_veh])
+                print('      id_stop_target', self.ids_stop_target[id_veh], 'lp=%.1fm' % self.lengths_plat[id_veh])
                 if self.states[id_veh] > 0:
-                    print '     pax', traci.vehicle.getPersonIDList(id_veh_sumo), 'isStopped', traci.vehicle.isStopped(id_veh_sumo), 'speed', traci.vehicle.getSpeed(id_veh_sumo)
+                    print('     pax', traci.vehicle.getPersonIDList(id_veh_sumo), 'isStopped', traci.vehicle.isStopped(id_veh_sumo), 'speed', traci.vehicle.getSpeed(id_veh_sumo))
 
             #self.id_follower_probe = self.ids_follower[271]
 
@@ -5434,7 +5434,7 @@ class PrtVehicles(am.ArrayObjman):
 
             if 0:
                 ids_ghost = self.ids_ghosts[id_veh]
-                print '  %7s' % id_veh_sumo, 'ghosts', ids_ghost, self.ids_leader[id_veh], "lp=%.1fm" % self.lengths_plat[id_veh]
+                print('  %7s' % id_veh_sumo, 'ghosts', ids_ghost, self.ids_leader[id_veh], "lp=%.1fm" % self.lengths_plat[id_veh])
                 #odo = self.odos[id_veh]
                 #delta_vehs = odo-self.odos0_vehicles[id_veh]
                 #delta_ghosts = self.odos[ids_ghost] - self.odos0_ghosts[id_veh]
@@ -5548,9 +5548,9 @@ class PrtVehicles(am.ArrayObjman):
                     dist_min_check = dist0 + delta_ghost - delta_veh - \
                         self.lengths_plat[self.ids_ghosts[id_veh][0]] - self.length
                     # print '    %7s: v=%3.1f vg=%3.1f dh=%4.1f th=%4.1fs ds=%4.1f dc=%4.1f lp=%3.1f %s'%(id_sumo, velocity, velocitiy_ghost_min,dist_min,th,dist_safe,dist_comf,length_plat,a)
-                    print '    %7s: v=%3.1f vg=%3.1f d0=%4.1f dh=%4.1f th=%3.1fs ds=%4.1f dc=%4.1f odo=%4.1f %s' % (id_sumo, velocity, velocitiy_ghost_min, dist0, dist_min, th, dist_safe, dist_comf, odo, a)
-                    print '       dist_min', dist_min, 'dist_min_check', dist_min_check, 'id_ghost', self.ids_ghosts[id_veh][0]
-                    print '       delta_veh', delta_veh, 'delta_ghost', delta_ghost, 'dist_rel', dist_rel
+                    print('    %7s: v=%3.1f vg=%3.1f d0=%4.1f dh=%4.1f th=%3.1fs ds=%4.1f dc=%4.1f odo=%4.1f %s' % (id_sumo, velocity, velocitiy_ghost_min, dist0, dist_min, th, dist_safe, dist_comf, odo, a))
+                    print('       dist_min', dist_min, 'dist_min_check', dist_min_check, 'id_ghost', self.ids_ghosts[id_veh][0])
+                    print('       delta_veh', delta_veh, 'delta_ghost', delta_ghost, 'dist_rel', dist_rel)
 
         fact_urgent = np.ones(dists_safe.shape, dtype=np.float32)  # np.clip(dists_safe/diststomerge_min,0.0,1.0)
 
@@ -5590,8 +5590,8 @@ class PrtVehicles(am.ArrayObjman):
         """
         This is the vehicle route to the next target, not necessary the final one.
         """
-        print 'set_route_target prt.%d' % id_veh, 'id_stop_target', id_stop_target, 'is_disengage_from_berth', is_disengage_from_berth
-        print '  route', route
+        print('set_route_target prt.%d' % id_veh, 'id_stop_target', id_stop_target, 'is_disengage_from_berth', is_disengage_from_berth)
+        print('  route', route)
 
         # set target only if valid target, otherwise set only route
         if id_stop_target is not None:
@@ -5625,7 +5625,7 @@ class PrtVehicles(am.ArrayObjman):
         self.routes[id_veh] = []
 
     def reset_speedmode(self, id_veh_sumo):
-        print 'reset_speedmode', id_veh_sumo
+        print('reset_speedmode', id_veh_sumo)
         # speed mode (0xb3)
         # Per default, the vehicle is using the given speed regarding the safe gap, the maximum acceleration, and the maximum deceleration. Furthermore, vehicles follow the right-of-way rules when approaching an intersection and if necessary they brake hard to avoid driving across a red light. One can control this behavior using the speed mode (0xb3) command, the given integer is a bitset (bit0 is the least significant bit) with the following fields:
         # 1 bit0: Regard safe speed
@@ -5641,7 +5641,7 @@ class PrtVehicles(am.ArrayObjman):
         # pass
 
     def concatenate(self, id_veh, id_veh_pre):
-        print 'concatenate prt.%d' % id_veh, 'behind  prt.%d' % id_veh_pre
+        print('concatenate prt.%d' % id_veh, 'behind  prt.%d' % id_veh_pre)
         self.ids_leader[id_veh] = id_veh_pre
         self.ids_follower[id_veh_pre] = id_veh
 
@@ -5668,7 +5668,7 @@ class PrtVehicles(am.ArrayObjman):
         else:
             self._update_concatenate(id_veh, 0.0)
 
-        print '  length_plat=', self.lengths_plat[id_veh]
+        print('  length_plat=', self.lengths_plat[id_veh])
 
     def _update_concatenate(self, id_veh, length_plat):
         """
@@ -5676,7 +5676,7 @@ class PrtVehicles(am.ArrayObjman):
         """
         # TODO: this is a very inefficient method because call each time a vehicle is added.
         # Try to avoid altogether
-        print '_update_concatenate prt.%s, length_plat=%.1f, length=%.1f,' % (id_veh, length_plat, self.length), 'id_leader', self.ids_leader[id_veh]
+        print('_update_concatenate prt.%s, length_plat=%.1f, length=%.1f,' % (id_veh, length_plat, self.length), 'id_leader', self.ids_leader[id_veh])
         if self.ids_leader[id_veh] == -1:
             # first vehicle
             # print '  first vehicle prt.%s'%id_veh,length_plat
@@ -5687,7 +5687,7 @@ class PrtVehicles(am.ArrayObjman):
             self._update_concatenate(self.ids_leader[id_veh], length_plat + self.length)
 
     def decatenate(self, id_veh):
-        print 'decatenate prt.%d' % id_veh
+        print('decatenate prt.%d' % id_veh)
 
         id_leader = self.ids_leader[id_veh]
         # print '  id_leader',id_leader
@@ -5734,7 +5734,7 @@ class PrtVehicles(am.ArrayObjman):
             # remove platoon length
             self.lengths_plat[id_veh] = 0.0
 
-        print '  length_plat=', self.lengths_plat[id_veh]
+        print('  length_plat=', self.lengths_plat[id_veh])
 
     def get_platoonleader(self, id_veh_tail):
         id_veh = 1*id_veh_tail
@@ -5757,7 +5757,7 @@ class PrtVehicles(am.ArrayObjman):
         return n
 
     def get_platoon(self, id_veh_leader):
-        print 'get_platoon for leader prt.%d' % id_veh_leader
+        print('get_platoon for leader prt.%d' % id_veh_leader)
         ids_veh = [id_veh_leader, ]
         id_veh = self.ids_follower[id_veh_leader]
         # print '  id_veh',id_veh
@@ -5766,7 +5766,7 @@ class PrtVehicles(am.ArrayObjman):
             id_veh = self.ids_follower[id_veh]
             # print '  id_veh',id_veh
 
-        print '   ids_veh', ids_veh
+        print('   ids_veh', ids_veh)
         return ids_veh
 
     def get_entered_left(self, id_edge_sumo, ids_veh_previous_sumo):
@@ -5779,7 +5779,7 @@ class PrtVehicles(am.ArrayObjman):
         the first vehicle in the list entered/left first 
         """
         ids_veh_new_sumo = traci.edge.getLastStepVehicleIDs(id_edge_sumo)
-        print 'get_entered_left ids_veh_new_sumo=', ids_veh_new_sumo
+        print('get_entered_left ids_veh_new_sumo=', ids_veh_new_sumo)
         len_prev = len(ids_veh_previous_sumo)
         len_new = len(ids_veh_new_sumo)
 
@@ -5801,7 +5801,7 @@ class PrtVehicles(am.ArrayObjman):
                 break
 
             ind_enter += 1
-        print '  ind_enter', ind_enter, ids_veh_new_sumo[0:ind_enter], ids_veh_new_sumo[ind_enter-1::-1]
+        print('  ind_enter', ind_enter, ids_veh_new_sumo[0:ind_enter], ids_veh_new_sumo[ind_enter-1::-1])
         #ids_entered_sumo = ids_veh_new_sumo[0:ind_enter]
 
         ind_leave = len_prev
@@ -5811,7 +5811,7 @@ class PrtVehicles(am.ArrayObjman):
                 break
 
             ind_leave -= 1
-        print '  ind_leave', ind_leave, ids_veh_previous_sumo[ind_leave:], ids_veh_previous_sumo[:ind_leave:-1]
+        print('  ind_leave', ind_leave, ids_veh_previous_sumo[ind_leave:], ids_veh_previous_sumo[:ind_leave:-1])
         #ids_leave_sumo = ids_veh_previous_sumo[ind_leave:]
 
         # return ids_entered_sumo, ids_leave_sumo, ids_veh_new_sumo
@@ -5829,7 +5829,7 @@ class PrtVehicles(am.ArrayObjman):
         stopline = pos + 3.0 + 0.5/self.decel*speed**2
         #time_slowdown = np.abs((speed0-speed)/self.decel)
 
-        print 'control_stop', id_veh_sumo, 'v = %.2f at pos %.1fm to stop at %.1fm on %s' % (speed, pos, stopline, traci.vehicle.getRoadID(id_veh_sumo))
+        print('control_stop', id_veh_sumo, 'v = %.2f at pos %.1fm to stop at %.1fm on %s' % (speed, pos, stopline, traci.vehicle.getRoadID(id_veh_sumo)))
         traci.vehicle.setStop(id_veh_sumo,
                               traci.vehicle.getRoadID(id_veh_sumo),
                               pos=stopline,
@@ -5839,7 +5839,7 @@ class PrtVehicles(am.ArrayObjman):
     def control_speedup(self, id_veh):
 
         id_veh_sumo = self.get_id_sumo(id_veh)
-        print 'control_speedup', id_veh_sumo, 'isStopped', traci.vehicle.isStopped(id_veh_sumo), self.speed_max.get_value()
+        print('control_speedup', id_veh_sumo, 'isStopped', traci.vehicle.isStopped(id_veh_sumo), self.speed_max.get_value())
 
         if traci.vehicle.isStopped(id_veh_sumo):
             traci.vehicle.resume(id_veh_sumo)
@@ -5848,13 +5848,13 @@ class PrtVehicles(am.ArrayObjman):
         #self.control_slow_down(id_veh, self.speed_max.get_value())
 
     def control_slow_down(self, id_veh, speed=1.0, time_slowdown=None):
-        print 'control_slow_down', self.get_id_sumo(id_veh), speed, time_slowdown
+        print('control_slow_down', self.get_id_sumo(id_veh), speed, time_slowdown)
         id_veh_sumo = self.get_id_sumo(id_veh)
         if time_slowdown is None:
             speed0 = traci.vehicle.getSpeed(id_veh_sumo)
 
             time_slowdown = np.abs((speed0-speed)/self.decel)
-            print '    speed0=%.2fm/s, time_slowdown = %.2fs, dv=%.2fm/s' % (speed0, time_slowdown, speed0-speed)
+            print('    speed0=%.2fm/s, time_slowdown = %.2fs, dv=%.2fm/s' % (speed0, time_slowdown, speed0-speed))
 
         traci.vehicle.slowDown(id_veh_sumo, speed, time_slowdown)
         #self.speed_max = vtypes.speeds_max[id_vtype]
@@ -5873,9 +5873,9 @@ class PrtVehicles(am.ArrayObjman):
         # state forewarding_exit_kickout was unknown!!!
         id_veh_sumo = self.get_id_sumo(id_veh)
         p = traci.vehicle.getLanePosition(id_veh_sumo)
-        print 'control_forewarding_exit', id_veh_sumo, p, '->', position, 'laneindex', laneindex
+        print('control_forewarding_exit', id_veh_sumo, p, '->', position, 'laneindex', laneindex)
         if traci.vehicle.isStopped(id_veh_sumo):
-            print '  resume stop'
+            print('  resume stop')
             traci.vehicle.resume(id_veh_sumo)
 
         self.states[id_veh] = VEHICLESTATES['forewarding_exit_kickout']
@@ -5884,7 +5884,7 @@ class PrtVehicles(am.ArrayObjman):
             # print '  do not set a stop'
             pass
         else:
-            print '  set stop at pos', position
+            print('  set stop at pos', position)
             traci.vehicle.setStop(id_veh_sumo,
                                   id_edge_sumo,
                                   pos=position,
@@ -5898,7 +5898,7 @@ class PrtVehicles(am.ArrayObjman):
     def control_stopline_enter(self, id_veh, id_edge_sumo, stopline, laneindex=1, flags=0):
         # print 'control_stopline_enter',self.get_id_sumo(id_veh),stopline
         id_veh_sumo = self.get_id_sumo(id_veh)
-        print 'control_stopline_enter', id_veh_sumo, 'lane %d, pos=%.2f->targetpos %.2f' % (laneindex, traci.vehicle.getLanePosition(id_veh_sumo), stopline)
+        print('control_stopline_enter', id_veh_sumo, 'lane %d, pos=%.2f->targetpos %.2f' % (laneindex, traci.vehicle.getLanePosition(id_veh_sumo), stopline))
         traci.vehicle.setStop(id_veh_sumo,
                               id_edge_sumo,
                               pos=stopline,
@@ -5919,13 +5919,13 @@ class PrtVehicles(am.ArrayObjman):
         """
         id_veh_sumo = self.get_id_sumo(id_veh)
         p = traci.vehicle.getLanePosition(id_veh_sumo)
-        print 'control_berth_position_enter', id_veh_sumo, p, '->', position, 'id_berth', id_berth
+        print('control_berth_position_enter', id_veh_sumo, p, '->', position, 'id_berth', id_berth)
 
         # here it can happen that vehicle has been programmed to stop in front
         # of first berth to wait for allocation
         # print '  getStopState',traci.vehicle.getStopState(id_veh_sumo)
         # print '  getNextStops',traci.vehicle.getNextStops(id_veh_sumo)
-        print '  isStopped', traci.vehicle.isStopped(id_veh_sumo)
+        print('  isStopped', traci.vehicle.isStopped(id_veh_sumo))
         # if len(traci.vehicle.getNextStops(id_veh_sumo))>0:
 
         # already resumed
@@ -5954,7 +5954,7 @@ class PrtVehicles(am.ArrayObjman):
         p = traci.vehicle.getLanePosition(id_veh_sumo)
         if position is None:
             position = p+0.3
-        print 'control_berth_position_exit', id_veh_sumo, p, '->', position
+        print('control_berth_position_exit', id_veh_sumo, p, '->', position)
         if traci.vehicle.isStopped(id_veh_sumo):
             traci.vehicle.resume(id_veh_sumo)
 
@@ -5972,7 +5972,7 @@ class PrtVehicles(am.ArrayObjman):
 
     def control_berth_position_exit_slowdown(self, id_veh):
         id_veh_sumo = self.get_id_sumo(id_veh)
-        print '  control_berth_position_exit_slowdown', id_veh_sumo
+        print('  control_berth_position_exit_slowdown', id_veh_sumo)
         # function to stop vehicle after it moved out of the berth
         if traci.vehicle.isStopped(id_veh_sumo):
             traci.vehicle.resume(id_veh_sumo)
@@ -5989,7 +5989,7 @@ class PrtVehicles(am.ArrayObjman):
         """
         id_veh_sumo = self.get_id_sumo(id_veh)
         p = traci.vehicle.getLanePosition(id_veh_sumo)
-        print 'control_berth_stop', id_veh_sumo, p, '->', position
+        print('control_berth_stop', id_veh_sumo, p, '->', position)
         #d = position - p
         #v = traci.vehicle.getSpeed(id_veh_sumo)
         #d_save = 1.0/(2*2.5)*(v**2)
@@ -6012,8 +6012,8 @@ class PrtVehicles(am.ArrayObjman):
 
         # NO LONGER USED
         id_veh_sumo = self.get_id_sumo(id_veh)
-        print 'control_stop_board', id_veh_sumo, id_stop, id_berth, id_edge_sumo, 'pos=%.2f,target %.2f' % (traci.vehicle.getLanePosition(id_veh_sumo), position),
-        print '  v=', traci.vehicle.getSpeed(id_veh_sumo)
+        print('control_stop_board', id_veh_sumo, id_stop, id_berth, id_edge_sumo, 'pos=%.2f,target %.2f' % (traci.vehicle.getLanePosition(id_veh_sumo), position),)
+        print('  v=', traci.vehicle.getSpeed(id_veh_sumo))
 
         # print 'control_stop_board',id_veh_sumo,traci.vehicle.getLanePosition(id_veh_sumo),'->',position,id_berth
         self.ids_berth[id_veh] = id_berth
@@ -6033,9 +6033,9 @@ class PrtVehicles(am.ArrayObjman):
     def launch_from_stop(self, id_veh):
 
         id_veh_sumo = self.get_id_sumo(id_veh)
-        print 'launch_from_stop', id_veh_sumo, 'is stopped', traci.vehicle.isStopped(id_veh_sumo)
+        print('launch_from_stop', id_veh_sumo, 'is stopped', traci.vehicle.isStopped(id_veh_sumo))
         if traci.vehicle.isStopped(id_veh_sumo):
-            print '  resume!'
+            print('  resume!')
             traci.vehicle.resume(id_veh_sumo)
 
         route_sumo = self.get_scenario().net.edges.ids_sumo[self.routes[id_veh]]
@@ -6044,7 +6044,7 @@ class PrtVehicles(am.ArrayObjman):
         traci.vehicle.setMaxSpeed(id_veh_sumo, 6.0/3.6)
         #traci.vehicle.setMaxSpeed(id_veh_sumo, self.speed_max.get_value())
         #traci.vehicle.setMaxSpeed(id_veh_sumo, 0.66)
-        print '  after launch is stopped', traci.vehicle.isStopped(id_veh_sumo), 'getMaxSpeed', traci.vehicle.getMaxSpeed(id_veh_sumo)
+        print('  after launch is stopped', traci.vehicle.isStopped(id_veh_sumo), 'getMaxSpeed', traci.vehicle.getMaxSpeed(id_veh_sumo))
 
     def alight(self, id_veh):
         # print 'alight',self.get_id_sumo(id_veh)
@@ -6077,7 +6077,7 @@ class PrtVehicles(am.ArrayObjman):
 
     def init_passthrough(self, id_veh, id_edge_sumo, stopline, laneindex=1, flags=0):
         id_veh_sumo = self.get_id_sumo(id_veh)
-        print 'init_passthrough', id_veh_sumo, 'lane %d, pos=%.2f->targetpos %.2f' % (laneindex, traci.vehicle.getLanePosition(id_veh_sumo), stopline)
+        print('init_passthrough', id_veh_sumo, 'lane %d, pos=%.2f->targetpos %.2f' % (laneindex, traci.vehicle.getLanePosition(id_veh_sumo), stopline))
 
         # do n
         #is_stop = True
@@ -6099,7 +6099,7 @@ class PrtVehicles(am.ArrayObjman):
     def foreward_passthrough(self, id_veh):
 
         id_veh_sumo = self.get_id_sumo(id_veh)
-        print 'foreward_passthrough', id_veh_sumo
+        print('foreward_passthrough', id_veh_sumo)
         if traci.vehicle.isStopped(id_veh_sumo):
             # print '  resume!'
             traci.vehicle.resume(id_veh_sumo)
@@ -6108,16 +6108,16 @@ class PrtVehicles(am.ArrayObjman):
 
     def reached_stop_sumo(self, id_veh_sumo):
         state = traci.vehicle.getStopState(id_veh_sumo)
-        print 'reached_stop', id_veh_sumo, bin(state), bin(state)[-1] == '1'
+        print('reached_stop', id_veh_sumo, bin(state), bin(state)[-1] == '1')
         return bin(state)[-1] == '1'
 
     def is_completed_alighting(self, id_veh):
-        print 'is_completed_alighting', self.get_id_sumo(id_veh), self.states[id_veh], 'alighting', self.states[id_veh] == VEHICLESTATES['alighting'], 'pers on board', traci.vehicle.getPersonNumber(self.get_id_sumo(id_veh)), type(traci.vehicle.getPersonNumber(self.get_id_sumo(id_veh)))
+        print('is_completed_alighting', self.get_id_sumo(id_veh), self.states[id_veh], 'alighting', self.states[id_veh] == VEHICLESTATES['alighting'], 'pers on board', traci.vehicle.getPersonNumber(self.get_id_sumo(id_veh)), type(traci.vehicle.getPersonNumber(self.get_id_sumo(id_veh))))
         if self.states[id_veh] == VEHICLESTATES['alighting']:
             ids_persons_sumo_on_board = traci.vehicle.getPersonIDList(self.get_id_sumo(id_veh))
             if self.ids_persons_sumo[id_veh].isdisjoint(ids_persons_sumo_on_board):
                 # if traci.vehicle.getPersonIDList(self.get_id_sumo(id_veh)) == 0:
-                print '  completed alighting ids_persons_sumo_on_board', ids_persons_sumo_on_board
+                print('  completed alighting ids_persons_sumo_on_board', ids_persons_sumo_on_board)
                 if len(ids_persons_sumo_on_board) > 0:
                     self.states[id_veh] = VEHICLESTATES['boarding']
                 else:
@@ -6138,7 +6138,7 @@ class PrtVehicles(am.ArrayObjman):
         if self.states[id_veh] in (VEHICLESTATES['boarding'], VEHICLESTATES['waiting']):
             ids_person_sumo = traci.vehicle.getPersonIDList(self.get_id_sumo(id_veh))
             if len(ids_person_sumo) == 1:
-                print '  completed boarding'
+                print('  completed boarding')
                 self.states[id_veh] = VEHICLESTATES['boarding_completed']
                 self.ids_persons_sumo[id_veh].add(ids_person_sumo)
                 return True
@@ -6153,7 +6153,7 @@ class PrtVehicles(am.ArrayObjman):
 
     def init_trip_occupied(self, id_veh, id_edge_sumo, stopline=None):
         id_veh_sumo = self.get_id_sumo(id_veh)
-        print 'init_trip_occupied', self.get_id_sumo(id_veh), id_edge_sumo, stopline
+        print('init_trip_occupied', self.get_id_sumo(id_veh), id_edge_sumo, stopline)
         # print '  current route:',traci.vehicle.getRoute(id_veh_sumo)
         self.states[id_veh] = VEHICLESTATES['occupiedtrip']
 
@@ -6174,7 +6174,7 @@ class PrtVehicles(am.ArrayObjman):
             #traci.vehicle.slowDown(id_veh_sumo, speed_crawl, time_accel)
 
     def init_trip_empty(self, id_veh, id_edge_sumo, stopline=None):
-        print 'Vehicles.init_trip_empty', self.get_id_sumo(id_veh), id_edge_sumo, stopline
+        print('Vehicles.init_trip_empty', self.get_id_sumo(id_veh), id_edge_sumo, stopline)
         self.states[id_veh] = VEHICLESTATES['emptytrip']
         id_veh_sumo = self.get_id_sumo(id_veh)
         if traci.vehicle.isStopped(id_veh_sumo):
@@ -6197,7 +6197,7 @@ class PrtVehicles(am.ArrayObjman):
             #traci.vehicle.slowDown(id_veh_sumo, speed_crawl, time_accel)
 
     def reschedule_trip(self, id_veh, id_edge_sumo_to=None, route_sumo=None):
-        print 'reschedule_trip', self.get_id_sumo(id_veh), id_edge_sumo_to, route_sumo
+        print('reschedule_trip', self.get_id_sumo(id_veh), id_edge_sumo_to, route_sumo)
         id_veh_sumo = self.get_id_sumo(id_veh)
         if traci.vehicle.isStopped(id_veh_sumo):
             traci.vehicle.resume(id_veh_sumo)
@@ -6364,7 +6364,7 @@ class HcPrtStrategy(StrategyMixin):
         # put 2 for persons  who prefer prt (probably few in pre PRT times)
         preeval[persons.ids_mode_preferred[ids_person] == self.prtservice.id_prtmode] = 2
 
-        print '  HcPrtStrategy.preevaluate', len(np.flatnonzero(preeval))
+        print('  HcPrtStrategy.preevaluate', len(np.flatnonzero(preeval)))
         return preeval
 
     def plan(self, ids_person, logger=None):
@@ -6372,7 +6372,7 @@ class HcPrtStrategy(StrategyMixin):
         Generates a plan for these person according to this strategie.
         Overriden by specific strategy.
         """
-        print 'HcPrtStrategy.plan', len(ids_person)
+        print('HcPrtStrategy.plan', len(ids_person))
         #make_plans_private(self, ids_person = None, mode = 'passenger')
         # routing necessary?
         virtualpop = self.get_virtualpop()
@@ -6390,7 +6390,7 @@ class HcPrtStrategy(StrategyMixin):
         prtstops = self.prtservice.prtstops
 
         if len(prtstops) == 0:
-            print 'WARNING: no prt stops, no prt plans'
+            print('WARNING: no prt stops, no prt plans')
             return True
 
         net = scenario.net
@@ -6411,14 +6411,14 @@ class HcPrtStrategy(StrategyMixin):
 
         times_stop_to_stop = self.prtservice.times_stop_to_stop
         if times_stop_to_stop is None:
-            print 'WARNING: stop to stop matrix not calculated. Please configure the PRT system.'
+            print('WARNING: stop to stop matrix not calculated. Please configure the PRT system.')
             return True
 
         ids_person_act, ids_act_from, ids_act_to\
             = virtualpop.get_activities_from_pattern(0, ids_person=ids_person)
 
         if len(ids_person_act) == 0:
-            print 'WARNING in TrasitStrategy.plan: no eligible persons found.'
+            print('WARNING in TrasitStrategy.plan: no eligible persons found.')
             return False
 
         # temporary maps from ids_person to other parameters
@@ -6437,7 +6437,7 @@ class HcPrtStrategy(StrategyMixin):
         map_ids_fac_from[ids_person_act] = activities.ids_facility[ids_act_from]
 
         n_plans = len(ids_person_act)
-        print 'TrasitStrategy.plan n_plans=', n_plans
+        print('TrasitStrategy.plan n_plans=', n_plans)
 
         # make initial activity stage
         ids_edge_from = facilities.ids_roadedge_closest[map_ids_fac_from[ids_person_act]]
@@ -6522,15 +6522,15 @@ class HcPrtStrategy(StrategyMixin):
                 if logger:
                     logger.progress(i/n_pers*100)
                 i += 1.0
-                print 79*'_'
-                print '  id_plan=%d, id_person=%d, ' % (id_plan, id_person)
+                print(79*'_')
+                print('  id_plan=%d, id_person=%d, ' % (id_plan, id_person))
 
                 if id_person == 17214:
-                    print '    id_stop_from', id_stop_from, 'id_stop_to', id_stop_to
-                    print '    id_stopedge_from', id_stopedge_from, 'id_stopedge_to', id_stopedge_to
+                    print('    id_stop_from', id_stop_from, 'id_stop_to', id_stop_to)
+                    print('    id_stopedge_from', id_stopedge_from, 'id_stopedge_to', id_stopedge_to)
 
                 if (dist_from_to < dist_walk_max) | (id_edge_from == -1) | (id_edge_to == -1) | (id_stop_from == id_stop_to):
-                    print '    go by foot because distance is too short ', dist_from_to, 'edges', id_edge_from, id_edge_to, 'stops', id_stop_from, id_stop_to
+                    print('    go by foot because distance is too short ', dist_from_to, 'edges', id_edge_from, id_edge_to, 'stops', id_stop_from, id_stop_to)
 
                     id_stage_walk1, time = walkstages.append_stage(
                         id_plan, time_from,
@@ -6597,7 +6597,7 @@ class HcPrtTransits(StageTypeMixin):
                  # **kwargs,
                  ):
 
-        print 'HcPrtTransits.__init__', ident, stages
+        print('HcPrtTransits.__init__', ident, stages)
         self.init_stagetable(ident,
                              stages, name=name,
                              info=info,
@@ -6621,20 +6621,20 @@ class HcPrtTransits(StageTypeMixin):
                                      ))
 
     def set_prtservice(self, prtservice):
-        print 'HcPrtTransits.set_prtservice', prtservice, 'id(self)', id(self)
+        print('HcPrtTransits.set_prtservice', prtservice, 'id(self)', id(self))
         self.add(cm.ObjConf(prtservice, is_child=False, groups=['_private']))
 
     def get_prtservice(self):
-        print 'get_prtservice', self, id(self)
+        print('get_prtservice', self, id(self))
         return self.hcprtservice.get_value()
 
     def prepare_planning(self):
 
         prtservice = self.get_prtservice()
-        print 'HcPrtTransits.prepare_planning', prtservice.times_stop_to_stop
+        print('HcPrtTransits.prepare_planning', prtservice.times_stop_to_stop)
         if prtservice.times_stop_to_stop is None:
             prtservice.make_times_stop_to_stop()
-        print prtservice.times_stop_to_stop
+        print(prtservice.times_stop_to_stop)
 
     def append_stage(self, id_plan, time_start=-1.0,
                      duration=0.0,
@@ -6781,7 +6781,7 @@ class VehicleMan(am.ArrayObjman):
         return self.parent.parent.get_scenario()
 
     def prepare_sim(self, process):
-        print 'VehicleMan.prepare_sim'
+        print('VehicleMan.prepare_sim')
         net = self.get_scenario().net
 
         # station management
@@ -6841,7 +6841,7 @@ class VehicleMan(am.ArrayObjman):
         self.ids_veh = self.get_vehicles().get_ids()
 
         if len(self.ids_veh) == 0:
-            print 'WARNING: no PRT vehicles, please add PRT vehicles.'
+            print('WARNING: no PRT vehicles, please add PRT vehicles.')
             return []
 
         n_veharray = np.max(self.ids_veh)+1
@@ -6872,7 +6872,7 @@ class VehicleMan(am.ArrayObjman):
                 ]
 
     def update_flows(self, process):
-        print 'HC VehicleMan update flow prediction'
+        print('HC VehicleMan update flow prediction')
         self.inflows_sched[:, 0] = 0
         self.inflows_sched = np.roll(self.inflows_sched, -1)
         time_update_flows = self.time_update_flows.get_value()
@@ -6902,8 +6902,8 @@ class VehicleMan(am.ArrayObjman):
         self.log_inflows_temp[:] = 0
 
     def process_step(self, process):
-        print 79*'M'
-        print 'HC VehicleMan.process_step'
+        print(79*'M')
+        print('HC VehicleMan.process_step')
 
         self.debug = 9
 
@@ -6919,13 +6919,13 @@ class VehicleMan(am.ArrayObjman):
             is_cont = (n_move_eff_total > 0) & np.any(surpluses_veh_urgent > 0)
             is_cont = False
             if self.debug > 4:
-                print 79*'-'
-                print '  check equalize iteration', np.any(surpluses_veh > 0), np.any(balances_veh > 0), np.any(surpluses_veh_urgent > 0), 'is_cont', is_cont
-                print '  n_move_eff_total', n_move_eff_total
-                print '  surpluses_veh', surpluses_veh
-                print '  demands_veh', demands_veh
-                print '  balances_veh', balances_veh
-                print '  surpluses_veh_urgent', surpluses_veh_urgent
+                print(79*'-')
+                print('  check equalize iteration', np.any(surpluses_veh > 0), np.any(balances_veh > 0), np.any(surpluses_veh_urgent > 0), 'is_cont', is_cont)
+                print('  n_move_eff_total', n_move_eff_total)
+                print('  surpluses_veh', surpluses_veh)
+                print('  demands_veh', demands_veh)
+                print('  balances_veh', balances_veh)
+                print('  surpluses_veh_urgent', surpluses_veh_urgent)
 
         if 0:
             stops = self.get_stops()
@@ -6961,7 +6961,7 @@ class VehicleMan(am.ArrayObjman):
         self.inflows_person[id_stop] += n_pax
 
     def note_vehs_ready_for_departure(self, id_stop, id_stop_target, time_est, n_veh):
-        print 'note_vehs_ready_for_departure id_stop', id_stop, id_stop_target, time_est, n_veh
+        print('note_vehs_ready_for_departure id_stop', id_stop, id_stop_target, time_est, n_veh)
         self.ids_stop_target_current[id_stop] = id_stop_target
         self.duration_est_target_current[id_stop] = time_est
         self.numbers_veh_target_current[id_stop] = n_veh
@@ -6984,7 +6984,7 @@ class VehicleMan(am.ArrayObjman):
         # idea behind is that room for more slots are more difficult to find
         n_slots_search = n_slots_search_empty + n_slots
         if self.debug > 1:
-            print 'fit_vehicles n_veh', n_veh, 'n_slots', n_slots, 'capa_slots %.2f' % (capa * n_slots), 'at slot', ind_time_arrival, 'n_slots_search', n_slots_search
+            print('fit_vehicles n_veh', n_veh, 'n_slots', n_slots, 'capa_slots %.2f' % (capa * n_slots), 'at slot', ind_time_arrival, 'n_slots_search', n_slots_search)
         ind_delay = 0
         is_fit = False
         while (ind_delay < n_slots_search) & (not is_fit) & (ind_time_arrival + ind_delay + n_slots < self.n_est_max):
@@ -6993,15 +6993,15 @@ class VehicleMan(am.ArrayObjman):
             flows_sched = self.inflows_sched[id_stop, ind_time_arrival_sched:ind_time_arrival_sched+n_slots]
 
             is_fit = np.sum(flows_sched) + n_veh < capa * n_slots
-            print '    ind_delay', ind_delay, 'is_fit', is_fit, 'from', ind_time_arrival_sched, 'to', ind_time_arrival_sched + n_slots, 'flows_sched', flows_sched,  # 'max',self.n_est_max
+            print('    ind_delay', ind_delay, 'is_fit', is_fit, 'from', ind_time_arrival_sched, 'to', ind_time_arrival_sched + n_slots, 'flows_sched', flows_sched,)  # 'max',self.n_est_max
             ind_delay += 1
 
         # check if sufficient time-slots in the future are available
         # at estimated arrival time
         if self.debug > 2:
-            print '  ind_time_arrival_sched', ind_time_arrival_sched, 'ind_delay', ind_delay
-            print '    flows_sched ', flows_sched
-            print '    n_slots ', n_slots, 'scheduled', np.sum(flows_sched), 'avail', capa * n_slots, 'is_fit', is_fit
+            print('  ind_time_arrival_sched', ind_time_arrival_sched, 'ind_delay', ind_delay)
+            print('    flows_sched ', flows_sched)
+            print('    n_slots ', n_slots, 'scheduled', np.sum(flows_sched), 'avail', capa * n_slots, 'is_fit', is_fit)
 
             if self.debug > 5:
                 self.display_flows_est(id_stop, ind_time_arrival_sched, ind_time_arrival_sched+n_slots)
@@ -7019,12 +7019,12 @@ class VehicleMan(am.ArrayObjman):
                 capa_avail = capa_slot - flow_sched
                 n_alloc = min(int(capa_avail), n_veh-n_alloc_cum)
                 if self.debug > 5:
-                    print '   i_slot', i_slot, 'capa_slot %.2f' % capa_slot, 'capa_avail %.2f' % capa_avail, 'n_alloc', n_alloc, 'n_alloc_cum', n_alloc_cum
+                    print('   i_slot', i_slot, 'capa_slot %.2f' % capa_slot, 'capa_avail %.2f' % capa_avail, 'n_alloc', n_alloc, 'n_alloc_cum', n_alloc_cum)
                 if n_alloc > 0:
                     flows_alloc[i_slot] += n_alloc
                     n_alloc_cum += n_alloc
                     if self.debug > 5:
-                        print '      add n_alloc', n_alloc, 'n_alloc_cum', n_alloc_cum
+                        print('      add n_alloc', n_alloc, 'n_alloc_cum', n_alloc_cum)
                     # capacity of next slot is augmented by the
                     # rest capacity of the present slot
                     capa_slot = capa + (capa - n_alloc - flow_sched)
@@ -7033,7 +7033,7 @@ class VehicleMan(am.ArrayObjman):
 
             # finally check whether all vehicle have been assigned
             if self.debug > 2:
-                print '  n_alloc_cum', n_alloc_cum, 'n_veh', n_veh, 'flows_alloc', flows_alloc
+                print('  n_alloc_cum', n_alloc_cum, 'n_veh', n_veh, 'flows_alloc', flows_alloc)
 
             # due to rounding errors the rest of the last slot may not be assigned
             if n_alloc_cum < n_veh:
@@ -7058,7 +7058,7 @@ class VehicleMan(am.ArrayObjman):
 
         n_slots = n_slots = np.ceil(float(n_veh)/capa)
 
-        print 'get_timeslot_occupation n_veh', n_veh, 'capa_int', capa_int, 'n_slots', n_slots, 'rem', n_veh - n_slots*capa_int
+        print('get_timeslot_occupation n_veh', n_veh, 'capa_int', capa_int, 'n_slots', n_slots, 'rem', n_veh - n_slots*capa_int)
         if n_slots == 0:
             flows = np.zeros(1, dtype=np.int32)
         else:
@@ -7080,7 +7080,7 @@ class VehicleMan(am.ArrayObjman):
         stops = self.get_stops()
         ids_stop_all = stops.get_ids()
         ids_stop = ids_stop_all[self.numbers_veh_target_current[ids_stop_all] > 0]
-        print 'HC push_out_vehicles of  %d stops' % (len(ids_stop))
+        print('HC push_out_vehicles of  %d stops' % (len(ids_stop)))
         #vehicles = self.get_vehicles()
 
         ids_stop_launched = []
@@ -7092,10 +7092,10 @@ class VehicleMan(am.ArrayObjman):
                     self.numbers_veh_target_current[ids_stop],
                 ):
             time_depart = self.times_departure_sched[id_stop]
-            print '\n    check id_stop', id_stop, 'id_stop_target', id_stop_target, 'n_veh', n_veh, 'dur %.2f' % duration_est, 't_dep', time_depart, 'simtime', simtime
+            print('\n    check id_stop', id_stop, 'id_stop_target', id_stop_target, 'n_veh', n_veh, 'dur %.2f' % duration_est, 't_dep', time_depart, 'simtime', simtime)
 
             if time_depart != -1:
-                print '  delay has been programmed is_launch', simtime > time_depart
+                print('  delay has been programmed is_launch', simtime > time_depart)
                 if (simtime > time_depart):
                     # simtime has reached scheduled departure time, so launch
                     self.times_departure_sched[id_stop] = -1
@@ -7108,7 +7108,7 @@ class VehicleMan(am.ArrayObjman):
                 time_arr_est = simtime + duration_est
                 ind_time_arrival = int(duration_est/time_update_flows+0.5)
 
-                print '      time_arr_est', time_arr_est, 'ind_time_arrival', ind_time_arrival, 'in range', ind_time_arrival < self.n_est_max
+                print('      time_arr_est', time_arr_est, 'ind_time_arrival', ind_time_arrival, 'in range', ind_time_arrival < self.n_est_max)
 
                 if ind_time_arrival < self.n_est_max:
                     # required number of free time slots for n_veh
@@ -7118,24 +7118,24 @@ class VehicleMan(am.ArrayObjman):
                         # allocation successful
                         self.inflows_sched[id_stop_target,
                                            ind_time_arrival_sched:ind_time_arrival_sched+n_alloc] += flows_alloc
-                        print '    schedule id_stop_target', id_stop_target, 'inflows_sched', self.inflows_sched[id_stop_target, ind_time_arrival_sched:ind_time_arrival_sched+n_alloc]
+                        print('    schedule id_stop_target', id_stop_target, 'inflows_sched', self.inflows_sched[id_stop_target, ind_time_arrival_sched:ind_time_arrival_sched+n_alloc])
                         if ind_time_arrival_sched == ind_time_arrival:
-                            print '    immediate launch'
+                            print('    immediate launch')
                             self.times_departure_sched[id_stop] = -1
                             is_launch = True
                         else:
                             # delayed launch, determine scheduled launch time
                             self.times_departure_sched[id_stop] = simtime + \
                                 ind_time_arrival_sched * time_update_flows - duration_est
-                            print '    delayed launch: sched dep time', self.times_departure_sched[id_stop]
+                            print('    delayed launch: sched dep time', self.times_departure_sched[id_stop])
                             is_launch = False
 
                     else:
-                        print 'WARNING: no capacity available at id_stop_target', id_stop_target, ' at this arrival time.'
+                        print('WARNING: no capacity available at id_stop_target', id_stop_target, ' at this arrival time.')
                         is_launch = False
                 else:
                     #
-                    print'WARNING: arrival time out of measurement range for id_stop_target', id_stop_target
+                    print('WARNING: arrival time out of measurement range for id_stop_target', id_stop_target)
                     is_launch = True
 
             if is_launch:
@@ -7172,7 +7172,7 @@ class VehicleMan(am.ArrayObjman):
         stops = self.get_stops()
         ids_stop = stops.get_ids()
         n_stops = len(ids_stop)
-        print 'equalize_empty_vehicles of  %d stops' % n_stops
+        print('equalize_empty_vehicles of  %d stops' % n_stops)
 
         balances_veh = np.zeros(n_stops, dtype=np.float32)
         demands_veh = np.zeros(n_stops, dtype=np.float32)
@@ -7198,7 +7198,7 @@ class VehicleMan(am.ArrayObjman):
             surpluses_veh[i] = surplus_veh  # this is current surplus, vehicles immediately available
             surpluses_veh_urgent[i] = surplus_veh_urgent  # number of vehicles that need to be kicked out
             if self.debug > 2:
-                print '\n  sssssssssseek destinations for id_stop', id_stop
+                print('\n  sssssssssseek destinations for id_stop', id_stop)
 
             if self.debug > 5:
                 self.display_flows_est(id_stop)
@@ -7208,22 +7208,22 @@ class VehicleMan(am.ArrayObjman):
                 surplus_veh + surplus_veh_future - n_pax_wait - n_pax_future
 
             if self.debug > 2:
-                print '    surplus_veh', surplus_veh, 'surplus_future', surplus_veh_future, 'surplus_veh_urgent', surplus_veh_urgent
-                print '    n_pax_wait ', n_pax_wait, 'n_pax_future', n_pax_future
-                print '    balance ', balances_veh[i]
-                print '    waittime_max ', waittimes_max[i]
+                print('    surplus_veh', surplus_veh, 'surplus_future', surplus_veh_future, 'surplus_veh_urgent', surplus_veh_urgent)
+                print('    n_pax_wait ', n_pax_wait, 'n_pax_future', n_pax_future)
+                print('    balance ', balances_veh[i])
+                print('    waittime_max ', waittimes_max[i])
             i += 1
 
         inds_sorted = np.argsort(balances_veh)
 
         #surpluses_veh_emitters = surpluses_veh[inds_sorted[::-1]]
         if self.debug > 2:
-            print '  Emitters sorted:'
-            print '    ids_stop_sorted       ', ids_stop[inds_sorted[::-1]]
-            print '    surpluses_veh', surpluses_veh[inds_sorted[::-1]]
-            print '    balances_sorted       ', balances_veh[inds_sorted[::-1]]
-            print '  max(surpluses_veh)', max(surpluses_veh)
-            print '  >>>max(balances_veh)', max(balances_veh)
+            print('  Emitters sorted:')
+            print('    ids_stop_sorted       ', ids_stop[inds_sorted[::-1]])
+            print('    surpluses_veh', surpluses_veh[inds_sorted[::-1]])
+            print('    balances_sorted       ', balances_veh[inds_sorted[::-1]])
+            print('  max(surpluses_veh)', max(surpluses_veh))
+            print('  >>>max(balances_veh)', max(balances_veh))
 
         if (np.max(balances_veh) > 0) & (max(surpluses_veh) > 0):
 
@@ -7238,7 +7238,7 @@ class VehicleMan(am.ArrayObjman):
                 if (surplus_from >= 1) & (balance_from >= 1):
                     if self.debug > 5:
                         # ,'ind_from',ind_from,'continue?',(surplus_from >= 1) & (balance_from >= 1)
-                        print '\n    potential emitter stop: id_stop_from', id_stop_from, 'surplus_from', surplus_from, 'balance_from', balance_from
+                        print('\n    potential emitter stop: id_stop_from', id_stop_from, 'surplus_from', surplus_from, 'balance_from', balance_from)
                     # there are empties to send away and positive balance
                     utilities = np.zeros(n_stops, dtype=np.float32)
                     numbers_move = np.zeros(n_stops, dtype=np.int32)
@@ -7251,9 +7251,9 @@ class VehicleMan(am.ArrayObjman):
                             time_to = times_stop_to_stop[id_stop_from, id_stop_to]
 
                             if self.debug > 5:
-                                print '    j', j, 'id_stop_from  ', id_stop_from, 'id_stop_to', id_stop_to
-                                print '        balance_from', balance_from, 'balance_to', balance_to, 'min', -balance_to+0.5, surplus_from
-                                print '        demand_to', demand_to, 'waittime_max_to', waittime_max_to
+                                print('    j', j, 'id_stop_from  ', id_stop_from, 'id_stop_to', id_stop_to)
+                                print('        balance_from', balance_from, 'balance_to', balance_to, 'min', -balance_to+0.5, surplus_from)
+                                print('        demand_to', demand_to, 'waittime_max_to', waittime_max_to)
 
                             if (surplus_from >= 1) & (balance_from >= 1) & (demand_to > 0):
                                 # the demand of the station is positive
@@ -7262,13 +7262,13 @@ class VehicleMan(am.ArrayObjman):
                                 # move the maximum possible number of available vehicles
                                 n_move = min(int(demand_to+0.5), surplus_from, int(-demand_from+0.5))
                                 if self.debug > 5:
-                                    print '        potential n_move', n_move, 'vehs from stop', id_stop_from, 'to stop', id_stop_to
+                                    print('        potential n_move', n_move, 'vehs from stop', id_stop_from, 'to stop', id_stop_to)
                                 #utilities[j] =  n_move+ self.constant_timeweight*time_to
                                 utilities[j] = float(n_move)/float(time_to)
                                 #utilities[j] =  waittime_max_to/float(time_to)
                                 numbers_move[j] = n_move
                                 if self.debug > 5:
-                                    print '         =>U=%.2f' % (utilities[j]), 'n_move', n_move, 'time_to %ds' % (time_to)
+                                    print('         =>U=%.2f' % (utilities[j]), 'n_move', n_move, 'time_to %ds' % (time_to))
 
                             elif (surplus_veh_urgent_from > 0):
                                 # we have a stop where we want to send out the maximum number of vehicles
@@ -7282,13 +7282,13 @@ class VehicleMan(am.ArrayObjman):
                                 # high balance means vehicle needs to be kicked out
 
                                 if self.debug > 5:
-                                    print '        forced potential n_move', n_move, 'vehs from stop', id_stop_from, 'to stop', id_stop_to
+                                    print('        forced potential n_move', n_move, 'vehs from stop', id_stop_from, 'to stop', id_stop_to)
                                 #utilities[j] =  n_move+ self.constant_timeweight*time_to
                                 #utilities[j] =  float(n_move)/float(time_to)
                                 utilities[j] = n_move*(demand_to)/float(time_to)
                                 numbers_move[j] = n_move
                                 if self.debug > 5:
-                                    print '         =>U=%.2f' % (utilities[j]), 'n_move', n_move, 'time_to %ds' % (time_to)
+                                    print('         =>U=%.2f' % (utilities[j]), 'n_move', n_move, 'time_to %ds' % (time_to))
 
                         j += 1
 
@@ -7306,7 +7306,7 @@ class VehicleMan(am.ArrayObjman):
                         n_move_eff = stops.route_empties(
                             id_stop_from, ids_stop[inds_sorted][ind_max], numbers_move[ind_max], simtime)
                         if self.debug > 2:
-                            print '    moved', n_move_eff, 'of', numbers_move[ind_max], 'empty vehs from', id_stop_from, 'to', ids_stop[inds_sorted][ind_max], 'utility_max', utility_max
+                            print('    moved', n_move_eff, 'of', numbers_move[ind_max], 'empty vehs from', id_stop_from, 'to', ids_stop[inds_sorted][ind_max], 'utility_max', utility_max)
 
                         # continute till balance is zero?
                         # indeed need to update balances
@@ -7336,7 +7336,7 @@ class VehicleMan(am.ArrayObjman):
         stops = self.get_stops()
         ids_stop = stops.get_ids()
         n_stops = len(ids_stop)
-        print 'equalize_empty_vehicles of  %d stops' % n_stops
+        print('equalize_empty_vehicles of  %d stops' % n_stops)
 
         balances_veh = np.zeros(n_stops, dtype=np.float32)
         demands_veh = np.zeros(n_stops, dtype=np.float32)
@@ -7363,7 +7363,7 @@ class VehicleMan(am.ArrayObjman):
             surpluses_veh[i] = surplus_veh  # this is current surplus, vehicles immediately available
             surpluses_veh_urgent[i] = surplus_veh_urgent  # number of vehicles that need to be kicked out
             if self.debug > 2:
-                print '\n  sssssssssseek destinations for id_stop', id_stop
+                print('\n  sssssssssseek destinations for id_stop', id_stop)
 
             if self.debug > 5:
                 self.display_flows_est(id_stop)
@@ -7374,10 +7374,10 @@ class VehicleMan(am.ArrayObjman):
             #balances_veh[i] = 1000.0 *surplus_veh_urgent + 1.0*surplus_veh + surplus_veh_future - n_pax_wait - n_pax_future
             balances_veh[i] = 1.0*surplus_veh + surplus_veh_future - n_pax_wait - n_pax_future
             if self.debug > 2:
-                print '    surplus_veh', surplus_veh, 'surplus_future', surplus_veh_future, 'surplus_veh_urgent', surplus_veh_urgent
-                print '    n_pax_wait ', n_pax_wait, 'n_pax_future', n_pax_future
-                print '    balance ', balances_veh[i]
-                print '    waittime_max ', waittimes_max[i]
+                print('    surplus_veh', surplus_veh, 'surplus_future', surplus_veh_future, 'surplus_veh_urgent', surplus_veh_urgent)
+                print('    n_pax_wait ', n_pax_wait, 'n_pax_future', n_pax_future)
+                print('    balance ', balances_veh[i])
+                print('    waittime_max ', waittimes_max[i])
             i += 1
 
         # sort per surpluses, because this is the most critical quantity
@@ -7386,30 +7386,30 @@ class VehicleMan(am.ArrayObjman):
         inds_sorted = np.argsort(surpluses_veh*(surpluses_veh_urgent+1))
         #surpluses_veh_emitters = surpluses_veh[inds_sorted[::-1]]
         if self.debug > 2:
-            print '  Emitters sorted:'
-            print '    ids_stop_sorted       ', ids_stop[inds_sorted[::-1]]
-            print '    surpluses_veh', surpluses_veh[inds_sorted[::-1]]
-            print '    surpluses_veh_urgent', surpluses_veh_urgent[inds_sorted[::-1]]
-
-            print '    balances_sorted       ', balances_veh[inds_sorted[::-1]]
-            print '  max(surpluses_veh)', max(surpluses_veh)
-            print '  >>>max(balances_veh)', max(balances_veh)
+            print('  Emitters sorted:')
+            print('    ids_stop_sorted       ', ids_stop[inds_sorted[::-1]])
+            print('    surpluses_veh', surpluses_veh[inds_sorted[::-1]])
+            print('    surpluses_veh_urgent', surpluses_veh_urgent[inds_sorted[::-1]])
+
+            print('    balances_sorted       ', balances_veh[inds_sorted[::-1]])
+            print('  max(surpluses_veh)', max(surpluses_veh))
+            print('  >>>max(balances_veh)', max(balances_veh))
 
         if (np.max(balances_veh) > 0) & (max(surpluses_veh) > 0):
             if self.debug > 5:
-                print '  start optimizing target', len(inds_sorted[::-1])
+                print('  start optimizing target', len(inds_sorted[::-1]))
             i = 0
             for id_stop_from, ind_from in zip(ids_stop[inds_sorted[::-1]], inds_sorted[::-1]):
                 balance_from = balances_veh[ind_from]
                 surplus_from = surpluses_veh[ind_from]
                 surplus_veh_urgent_from = surpluses_veh_urgent[ind_from]
                 demand_from = demands_veh[ind_from]
-                print '    surplus_from', surplus_from, 'balance_from', balance_from
+                print('    surplus_from', surplus_from, 'balance_from', balance_from)
                 # distribute surplus on neares, most in need
                 if (surplus_from >= 1) & (balance_from >= 1):
                     if self.debug > 5:
                         # ,'ind_from',ind_from,'continue?',(surplus_from >= 1) & (balance_from >= 1)
-                        print '\n    potential emitter stop: id_stop_from', id_stop_from, 'surplus_from', surplus_from, 'balance_from', balance_from
+                        print('\n    potential emitter stop: id_stop_from', id_stop_from, 'surplus_from', surplus_from, 'balance_from', balance_from)
                     # there are empties to send away and positive balance
                     utilities = np.zeros(n_stops, dtype=np.float32)
                     numbers_move = np.zeros(n_stops, dtype=np.int32)
@@ -7421,9 +7421,9 @@ class VehicleMan(am.ArrayObjman):
                         time_to = times_stop_to_stop[id_stop_from, id_stop_to]
 
                         if self.debug > 5:
-                            print '      id_stop_from  ', id_stop_from, 'id_stop_to', id_stop_to
-                            print '        balance_from', balance_from, 'balance_to', balance_to, 'min', -balance_to+0.5, surplus_from
-                            print '        demand_to', demand_to, 'waittime_max_to', waittime_max_to
+                            print('      id_stop_from  ', id_stop_from, 'id_stop_to', id_stop_to)
+                            print('        balance_from', balance_from, 'balance_to', balance_to, 'min', -balance_to+0.5, surplus_from)
+                            print('        demand_to', demand_to, 'waittime_max_to', waittime_max_to)
 
                         if (surplus_from >= 1) & (balance_from >= 1) & (demand_to > 0):
                             # the demand of the station is positive
@@ -7432,15 +7432,15 @@ class VehicleMan(am.ArrayObjman):
                             # move the maximum possible number of available vehicles
                             n_move = min(int(demand_to+0.5), surplus_from, int(-demand_from+0.5))
                             if self.debug > 5:
-                                print '        potential n_move', n_move, 'vehs from stop', id_stop_from, 'to stop', id_stop_to
+                                print('        potential n_move', n_move, 'vehs from stop', id_stop_from, 'to stop', id_stop_to)
                             #utilities[j] =  n_move+ self.constant_timeweight*time_to
                             #utilities[j] =  float(n_move)/float(time_to)
                             utilities[j] = (waittime_max_to*demand_to)/float(time_to)
                             numbers_move[j] = n_move
                             if self.debug > 5:
-                                print '         ********'
-                                print '         U=%.2f' % (utilities[j]), 'n_move', n_move, 'time_to %ds' % (time_to)
-                                print '         ********'
+                                print('         ********')
+                                print('         U=%.2f' % (utilities[j]), 'n_move', n_move, 'time_to %ds' % (time_to))
+                                print('         ********')
                             j += 1
 
                         elif 0:  # (surplus_veh_urgent_from> 0 ):
@@ -7455,13 +7455,13 @@ class VehicleMan(am.ArrayObjman):
                             # high balance means vehicle needs to be kicked out
 
                             if self.debug > 5:
-                                print '        forced potential n_move', n_move, 'vehs from stop', id_stop_from, 'to stop', id_stop_to
+                                print('        forced potential n_move', n_move, 'vehs from stop', id_stop_from, 'to stop', id_stop_to)
                             #utilities[j] =  n_move+ self.constant_timeweight*time_to
                             #utilities[j] =  float(n_move)/float(time_to)
                             utilities[j] = n_move*(demand_to)/float(time_to)
                             numbers_move[j] = n_move
                             if self.debug > 5:
-                                print '         U=%.2f' % (utilities[j]), 'n_move', n_move, 'time_to %ds' % (time_to)
+                                print('         U=%.2f' % (utilities[j]), 'n_move', n_move, 'time_to %ds' % (time_to))
                             j += 1
 
                     ind_max = np.argmax(utilities)
@@ -7472,14 +7472,14 @@ class VehicleMan(am.ArrayObjman):
                     # or is this done in the platoon formation?
                     n_move = min(numbers_move[ind_max], 8)
                     if self.debug > 2:
-                        print '  utility_max %.0f' % utility_max, 'ind_max', ind_max, 'n_move', n_move
+                        print('  utility_max %.0f' % utility_max, 'ind_max', ind_max, 'n_move', n_move)
                     #min(numbers_move[ind_max], self.flows_stop_max[ids_stop[inds_sorted][ind_max]])
                     if n_move > 0:
                         # there are some useful moves
                         n_move_eff = stops.route_empties(
                             id_stop_from, ids_stop[inds_sorted][ind_max], numbers_move[ind_max], simtime)
                         if self.debug > 2:
-                            print '    => moved', n_move_eff, 'of', numbers_move[ind_max], 'empty vehs from', id_stop_from, 'to', ids_stop[inds_sorted][ind_max], 'utility_max', utility_max
+                            print('    => moved', n_move_eff, 'of', numbers_move[ind_max], 'empty vehs from', id_stop_from, 'to', ids_stop[inds_sorted][ind_max], 'utility_max', utility_max)
 
                         # continute till balance is zero?
                         # indeed need to update balances
@@ -7510,8 +7510,8 @@ class VehicleMan(am.ArrayObjman):
         inds_disp = np.array(inds*factor, dtype=np.int32)
         disp[inds_disp] = self.inflows_sched[id_stop, inds]
 
-        print '%03d' % id_stop+(n_char-3)*'.'
-        print string.join(disp, '')
+        print('%03d' % id_stop+(n_char-3)*'.')
+        print(string.join(disp, ''))
 
         disp = None
         if timeind_begin is not None:
@@ -7522,7 +7522,7 @@ class VehicleMan(am.ArrayObjman):
             disp[int(timeind_end*factor+0.5)] = '<'
 
         if disp is not None:
-            print string.join(disp, '')
+            print(string.join(disp, ''))
         # print '  flows',flows
         # print '  inds',inds
         # print '  inds_disp',inds_disp
@@ -7538,7 +7538,7 @@ class VehicleMan(am.ArrayObjman):
         #                                & (stops.numbers_person_wait[self.ids_stop_current[ids_veh_lead]] == 0))
         vehicles = self.get_vehicles()
         stops = self.get_stops()
-        print 'pull_empty_leadvehs', ids_veh_lead
+        print('pull_empty_leadvehs', ids_veh_lead)
         # print '  bordingstate',vehicles.states[ids_veh_lead] == VEHICLESTATES['boarding']
         # print '  nowaits stop',stops.numbers_person_wait[self.ids_stop_current[ids_veh_lead]] ==0
 
@@ -7575,7 +7575,7 @@ class VehicleMan(am.ArrayObjman):
         ids_stop_target = self.ids_stop[inds_valid]
         demands = demands[inds_valid]
 
-        print '  ids_stop_current', ids_stop_current
+        print('  ids_stop_current', ids_stop_current)
         # print '  ids_stop_target',ids_stop_target
         # print '  demands',demands
         # calculate cost matrix with id_stop_current in rows and id_stop_target
@@ -7592,7 +7592,7 @@ class VehicleMan(am.ArrayObjman):
         costs = timeweight * demands
         for id_stop_target, demand, number_veh, number_veh_arr\
                 in zip(ids_stop_target, demands, stops.numbers_veh[ids_stop_target], self.numbers_veh_arr[ids_stop_target]):
-            print '    id_stop_target', id_stop_target, 'dem', demand, 'n_veh', number_veh, 'n_veh_arr', number_veh_arr
+            print('    id_stop_target', id_stop_target, 'dem', demand, 'n_veh', number_veh, 'n_veh_arr', number_veh_arr)
 
         #costs = np.zeros(costs.size, np.float32)-demands
 
@@ -7622,7 +7622,7 @@ class VehicleMan(am.ArrayObjman):
                     durations_est,
                 ):
 
-            print '    check veh prt.%d' % (id_veh_lead), state, 'id_stop_current', id_stop_current, 'id_stop_target', id_stop_target
+            print('    check veh prt.%d' % (id_veh_lead), state, 'id_stop_current', id_stop_current, 'id_stop_target', id_stop_target)
 
             #VEHICLESTATES = {'init':0,'waiting':1,'boarding':2,'alighting':3,'emptytrip':4,'occupiedtrip':5,'forewarding':6}
             # if state == VEHICLESTATES['occupiedtrip']:
@@ -7657,7 +7657,7 @@ class VehicleMan(am.ArrayObjman):
         Called from the stop when a vehicle in the berth initiate a trip with
         a the target destination of persons who entered
         """
-        print 'init_trip_occupied to', id_stop_to
+        print('init_trip_occupied to', id_stop_to)
         # search closest stop
         #self.are_emptytrips[id_veh] = False
 
@@ -7672,7 +7672,7 @@ class VehicleMan(am.ArrayObjman):
         Called from the stop when a vehicle in the berth initiate a trip with
         a the target destination
         """
-        print 'init_trip_empty to', id_stop_to
+        print('init_trip_empty to', id_stop_to)
 
         self.numbers_veh_target_init[id_stop_to] += 1
 
@@ -7681,7 +7681,7 @@ class VehicleMan(am.ArrayObjman):
         Called from the stop when a vehicle in the berth initiate a trip with
         a the target destination defined by the vehicle management
         """
-        print 'init_trip_empty to', id_stop_to
+        print('init_trip_empty to', id_stop_to)
 
         self.numbers_veh_target_init[id_stop_to] += 1
 
@@ -7741,7 +7741,7 @@ class HcPrtService(SimobjMixin, Demandob
         return self.parent.parent
 
     def _init_attributes(self):
-        print 'HcPrtService._init_attributes'
+        print('HcPrtService._init_attributes')
         attrsman = self.get_attrsman()
         scenario = self.get_scenario()
         # here we ged classes not vehicle type
@@ -7774,7 +7774,7 @@ class HcPrtService(SimobjMixin, Demandob
         virtualpop = self.get_scenario().demand.virtualpop
         prttransits = virtualpop.get_plans().add_stagetable('hcprttransits', HcPrtTransits)
 
-        print '  prttransits =', prttransits, id(prttransits)
+        print('  prttransits =', prttransits, id(prttransits))
         # add attribute as link
         # self.prttransits =  attrsman.add(\
         #                        cm.ObjConf(prttransits,is_child = False ),
@@ -7818,7 +7818,7 @@ class HcPrtService(SimobjMixin, Demandob
 
         Method used to sort trips when exporting to route or trip xml file
         """
-        print 'PRT.get_writexmlinfo'
+        print('PRT.get_writexmlinfo')
 
         if is_plain:
             return [], [], []
@@ -7914,14 +7914,14 @@ class HcPrtService(SimobjMixin, Demandob
     #    self.make_times_stop_to_stop()
 
     def prepare_sim(self, process):
-        print 'prepare_sim', self.ident
+        print('prepare_sim', self.ident)
         # print '  self.times_stop_to_stop',self.times_stop_to_stop
 
         if self.fstar is None:
             self.make_fstar()
 
         if self.times_stop_to_stop is None:
-            print '  times_stop_to_stop'
+            print('  times_stop_to_stop')
             self.make_times_stop_to_stop()
 
         updatedata = self.prtvehicles.prepare_sim(process)
@@ -7951,7 +7951,7 @@ class HcPrtService(SimobjMixin, Demandob
         return route, duration
 
     def make_times_stop_to_stop(self, fstar=None, times=None):
-        print 'make_times_stop_to_stop'
+        print('make_times_stop_to_stop')
         log = self.get_logger()
         if fstar is None:
             if self.fstar is None:
@@ -7977,7 +7977,7 @@ class HcPrtService(SimobjMixin, Demandob
         for id_edge, id_stop, id_ptstop in zip(ids_edge, ids_prtstop, ids_ptstop):
             # print '  Found PRT stop %d, PT stop %d with id_edge %d '%(id_stop,id_ptstop, id_edge)
             if not fstar.has_key(id_edge):
-                print 'WARNING in make_times_stop_to_stop: PRT stop %d, PT stop %d has no id_edge %d in fstar' % (id_stop, id_ptstop, id_edge)
+                print('WARNING in make_times_stop_to_stop: PRT stop %d, PT stop %d has no id_edge %d in fstar' % (id_stop, id_ptstop, id_edge))
                 is_incomplete_fstar = True
 
         # check if fstar is complete (all to edges are in keys)
@@ -7987,9 +7987,9 @@ class HcPrtService(SimobjMixin, Demandob
             if not ids_fromedge_set.issuperset(fstar[id_fromedge]):
                 is_incomplete_fstar = True
                 ids_miss = fstar[id_fromedge].difference(ids_fromedge_set)
-                print 'WARNING in make_times_stop_to_stop: incomplete fstar of id_fromedge = %d, %s' % (id_fromedge, ids_sumo[id_fromedge])
+                print('WARNING in make_times_stop_to_stop: incomplete fstar of id_fromedge = %d, %s' % (id_fromedge, ids_sumo[id_fromedge]))
                 for id_edge in ids_miss:
-                    print '  missing', id_edge, ids_sumo[id_edge]
+                    print('  missing', id_edge, ids_sumo[id_edge])
 
         if is_incomplete_fstar:
             return
@@ -8036,7 +8036,7 @@ class HcPrtService(SimobjMixin, Demandob
                         stop_to_stop[ids_edge_to_ids_prtstop[id_edge],
                                      ids_edge_to_ids_prtstop[id_edge_target]] = costs[id_edge_target]
                     else:
-                        print 'WARNING in make_times_stop_to_stop: unreacle station id_fromedge = %d, %s' % (id_edge_target, ids_sumo[id_edge_target])
+                        print('WARNING in make_times_stop_to_stop: unreacle station id_fromedge = %d, %s' % (id_edge_target, ids_sumo[id_edge_target]))
                         is_incomplete_fstar = True
 
                 # put back origin to targets (probably not the best way)
@@ -8051,7 +8051,7 @@ class HcPrtService(SimobjMixin, Demandob
 
         self.times_stop_to_stop = stop_to_stop
         self.ids_edge_to_ids_prtstop = ids_edge_to_ids_prtstop
-        print '  times_stop_to_stop=\n', self.times_stop_to_stop
+        print('  times_stop_to_stop=\n', self.times_stop_to_stop)
         return True
 
     def get_fstar(self):
@@ -8059,7 +8059,7 @@ class HcPrtService(SimobjMixin, Demandob
         Returns the forward star graph of the network as dictionary:
             fstar[id_fromedge] = set([id_toedge1, id_toedge2,...])
         """
-        print 'get_fstar'
+        print('get_fstar')
         net = self.get_scenario().net
         # prt mode
         id_mode = self.id_prtmode
@@ -8146,7 +8146,7 @@ class HcPrtService(SimobjMixin, Demandob
         return times
 
     def config_results(self, results):
-        print 'HcPrtService.config_results', results, id(results)
+        print('HcPrtService.config_results', results, id(results))
         # keep a link to results here because needed to
         # log data during simulation
         # this link should not be followed during save process
@@ -8223,8 +8223,8 @@ class HcPrtStopResults(am.ArrayObjman):
         # return self.ids_stop.get_linktab()
 
     def init_recording(self, n_timesteps, time_step):
-        print 'HC init_recording n_timesteps, time_step', n_timesteps, time_step, len(self.ids_stop.get_linktab().get_ids())
-        print '  stops instance', self.prtstops.get_value(), self.ids_stop.get_linktab(), id(self.prtstops.get_value()), id(self.ids_stop.get_linktab())
+        print('HC init_recording n_timesteps, time_step', n_timesteps, time_step, len(self.ids_stop.get_linktab().get_ids()))
+        print('  stops instance', self.prtstops.get_value(), self.ids_stop.get_linktab(), id(self.prtstops.get_value()), id(self.ids_stop.get_linktab()))
         self.clear()
 
         self.time_step.set_value(time_step)
@@ -8243,7 +8243,7 @@ class HcPrtStopResults(am.ArrayObjman):
         inds = self.ids_stop.get_linktab().get_inds(ids)
         timestep_int = int(timestep)
         for attrname, values in kwargs.iteritems():
-            print '  record', attrname, 'dtype', values.dtype, values.shape, 'array', getattr(self, attrname).get_value().dtype, 'shape', getattr(self, attrname).get_value().shape
+            print('  record', attrname, 'dtype', values.dtype, values.shape, 'array', getattr(self, attrname).get_value().dtype, 'shape', getattr(self, attrname).get_value().shape)
             # print '    inds',type(inds),inds.dtype,
             getattr(self, attrname).get_value()[inds, timestep_int] = values
 
--- a/tools/contributed/sumopy/plugins/hcprt/results_mpl.py
+++ b/tools/contributed/sumopy/plugins/hcprt/results_mpl.py
@@ -42,11 +42,11 @@ class StopresultsPlotter(Process):
         self._init_common('stopresultsplotter', parent=results, name=name,
                           info=info, logger=logger)
 
-        print 'StopresultsPlotter.__init__', results, self.parent, len(self.get_stopresults())
+        print('StopresultsPlotter.__init__', results, self.parent, len(self.get_stopresults()))
         attrsman = self.get_attrsman()
 
         stops = self.get_stopresults().get_prtstops()
-        print '  prtstops', stops, len(stops), id(stops), self.get_stopresults().ids_stop.get_linktab(), id(self.get_stopresults().ids_stop.get_linktab())
+        print('  prtstops', stops, len(stops), id(stops), self.get_stopresults().ids_stop.get_linktab(), id(self.get_stopresults().ids_stop.get_linktab()))
         choices_stop = {}
         for id_stop in stops.get_ids():
             choices_stop[str(id_stop)] = id_stop
@@ -131,10 +131,10 @@ class StopresultsPlotter(Process):
 
     def show(self):
         stopresults = self.get_stopresults()
-        print 'show', stopresults
+        print('show', stopresults)
         # print '  dir(vehicleman)',dir(vehicleman)
 
-        print '  len(stopresults)', len(stopresults)
+        print('  len(stopresults)', len(stopresults))
         if len(stopresults) > 0:
             i_fig = 0
             plt.close("all")
@@ -166,7 +166,7 @@ class StopresultsPlotter(Process):
             plt.show()
 
     def plot_flow_stop(self, fig):
-        print 'plot_flow_stop'
+        print('plot_flow_stop')
         id_stop = self.id_stop_plot
         stopresults = self.get_stopresults()
         ax = fig.add_subplot(111)
@@ -224,7 +224,7 @@ class StopresultsPlotter(Process):
         ax.tick_params(axis='y', labelsize=int(0.8*self.size_labelfont))
 
     def plot_waiting_person_time(self, fig):
-        print 'plot_waiting_person_time'
+        print('plot_waiting_person_time')
         stopresults = self.get_stopresults()
         ax = fig.add_subplot(111)
 
@@ -251,7 +251,7 @@ class StopresultsPlotter(Process):
         ax.tick_params(axis='y', labelsize=int(0.8*self.size_labelfont))
 
     def plot_waiting_person_number_stop(self, fig):
-        print 'plot_waiting_person_number_stop'
+        print('plot_waiting_person_number_stop')
         stopresults = self.get_stopresults()
         #ax1 = fig.add_subplot(211)
         #ax2 = fig.add_subplot(212)
@@ -275,7 +275,7 @@ class StopresultsPlotter(Process):
         ax.tick_params(axis='y', labelsize=int(0.8*self.size_labelfont))
 
     def plot_waiting_person_number(self, fig):
-        print 'plot_waiting_person_number'
+        print('plot_waiting_person_number')
         stopresults = self.get_stopresults()
         #ax1 = fig.add_subplot(211)
         #ax2 = fig.add_subplot(212)
@@ -288,7 +288,7 @@ class StopresultsPlotter(Process):
         # works:ax.plot(time.reshape(n_steps,1),numbers_person_wait.reshape(n_steps,-1))
         i = 0
         for id_stop in stopresults.ids_stop.get_value():
-            print '  id_stop', id_stop
+            print('  id_stop', id_stop)
             ax.plot(time, stopresults.numbers_person_wait[id_stop],
                     get_color(i), linewidth=self.width_line,
                     label='PRT Stop ID=%d' % id_stop)
@@ -302,7 +302,7 @@ class StopresultsPlotter(Process):
         ax.tick_params(axis='y', labelsize=int(0.8*self.size_labelfont))
 
     def plot_flows_compare(self, fig):
-        print 'plot_flows_compare'
+        print('plot_flows_compare')
         stopresults = self.get_stopresults()
         #time_update_flows = self.parent.vehicleman.time_update_flows.get_value()
         time_update_flows = 10
@@ -315,7 +315,7 @@ class StopresultsPlotter(Process):
         i = 0
         flowmatrix = np.zeros((10, 10), dtype=np.int32)
         for id_stop in stopresults.ids_stop.get_value():
-            print '    id_stop', id_stop
+            print('    id_stop', id_stop)
             # print '      sched',stopresults.inflows_veh_sched[id_stop]
             # print '      eff  ',stopresults.inflows_veh[id_stop]
             flowmatrix[np.array(time_update_flows*stopresults.inflows_veh_sched[id_stop], dtype=np.int32),
@@ -325,7 +325,7 @@ class StopresultsPlotter(Process):
             #        label = 'PRT Stop ID=%d (effective)'%id_stop)
 
             i += 1
-        print 'flowmatrix', flowmatrix
+        print('flowmatrix', flowmatrix)
         # ax.matshow(flowmatrix)
 
         cax = ax.matshow(flowmatrix, cmap=cmx.get_cmap('PuBu'))
@@ -338,7 +338,7 @@ class StopresultsPlotter(Process):
         ax.tick_params(axis='y', labelsize=int(0.8*self.size_labelfont))
 
     def plot_flows_compare_stop(self, fig):
-        print 'plot_flows_compare_stop'
+        print('plot_flows_compare_stop')
         stopresults = self.get_stopresults()
         id_stop = self.id_stop_plot
         #time_update_flows = self.parent.vehicleman.time_update_flows.get_value()
@@ -358,7 +358,7 @@ class StopresultsPlotter(Process):
 
         time = np.arange(-n_steps+1, n_steps, dtype=np.float32)*t_step
 
-        print '    len(flowcorr),n_steps', len(flowcorr), len(time), n_steps
+        print('    len(flowcorr),n_steps', len(flowcorr), len(time), n_steps)
 
         ax.plot(time, flowcorr,
                 get_color(i), linewidth=self.width_line,
@@ -372,7 +372,7 @@ class StopresultsPlotter(Process):
         ax.tick_params(axis='y', labelsize=int(0.8*self.size_labelfont))
 
     def plot_flows(self, fig):
-        print 'plot_flows'
+        print('plot_flows')
         stopresults = self.get_stopresults()
         ax = fig.add_subplot(111)
 
@@ -408,7 +408,7 @@ class StopresultsPlotter(Process):
         #        ('inflows_person', {'name':'Person in-flows', 'unit':'1/s', 'dtype':np.float32, 'info':'Person flow into the stop over time.'}),
 
     def plot_waiting_person(self, fig):
-        print 'plot_waiting_person'
+        print('plot_waiting_person')
         stopresults = self.get_stopresults()
         ax1 = fig.add_subplot(211)
         ax2 = fig.add_subplot(212)
--- a/tools/contributed/sumopy/plugins/hcprt/wxgui.py
+++ b/tools/contributed/sumopy/plugins/hcprt/wxgui.py
@@ -34,7 +34,7 @@ try:
     import results_mpl as results_mpl
     is_mpl = True  # we have matplotlib support
 except:
-    print "WARNING: python matplotlib package not installed, no matplotlib plots."
+    print("WARNING: python matplotlib package not installed, no matplotlib plots.")
     is_mpl = False
 
 
@@ -91,7 +91,7 @@ class WxGui(ModuleGui):
         dependent on the availability of data. 
         """
         scenario = self.get_scenario()
-        print 'prtgui.refresh_widgets', self._simulation != scenario.simulation
+        print('prtgui.refresh_widgets', self._simulation != scenario.simulation)
 
         is_refresh = False
         if self._simulation != scenario.simulation:
@@ -214,7 +214,7 @@ class WxGui(ModuleGui):
         self._mainframe.browse_obj(self._prtservice.prtvehicles)
 
     def on_mpl_stopresults(self, event=None):
-        print 'on_mpl_stopresults', id(self._simulation.results)  # ,id(self._prtservice.get_results())
+        print('on_mpl_stopresults', id(self._simulation.results))  # ,id(self._prtservice.get_results())
         if self._prtservice is not None:
             if self._simulation is not None:
                 resultplotter = results_mpl.StopresultsPlotter(self._simulation.results,  # self._prtservice.get_results(),
--- a/tools/contributed/sumopy/plugins/mapmatching/__init__.py
+++ b/tools/contributed/sumopy/plugins/mapmatching/__init__.py
@@ -18,7 +18,7 @@
 
 __version__ = "0.0"
 
-print 'init', __name__
+print('init', __name__)
 
 
 def get_wxgui():
--- a/tools/contributed/sumopy/plugins/mapmatching/mapmatching.py
+++ b/tools/contributed/sumopy/plugins/mapmatching/mapmatching.py
@@ -71,12 +71,12 @@ try:
         from shapely.geometry import Polygon, MultiPolygon, MultiLineString, Point, LineString, MultiPoint, asLineString, asMultiPoint
         from shapely.ops import cascaded_union
     except:
-        print 'Import error: No shapely module available.'
+        print('Import error: No shapely module available.')
 except:
-    print 'Import error: in order to run the traces plugin please install the following modules:'
-    print '   mpl_toolkits.basemap and shapely'
-    print 'Please install these modules if you want to use it.'
-    print __doc__
+    print('Import error: in order to run the traces plugin please install the following modules:')
+    print('   mpl_toolkits.basemap and shapely')
+    print('Please install these modules if you want to use it.')
+    print(__doc__)
     raise
 
 AGES_STRAVA = {'unknown':0,
@@ -409,7 +409,7 @@ def get_boundary(coords):
        
 class OdCreator(Process):
     def __init__(self, ident, mapmatching, logger = None, **kwargs):
-        print 'VpCreator.__init__'
+        print('VpCreator.__init__')
         self._init_common(  ident, 
                             parent = mapmatching,
                             name = 'Od routes creator from GPS trips', 
@@ -484,7 +484,7 @@ class OdCreator(Process):
                                      info='transport mode of the flow.',
                                      ))   
     def do(self):
-        print 'OdCreator.__do__'
+        print('OdCreator.__do__')
         #Preparation
         logger = self.get_logger()
         scenario = self.get_scenario()
@@ -519,7 +519,7 @@ class OdCreator(Process):
                    to_zone[id_trip] = id_zone
                    analyzedtrips += 0.5 
                    break      
-            print analyzedtrips
+            print(analyzedtrips)
         i = 0
         j= 0
         for id_zonei in ids_zone:
@@ -532,7 +532,7 @@ class OdCreator(Process):
             j = 0
 
         n_trip = np.sum(od_matrix) 
-        print ' number of trips', n_trip
+        print(' number of trips', n_trip)
         generated = np.zeros(len(od_matrix[0,:]))
         attracted  = np.zeros(len(od_matrix[:,0]))
         
@@ -563,8 +563,8 @@ class OdCreator(Process):
             
            
         re_allocates = generated - attracted
-        print 'generated',generated, 'attracted',attracted, 're_allocates', re_allocates
-        print 'od_matrix',od_matrix
+        print('generated',generated, 'attracted',attracted, 're_allocates', re_allocates)
+        print('od_matrix',od_matrix)
         np.savetxt('od_matrix.csv', od_matrix)
 
         return od_matrix, generated, attracted, re_allocates                     
@@ -577,7 +577,7 @@ class OdCreator(Process):
                        
 class OdRouteCreator(Process):
     def __init__(self, ident, mapmatching, logger = None, **kwargs):
-        print 'OdRouteCreator.__init__'
+        print('OdRouteCreator.__init__')
         self._init_common(  ident, 
                             parent = mapmatching,
                             name = 'Od routes creator from GPS trips', 
@@ -589,7 +589,7 @@ class OdRouteCreator(Process):
 
   
     def do(self):
-        print 'OdRouteCreator.__do__'
+        print('OdRouteCreator.__do__')
         #Preparation
         logger = self.get_logger()
         scenario = self.get_scenario()
@@ -603,7 +603,7 @@ class OdRouteCreator(Process):
         ids_trip = trips.get_ids()
         ids_trip = ids_trip[trips.are_selected[ids_trip] & np.logical_not(np.equal(trips.ids_points[ids_trip],None))]
         n_trips = len(ids_trip)
-        print '  len(ids_trip)',n_trips
+        print('  len(ids_trip)',n_trips)
 
         trips_demand.clear_trips()
         trips_demand.clear_routes()
@@ -643,7 +643,7 @@ class OdRouteCreator(Process):
                                                              
 class VpCreator(Process):
     def __init__(self, ident='vpcreator', mapmatching=None, logger = None, **kwargs):
-        print 'VpCreator.__init__'
+        print('VpCreator.__init__')
         self._init_common(  ident, 
                             parent = mapmatching,
                             name = 'VP creator from GPS trips', 
@@ -795,7 +795,7 @@ class VpCreator(Process):
         
                                                            
     def do(self):
-        print 'VpCreator.__do__'
+        print('VpCreator.__do__')
         #Preparation
         logger = self.get_logger()
         scenario = self.get_scenario()
@@ -831,8 +831,8 @@ class VpCreator(Process):
 
         persons = scenario.demand.mapmatching.persons
         persons.analyze()
-        print 'id_strategy =',self.id_strategy
-        print 'is_first_method =',self.is_first_method
+        print('id_strategy =',self.id_strategy)
+        print('is_first_method =',self.is_first_method)
         #select strategy
         if self.is_first_method == True:
             if self.id_strategy == -1:
@@ -843,7 +843,7 @@ class VpCreator(Process):
                 ids_trip = ids_trip_bike
                 ids_trip = np.append(ids_trip,ids_trip_bus)
                 ids_trip = np.append(ids_trip,ids_trip_ped)
-                print 'ids_trip =',ids_trip
+                print('ids_trip =',ids_trip)
                 # ids_trip = ids_trip_bike + ids_trip_ped + ids_trip_bus
             if self.id_strategy == strategies.get_id_from_formatted('walk'):
                 ids_trip_ped = ids_trip[(ids_mode == modes.get_id_from_formatted('pedestrian'))]
@@ -912,9 +912,9 @@ class VpCreator(Process):
                                 
                 if self.is_first_method == True:
                     n_pers = int(n_pers*(float(self.scale - count))) #scale parameter based on people number
-                    print 'new n_pers = ',n_pers
+                    print('new n_pers = ',n_pers)
                     
-                    print 'old ids_trip = ',ids_trip
+                    print('old ids_trip = ',ids_trip)
                     
                     if self.id_strategy == -1:
                         ids_trip = np.array([],dtype = np.int32)
@@ -947,14 +947,14 @@ class VpCreator(Process):
                     #ids_trip = np.random.choice(ids_trip, n_pers, replace = False)
                     #ids_trip.sort()
                     
-                    print 'new ids_trip = ',ids_trip
+                    print('new ids_trip = ',ids_trip)
                     
                     
                 elif self.is_first_method == False:
                     n_trips_tab = int(n_trips_for_scale*(float(self.scale - count))) # scale parameter based on trips number
-                    print 'new n_pers = ',n_pers
+                    print('new n_pers = ',n_pers)
                     
-                    print 'old ids_pers = ',ids_pers
+                    print('old ids_pers = ',ids_pers)
                     
                     if self.id_strategy == -1:
                         
@@ -1003,13 +1003,13 @@ class VpCreator(Process):
                     #ids_pers = np.random.choice(ids_pers, n_pers, replace = False)
                     #ids_pers.sort()
                     
-                    print 'new ids_pers = ',ids_pers
+                    print('new ids_pers = ',ids_pers)
             elif count == max(range(int(self.scale + 1.0))) and difference == 0.0:
                 break
                     
             if self.is_first_method == True:
                 #create virtual person
-                print 'create virtal person'
+                print('create virtal person')
                 ids_person = virtualpop.make_multiple(n_pers)
                 
       ##        localtime = time.localtime
@@ -1052,9 +1052,9 @@ class VpCreator(Process):
 
             elif self.is_first_method == False:
                 #create virtual person
-                print 'create virtal person'
+                print('create virtal person')
                 ids_vppers = virtualpop.make_multiple(n_pers)
-                print 'ids_vppers',ids_vppers
+                print('ids_vppers',ids_vppers)
                 pers_vppers = np.zeros(np.max(ids_pers)+1, dtype = np.int32)
         ##        pers_vppers = []
                 for pers, vppers in zip(ids_pers, ids_vppers):
@@ -1064,7 +1064,7 @@ class VpCreator(Process):
                 
                 for id_pers, id_vppers, ids_trip  in zip(ids_pers, ids_vppers, ids_trips):
                     #Population attributes
-                    print 'Add population attributes'
+                    print('Add population attributes')
                     ids_mode = scenario.demand.vtypes.ids_mode[trips.ids_vtype[ids_trip]]
                     id_preferred_mode = np.argmax(np.bincount(ids_mode))
                     virtualpop.ids_mode_preferred[id_vppers] = id_preferred_mode 
@@ -1074,7 +1074,7 @@ class VpCreator(Process):
                     virtualpop.identifications[id_vppers] = persons.ids_sumo[id_pers] 
                 
             #Calculate trips departure and arrive times
-            print 'Calculate trips departure and arrive times'
+            print('Calculate trips departure and arrive times')
 
             if self.id_strategy == strategies.get_id_from_formatted('bike') or self.id_strategy == -1:            
                 seconds_departure_bike = np.zeros(len(ids_trip_bike), dtype = np.float32)
@@ -1104,12 +1104,12 @@ class VpCreator(Process):
                         seconds_arrive_bike[i] = seconds_departure_bike[i] + duration_for_scale_bike[i]
 
                     i+=1
-                print '  min_seconds_departure_bike: ',min_seconds_departure_bike
-                print '  max_seconds_arrive_bike: ',max_seconds_departure_bike
+                print('  min_seconds_departure_bike: ',min_seconds_departure_bike)
+                print('  max_seconds_arrive_bike: ',max_seconds_departure_bike)
                 print
-                print '  ids_trip_bike: ',ids_trip_bike
+                print('  ids_trip_bike: ',ids_trip_bike)
                 print
-                print '  seconds_departure_bike: ', seconds_departure_bike
+                print('  seconds_departure_bike: ', seconds_departure_bike)
                 print
                 
 
@@ -1144,7 +1144,7 @@ class VpCreator(Process):
 
                     i+=1
 
-                print seconds_departure_bus, seconds_arrive_bus
+                print(seconds_departure_bus, seconds_arrive_bus)
             
             if self.id_strategy == strategies.get_id_from_formatted('walk') or self.id_strategy == -1:   
                 seconds_departure_ped = np.zeros(len(ids_trip_ped), dtype = np.float32)
@@ -1177,7 +1177,7 @@ class VpCreator(Process):
                     i+=1
 
 
-                print seconds_departure_ped, seconds_arrive_ped
+                print(seconds_departure_ped, seconds_arrive_ped)
 
 
             # call Vehicle provider to give vehicles to persons
@@ -1211,10 +1211,10 @@ class VpCreator(Process):
             fstar = net.edges.get_fstar()
             
             #Preapare parameters for stages
-            print 'Preapare parameters for stages'
+            print('Preapare parameters for stages')
             
             #bus
-            print 'Preapare parameters for BUS plans'
+            print('Preapare parameters for BUS plans')
             if self.id_strategy == strategies.get_id_from_formatted('transit') or self.id_strategy == -1:
                 times_from_bus = seconds_departure_bus
                 durations_approx_bus = seconds_arrive_bus - seconds_departure_bus 
@@ -1261,13 +1261,13 @@ class VpCreator(Process):
                     
         ##        ids_route = trips.ids_route_matched[ids_trip]
                 #Identify closest edge for facilities
-                print 'Identify closest edge for facilities from'
+                print('Identify closest edge for facilities from')
                 facilities.identify_closest_edge(ids = ids_fac_from_bus, priority_max = 7, has_sidewalk = True)
-                print 'Identify closest edge for facilities to'
+                print('Identify closest edge for facilities to')
                 facilities.identify_closest_edge(ids = ids_fac_to_bus, priority_max = 7, has_sidewalk = True)
             
             #bike
-            print 'Preapare parameters for BIKE plans'
+            print('Preapare parameters for BIKE plans')
             
             if self.id_strategy == strategies.get_id_from_formatted('bike') or self.id_strategy == -1:
                 times_from_bike = seconds_departure_bike
@@ -1325,16 +1325,16 @@ class VpCreator(Process):
                     ids_fac_to_bike[i] = int(distance_fac_list_to[0,1])
                     i+=1
 
-                print 'ids_only_bike_trip', ids_only_bike_trip
+                print('ids_only_bike_trip', ids_only_bike_trip)
                 ##        ids_route = trips.ids_route_matched[ids_trip]
                 #Identify closest edge for facilities
-                print 'Identify closest edge for facilities from'
+                print('Identify closest edge for facilities from')
                 facilities.identify_closest_edge(ids = ids_fac_from_bike, priority_max = 7, has_sidewalk = True)
-                print 'Identify closest edge for facilities to'
+                print('Identify closest edge for facilities to')
                 facilities.identify_closest_edge(ids = ids_fac_to_bike, priority_max = 7, has_sidewalk = True)
     
             #pedestrian
-            print 'Preapare parameters for PEDESTRIAN plans'
+            print('Preapare parameters for PEDESTRIAN plans')
             
             if self.id_strategy == strategies.get_id_from_formatted('walk') or self.id_strategy == -1:
                 times_from_ped = seconds_departure_ped
@@ -1374,7 +1374,7 @@ class VpCreator(Process):
                 available_strategies.append(strategies.get_id_from_formatted('transit'))  
                 
             for strategy in available_strategies:
-                print 'init strategy', strategy
+                print('init strategy', strategy)
     
                 
                 if strategy == strategies.get_id_from_formatted('bike'):
@@ -1404,7 +1404,7 @@ class VpCreator(Process):
                                     
                 
                 #walk1
-                print 'Prepare parameters for Walk1'
+                print('Prepare parameters for Walk1')
     
                 ids_edge_from_walk1 =  facilities.ids_roadedge_closest[ids_fac_from]
                 positions_edge_from_walk1 = facilities.positions_roadedge_closest[ids_fac_from]
@@ -1424,7 +1424,7 @@ class VpCreator(Process):
                     ids_edge_to_walk1 = facilities.ids_roadedge_closest[ids_fac_to]
                 if strategy == strategies.get_id_from_formatted('transit') or strategy == strategies.get_id_from_formatted('bike'):
                     #walk2
-                    print 'Prepare parameters for Walk2'
+                    print('Prepare parameters for Walk2')
         
                     times_from_walk2 = seconds_arrive +1.-1.
             
@@ -1437,9 +1437,9 @@ class VpCreator(Process):
                         ids_edge_from_walk2 = ids_edge_to_busstop
                         positions_edge_from_walk2 = positions_edge_to_busstop
                 
-                print seconds_arrive  
+                print(seconds_arrive  )
                 #act1 
-                print 'Prepare parameters for Act1'
+                print('Prepare parameters for Act1')
                 
                 unitvec_int_act = np.ones(n_trips)
                 ids_edge_from_act1 = facilities.ids_roadedge_closest[ids_fac_from]
@@ -1449,7 +1449,7 @@ class VpCreator(Process):
                 times_from_act1 = seconds_departure-3600.0
              
                 #act2
-                print 'Prepare parameters for Act2'
+                print('Prepare parameters for Act2')
                 
                 ids_edge_to_act2 = facilities.ids_roadedge_closest[ids_fac_to]
                 positions_edge_to = facilities.positions_roadedge_closest[ids_fac_to]                  
@@ -1458,7 +1458,7 @@ class VpCreator(Process):
                 durations_act_to = np.ones(n_trips)*3600.0               
                         
             #Add activities 
-            print 'Add activities '
+            print('Add activities ')
     ##        ids_fac_from = ids_facilities[ids_fac_from]
     ##        ids_fac_to = ids_facilities[ids_fac_to]
             
@@ -1485,7 +1485,7 @@ class VpCreator(Process):
                     virtualpop.activitypatterns[id_person] = [id_activity_from,id_activity_to, ]
 
                 #Create plans
-                print 'Create plans'
+                print('Create plans')
                 ids_plan = virtualpop.add_plans(ids_person, strategy)
 
             # QUESTO METODO POTREBBE ESSERE VALIDO ANCHE PER VPCREATOR1???
@@ -1493,18 +1493,18 @@ class VpCreator(Process):
                 for id_person,id_activity_from,id_activity_to in zip(ids_person,ids_activity_from,ids_activity_to):
                     if virtualpop.activitypatterns[id_person] is not None:
                               patterns = virtualpop.activitypatterns[id_person]
-                              print 'patterns', patterns
+                              print('patterns', patterns)
                               patterns.append(id_activity_from)
-                              print 'patterns', patterns
+                              print('patterns', patterns)
                               patterns.append(id_activity_to)
-                              print 'patterns', patterns
+                              print('patterns', patterns)
                               virtualpop.activitypatterns[id_person] = patterns
-                              print 'patterns', patterns
+                              print('patterns', patterns)
                     else:
                               virtualpop.activitypatterns[id_person] = [id_activity_from, id_activity_to]
 
                 #Create plans
-                print 'Create plans'
+                print('Create plans')
                 if strategy == strategies.get_id_from_formatted('transit') or strategy ==strategies.get_id_from_formatted('bike'):
                     ids_plan = virtualpop.add_plans(ids_person, strategy)
                 elif strategy == strategies.get_id_from_formatted('walk'):
@@ -1515,7 +1515,7 @@ class VpCreator(Process):
 
             
             #Add activity stages
-            print 'Add activity stages'
+            print('Add activity stages')
         
             for id_plan,\
                 id_act_from,\
@@ -1542,7 +1542,7 @@ class VpCreator(Process):
                                                         )       
                
             #Add walk stages
-            print 'Add walk stages'
+            print('Add walk stages')
             ids_walk1 = np.zeros(len(ids_trip), dtype = np.int32)
             times_end_walk1 = np.zeros(len(ids_trip), dtype = np.int32)
 
@@ -1566,7 +1566,7 @@ class VpCreator(Process):
                     try:
                         ids_only_bike_trip.index(id_pers) 
                     except:
-                        print 'plan first walk'
+                        print('plan first walk')
                         ids_walk1[i] , times_end_walk1[i] = virtualpop.get_plans().get_stagetable('walks').append_stage(\
                                                     id_plan, time_from, 
                                                     id_edge_from = id_edge_from, 
@@ -1606,7 +1606,7 @@ class VpCreator(Process):
                     try:
                         ids_only_bike_trip.index(id_trip) 
                     except:
-                        print 'plan first walk'
+                        print('plan first walk')
                         ids_walk1[i] , times_end_walk1[i] = virtualpop.get_plans().get_stagetable('walks').append_stage(\
                                                     id_plan, time_from, 
                                                     id_edge_from = id_edge_from, 
@@ -1619,7 +1619,7 @@ class VpCreator(Process):
                 for time_end,  second_departure, i in zip(times_end_walk1, seconds_departure, range(len(ids_trip))) :
                     if time_end !=0:
                         durations_walk1[i] = virtualpop.get_plans().get_stagetable('walks').durations[ids_walk1[i]]
-                print seconds_departure, durations_walk1
+                print(seconds_departure, durations_walk1)
                 
                 if strategy ==strategies.get_id_from_formatted('bike'):
                     #bike
@@ -1630,7 +1630,7 @@ class VpCreator(Process):
 
             if strat_for_stages == strategies.get_id_from_formatted('bike'):
                 #Add bikeride stages
-                print 'Add bikeride stages'
+                print('Add bikeride stages')
                 ##        virtualpop.get_plans().get_stagetable('bikeride').prepare_planning()
                 ##        duration_approx1, route1 = routing.get_mincostroute_edge2edge(
                 ##                                                    ids_edge_from_bike,
@@ -1674,7 +1674,7 @@ class VpCreator(Process):
             if strat_for_stages == strategies.get_id_from_formatted('transit'):
 
                 #Add bus stages
-                print 'Add bus stages'
+                print('Add bus stages')
                 ids_route = trips.ids_route_matched[ids_trip]
                 ids_ptlinks = trips.get_routes().ids_ptlinks[ids_route]
                 for id_route, id_plan, time_from_bus, i in zip(ids_route, ids_plan,times_from_bus, range(len(ids_trip))):
@@ -1705,7 +1705,7 @@ class VpCreator(Process):
                             duration = scenario.demand.ptlines.get_ptlinks().durations[id_ptlink]
                             id_fromstop = scenario.demand.ptlines.get_ptlinks().ids_fromstop[id_ptlink]
                             numb_links = j
-                            print i, scenario.demand.ptlines.get_ptlinks().types[ids_ptlinks[numb_links+1]]
+                            print(i, scenario.demand.ptlines.get_ptlinks().types[ids_ptlinks[numb_links+1]])
                             is_ok = True
                             if numb_links+2<len(ids_ptlinks):
                                 while (scenario.demand.ptlines.get_ptlinks().types[ids_ptlinks[numb_links+1]] == 2)and(is_ok == True):
@@ -1737,7 +1737,7 @@ class VpCreator(Process):
                                 id_fromedge = id_edge_from,
                                 id_toedge = id_edge_to, 
                                 ) 
-                            print  '2',times_from_bus, end_time ,  time_from    
+                            print( '2',times_from_bus, end_time ,  time_from    )
                             time_from_bus  += (end_time-time_from)
                             times_from_bus[i] = time_from_bus
                             board = 1
@@ -1757,14 +1757,14 @@ class VpCreator(Process):
                                                                     id_edge_to = id_edge_to, 
                                                                     position_edge_to = position_edge_to,
                                                                     )
-                            print  '3',times_from_bus, end_time ,  time_from                                     
+                            print( '3',times_from_bus, end_time ,  time_from                                     )
                             time_from_bus  += (end_time-time_from)
                             times_from_bus[i] = time_from_bus
                             board = 0
     
                     
             #Add walk stages
-            print 'Add walk stages'
+            print('Add walk stages')
             
             if self.is_first_method == True:
                 ids_walk2 = np.zeros(len(ids_trip), dtype = np.int32)
@@ -1847,9 +1847,9 @@ class VpCreator(Process):
                 if strat_for_stages ==strategies.get_id_from_formatted('transit'):
                     durations_walk2 = times_end_walk2-times_from_bus
                     times_from_act2 = times_from_bus + durations_walk2+ durations_walk1
-            print 'durations_walk1',durations_walk1,'durations_walk2',durations_walk2, 'seconds_arrive', seconds_arrive, 'seconds_departure', seconds_departure
+            print('durations_walk1',durations_walk1,'durations_walk2',durations_walk2, 'seconds_arrive', seconds_arrive, 'seconds_departure', seconds_departure)
             #Add activity stages
-            print 'Add activity stages'
+            print('Add activity stages')
     
             for id_plan,\
                 id_act_to,\
@@ -1899,7 +1899,7 @@ class VpCreator(Process):
                                                                                         
 class BirgilMatcher(Process):
     def __init__(self, ident = 'birgilmatcher', parent = None,  logger = None, **kwargs):
-        print 'BirgilMatcher.__init__'
+        print('BirgilMatcher.__init__')
         
         # TODO: let this be independent, link to it or child??
        
@@ -2103,11 +2103,11 @@ class BirgilMatcher(Process):
                                                 )
                 else:
                     logger.w("  Failed id_trip %d because pedestrian mode or id_mode %d does not occured in network"%(id_trip,id_mode)) 
-                    print '  distancesmap.keys()',distancesmap.keys()
+                    print('  distancesmap.keys()',distancesmap.keys())
                     
             else:
                 logger.w("  Failed id_trip %d because no points"%(id_trip)) 
-                print '  ids_point',ids_point
+                print('  ids_point',ids_point)
                 
             n_trip_matched += 1
             
@@ -2133,8 +2133,8 @@ class BirgilMatcher(Process):
         # triplength
         
         # TODO: check get_closest_edge everywhere if projecting properly
-        print 79*'='
-        print 'match_trip_birgil',id_trip,'n_points=',len(ids_point)
+        print(79*'=')
+        print('match_trip_birgil',id_trip,'n_points=',len(ids_point))
         #print '  ids_point',ids_point
         #print '  weights[26216]',weights[26216],accesslevels[26216]
         #print '  weights[26217]',weights[26217],accesslevels[26217]
@@ -2773,7 +2773,7 @@ class BirgilMatcher(Process):
     
 class PTMatcher(BirgilMatcher):
     def __init__(self, ident, mapmatching,  logger = None, **kwargs):
-        print 'PTMatcher.__init__'
+        print('PTMatcher.__init__')
         
         # TODO: let this be independent, link to it or child??
        
@@ -2959,7 +2959,7 @@ class PTMatcher(BirgilMatcher):
         fstar = ptlinks.get_fstar()
         
         if len(fstar) == 0:
-            print 'WARNING: no PT links built.'
+            print('WARNING: no PT links built.')
             return False
         
         ids_trip = trips.get_ids_selected()
@@ -3025,8 +3025,8 @@ class PTMatcher(BirgilMatcher):
     
     def match_trip(self,id_trip,  ids_point, ptfstar, ptstops, ptlines, busdistances, busedgetimes, accesslevels):
 
-        print 79*'='
-        print 'match_trip',id_trip,'n_points=',len(ids_point)
+        print(79*'=')
+        print('match_trip',id_trip,'n_points=',len(ids_point))
         tick = time.time()
         routes = []
         route = None
@@ -3069,8 +3069,8 @@ class PTMatcher(BirgilMatcher):
         
         ids_stop = ptstops.get_ids()
         coords_stop = ptstops.centroids[ids_stop][:,:2]
-        print '       len(ids_stop)',len(ids_stop)
-        print '       coords_stop.shape',coords_stop.shape
+        print('       len(ids_stop)',len(ids_stop))
+        print('       coords_stop.shape',coords_stop.shape)
         
         
         # map stop IDs to PT link IDs with specific type
@@ -3108,7 +3108,7 @@ class PTMatcher(BirgilMatcher):
         t_point_initial = -1
         t_point_final = -1
         
-        print '  search initial stops'
+        print('  search initial stops')
         ind_point = 0
         for p in coords:
             dists2 = np.sum((coords_stop-p)**2,1)
@@ -3149,7 +3149,7 @@ class PTMatcher(BirgilMatcher):
                 if map_id_fromstop_to_ids_link.has_key(id_stop):
                     ids_stop_initial.append(id_stop) 
         else:
-            print 'ABOARD: no initial stop found' 
+            print('ABOARD: no initial stop found' )
             return [], [], 0.0, 0.0,-1.0,-1.0, -1.0, -1.0, 0.0, [], False
             
         if ind_hit_final > -1:
@@ -3161,7 +3161,7 @@ class PTMatcher(BirgilMatcher):
                     
 
         else:
-            print 'ABOARD: no final stop found' 
+            print('ABOARD: no final stop found' )
             return [], [], 0.0, 0.0,-1.0,-1.0, -1.0, -1.0, 0.0, [], False
         
         n_points_eff = ind_point_final - ind_point_initial
@@ -3170,18 +3170,18 @@ class PTMatcher(BirgilMatcher):
         
         #if self._logger:
         #    self._logger.w( '>>match_trip_birgil : n_points_eff=%d, len(ids_edge_initial)=%d,len(ids_edge_final)=%d'%(n_points_eff, len(ids_edge_initial),len(ids_edge_final)) )
-        print '\n  completed init:'
-        print '   ids_stop_initial',ids_stop_initial
-        print '   ids_stop_final',ids_stop_final
+        print('\n  completed init:')
+        print('   ids_stop_initial',ids_stop_initial)
+        print('   ids_stop_final',ids_stop_final)
         
         #print '  ind_point_initial,ind_point_final,n_points_eff',ind_point_initial,ind_point_final,n_points_eff
-        print '  id_point_initial=%d,id_point_final=%d,n_points_eff=%d'%(ids_point[ind_point_initial],ids_point[ind_point_final],n_points_eff)
+        print('  id_point_initial=%d,id_point_final=%d,n_points_eff=%d'%(ids_point[ind_point_initial],ids_point[ind_point_final],n_points_eff))
         if (ind_point_initial<0)|(ind_point_final<0) | (n_points_eff < self.n_points_min):
-            print 'ABOARD: insufficient valid points' 
+            print('ABOARD: insufficient valid points' )
             return [], [], 0.0, 0.0,-1.0,-1.0, -1.0, -1.0, 0.0, [], False
         
 
-        print '  define initial and final pt links'
+        print('  define initial and final pt links')
         
         ids_ptlink_initial = set()
         for id_stop  in ids_stop_initial:
@@ -3191,8 +3191,8 @@ class PTMatcher(BirgilMatcher):
         for id_stop  in ids_stop_final:
             ids_ptlink_final.update(map_id_tostop_to_ids_link[id_stop])
             
-        print '   ids_ptlink_initial',ids_ptlink_initial
-        print '   ids_ptlink_final',ids_ptlink_final
+        print('   ids_ptlink_initial',ids_ptlink_initial)
+        print('   ids_ptlink_final',ids_ptlink_final)
         
         
         ##---------------------------------------------------------------------
@@ -3214,8 +3214,8 @@ class PTMatcher(BirgilMatcher):
             delta_point = point-coords[ind_point-1]
             phi_point = np.arctan2(delta_point[1], delta_point[0])
             
-            print 79*'='
-            print '    point ind_point',ind_point,ind_point_final,' id_point',id_point,'coords',point
+            print(79*'=')
+            print('    point ind_point',ind_point,ind_point_final,' id_point',id_point,'coords',point)
             
             ids_edge_buffer, dists = get_closest_edge( point, n_best = self.n_edge_max, 
                                                 d_max = self.width_buffer_max,
@@ -3227,7 +3227,7 @@ class PTMatcher(BirgilMatcher):
             
             
             n_hits = len(ids_edge_buffer)
-            print '    n_hits',n_hits,'ids_edge_buffer',ids_edge_buffer
+            print('    n_hits',n_hits,'ids_edge_buffer',ids_edge_buffer)
             if n_hits>0:
                 phis_delta = np.zeros(n_hits, dtype = np.float32)
                 for ind, id_edge in zip(xrange(n_hits), ids_edge_buffer):
@@ -3265,10 +3265,10 @@ class PTMatcher(BirgilMatcher):
             ptlinkhits[id_ptlink] += np.sum(edgehits[ids_ptedge])
         
         if 0: #debug
-            print '    Stop waittimes'
+            print('    Stop waittimes')
             for id_stop, waits in zip(ids_stop, waittimes_stops[ids_stop]):
                 if waits>0:
-                    print '      waits at id_stop %d = %.2fs'%(id_stop,waits)
+                    print('      waits at id_stop %d = %.2fs'%(id_stop,waits))
                     
             # debug edgelinks
             #ids_edge = edges.get_ids()
@@ -3303,16 +3303,16 @@ class PTMatcher(BirgilMatcher):
         
         ##--------------------------------------------------------------------
         ## post matching analisis
-        print '\n'+79*'-'
+        print('\n'+79*'-')
         
         #print '  ids_point_edgeend',len(ids_point_edgeend),ids_point_edgeend
         if len(routelist) == 0:
-            print 'ABOARD: no routes found'
+            print('ABOARD: no routes found')
             return [],[], 0.0, 0.0,-1.0,-1.0, -1.0, -1.0, 0.0, [], False
         else:
             ids_ptlink = routelist[0][1]
             if len(ids_ptlink) == 0:
-                print 'ABOARD: route contains no edges ids_ptlink=',ids_ptlink
+                print('ABOARD: route contains no edges ids_ptlink=',ids_ptlink)
                 return [],[], 0.0, 0.0,-1.0,-1.0, -1.0, -1.0, 0.0, [], False
             else:
                 is_connected = True
@@ -3321,12 +3321,12 @@ class PTMatcher(BirgilMatcher):
                     ids_edge += ptlinks.get_ids_edge(id_ptlink)
                 route = ids_edge
                 
-        print '  matched route: len(ids_edge)',len(ids_edge),'len(ids_ptlink)',len(ids_ptlink),'cost =%.2f'%routelist[0][0]
+        print('  matched route: len(ids_edge)',len(ids_edge),'len(ids_ptlink)',len(ids_ptlink),'cost =%.2f'%routelist[0][0])
         
         if 1:
             for id_ptlink in ids_ptlink:
                 ptlinks.print_link(id_ptlink, ident = 4, is_edges = False, is_link_forward = False)
-            print '                               ids_edge',ids_edge
+            print('                               ids_edge',ids_edge)
             
                 
             
@@ -3381,10 +3381,10 @@ class PTMatcher(BirgilMatcher):
             err_dist = dist_points_tot/float(n_points) 
         
         if ptlinks.ids_tostop[ids_ptlink[-1]] in ids_stop_final:
-            print 'SUCCESS: target id_stop',ptlinks.ids_tostop[ids_ptlink[-1]],'reached length %.2f, gps length %.2f$'%(length_route,length_gps)
+            print('SUCCESS: target id_stop',ptlinks.ids_tostop[ids_ptlink[-1]],'reached length %.2f, gps length %.2f$'%(length_route,length_gps))
             is_connected = True
         else:
-            print 'DISCONNECTED: last matched id_stop',ptlinks.ids_tostop[ids_ptlink[-1]],' does not reach final ids_stop',ids_stop_final
+            print('DISCONNECTED: last matched id_stop',ptlinks.ids_tostop[ids_ptlink[-1]],' does not reach final ids_stop',ids_stop_final)
             is_connected = False
              
              
@@ -3407,7 +3407,7 @@ def get_colvalue(val, default = 0.0):
  
 class VirtualpopCreator(Process):
     def __init__(self,  mapmatching, logger = None, **kwargs):
-        print 'VirtualpopCreator.__init__'
+        print('VirtualpopCreator.__init__')
         self._init_common(  'virtualpopcreator', 
                             parent = mapmatching,
                             name = 'VirtualpopCreator', 
@@ -3448,7 +3448,7 @@ class VirtualpopCreator(Process):
     
 class ModeSelector(Process):
     def __init__(self,  mapmatching, logger = None, **kwargs):
-        print 'ModeSelector.__init__'
+        print('ModeSelector.__init__')
         self._init_common(  'modeselector', 
                             parent = mapmatching,
                             name = 'Mode Selector', 
@@ -3692,7 +3692,7 @@ class FilterMixin(Process):
     
 class PostMatchfilter(FilterMixin):
     def __init__(self,  mapmatching, logger = None, **kwargs):
-        print 'PostMatchfilter.__init__'
+        print('PostMatchfilter.__init__')
         self._init_common(  'postmatchfilter', 
                             parent = mapmatching,
                             name = 'Post matchfilter', 
@@ -3797,7 +3797,7 @@ class PostMatchfilter(FilterMixin):
         ids_trip = trips.get_ids()
         ids_points = trips.ids_points[ids_trip]
         
-        print 'filter_ids',n_trips,'selected'
+        print('filter_ids',n_trips,'selected')
         inds_eliminate = np.logical_or(\
             trips.lengthindexes[ids_selected]<self.lengthindex_min,
             trips.lengthindexes[ids_selected]>self.lengthindex_max,
@@ -3805,31 +3805,31 @@ class PostMatchfilter(FilterMixin):
             #np.logical_not(trips.are_match_connected[ids_selected]),
             #(trips.lengths_route_matched[ids_selected]<1.0), # too many args??
             )
-        print '  after lengthindex remaining',n_trips-len(np.flatnonzero(inds_eliminate))
+        print('  after lengthindex remaining',n_trips-len(np.flatnonzero(inds_eliminate)))
                     
         
         inds_eliminate |= trips.errors_dist[ids_selected]>self.error_dist_max
-        print '  after distance error remaining',n_trips-len(np.flatnonzero(inds_eliminate))
+        print('  after distance error remaining',n_trips-len(np.flatnonzero(inds_eliminate)))
         
              
         if self.is_connected:
             inds_eliminate |= np.logical_not(trips.are_match_connected[ids_selected])
         
-        print '  after connected remaining',n_trips-len(np.flatnonzero(inds_eliminate))
+        print('  after connected remaining',n_trips-len(np.flatnonzero(inds_eliminate)))
             
         if self.is_shortest:
             inds_eliminate |= trips.ids_route_shortest[ids_selected] == -1
         if self.is_matched:    
             inds_eliminate |= trips.ids_route_matched[ids_selected] == -1
-            print '  after is matched remaining',n_trips-len(np.flatnonzero(inds_eliminate))
+            print('  after is matched remaining',n_trips-len(np.flatnonzero(inds_eliminate)))
         
             inds_eliminate |= trips.lengths_route_matched[ids_selected]<1.0
-            print '  after too short trips remaining:',n_trips-len(np.flatnonzero(inds_eliminate))
+            print('  after too short trips remaining:',n_trips-len(np.flatnonzero(inds_eliminate)))
             
 
         inds_eliminate |= trips.speeds_average[ids_selected] < self.speed_trip_min
         inds_eliminate |= trips.speeds_average[ids_selected] > self.speed_trip_max
-        print '  after speed check remaining',n_trips-len(np.flatnonzero(inds_eliminate))
+        print('  after speed check remaining',n_trips-len(np.flatnonzero(inds_eliminate)))
         
 
  
@@ -3850,7 +3850,7 @@ class PostMatchfilter(FilterMixin):
         #print '  inds_eliminate',inds_eliminate
         
         inds_eliminate |= self.filter_time(trips.timestamps[ids_selected])
-        print '  after time check trips remaining:',n_trips-len(np.flatnonzero(inds_eliminate))
+        print('  after time check trips remaining:',n_trips-len(np.flatnonzero(inds_eliminate)))
         #print '  inds_eliminate',inds_eliminate
         
         if self.is_loopfree:
@@ -3860,7 +3860,7 @@ class PostMatchfilter(FilterMixin):
                     # loop-free check
                     inds_eliminate[i] = len(ids_edge) != len(set(ids_edge))
                 i += 1
-        print '  after loop test trips remaining:',n_trips-len(np.flatnonzero(inds_eliminate))   
+        print('  after loop test trips remaining:',n_trips-len(np.flatnonzero(inds_eliminate))   )
 
         return ids_selected[inds_eliminate] 
     
@@ -3874,7 +3874,7 @@ class PostMatchfilter(FilterMixin):
         
 class PersonFilter(FilterMixin):
     def __init__(self,  mapmatching, logger = None, **kwargs):
-        print 'Personfilter.__init__'
+        print('Personfilter.__init__')
         self._init_common(  'personfilter', 
                             parent = mapmatching,
                             name = 'Person filter', 
@@ -3979,18 +3979,18 @@ class PersonFilter(FilterMixin):
         ids_trip = trips.get_ids()
         ids_points = trips.ids_points[ids_trip]
         
-        print 'filter_ids',n_trips,'selected'  
+        print('filter_ids',n_trips,'selected'  )
         inds_eliminate = np.zeros(len(trips.ids_vtype[ids_selected]), dtype=bool)
 
         if self.is_select_gender:
             inds_eliminate |= persons.ids_gender[trips.ids_person[ids_selected]] != self.gender 
-            print '  after gender check remaining',n_trips-len(np.flatnonzero(inds_eliminate))
+            print('  after gender check remaining',n_trips-len(np.flatnonzero(inds_eliminate)))
             
         if self.is_select_age:
             inds_eliminate |= np.logical_or(\
                 persons.years_birth[trips.ids_person[ids_selected]]<=self.birth_min,
                 persons.years_birth[trips.ids_person[ids_selected]]>=self.birth_max,) 
-            print '  after age check remaining',n_trips-len(np.flatnonzero(inds_eliminate))
+            print('  after age check remaining',n_trips-len(np.flatnonzero(inds_eliminate)))
 
         if len(self.zones)>0:
             if self.is_select_od_trips:
@@ -4002,7 +4002,7 @@ class PersonFilter(FilterMixin):
                     id_initial_point = ids_point[0]
                     od_trips[id_trip] =  is_point_in_polygon(points.coords[id_initial_point], zone_shape_origin)*is_point_in_polygon(points.coords[id_final_point], zone_shape_dest)
                 inds_eliminate |= np.logical_not(od_trips[ids_selected])
-                print ' after od trips remaining ',n_trips-len(np.flatnonzero(inds_eliminate)) 
+                print(' after od trips remaining ',n_trips-len(np.flatnonzero(inds_eliminate)) )
                     
             if self.is_select_gen_trips:
                 zone_shape_origin = zones.shapes[zones.ids_sumo.get_id_from_index(self.origin_zone_name)]
@@ -4011,7 +4011,7 @@ class PersonFilter(FilterMixin):
                     id_initial_point = ids_point[0]
                     od_trips[id_trip] =  is_point_in_polygon(points.coords[id_initial_point], zone_shape_origin)
                 inds_eliminate |= np.logical_not(od_trips[ids_selected])
-                print ' after generated trips remaining ',n_trips-len(np.flatnonzero(inds_eliminate))      
+                print(' after generated trips remaining ',n_trips-len(np.flatnonzero(inds_eliminate))      )
                   
             if self.is_select_attr_trips:
                 zone_shape_dest = zones.shapes[zones.ids_sumo.get_id_from_index(self.dest_zone_name)]          
@@ -4020,7 +4020,7 @@ class PersonFilter(FilterMixin):
                     id_final_point = ids_point[-1]
                     od_trips[id_trip] = is_point_in_polygon(points.coords[id_final_point], zone_shape_dest)
                 inds_eliminate |= np.logical_not(od_trips[ids_selected])
-                print ' after attracted trips remaining ',n_trips-len(np.flatnonzero(inds_eliminate))      
+                print(' after attracted trips remaining ',n_trips-len(np.flatnonzero(inds_eliminate))      )
 
         return ids_selected[inds_eliminate] 
     
@@ -4039,7 +4039,7 @@ SELECTTRACES = {'FromOrigin':1,
            
 class TripGeomfilter(FilterMixin):
     def __init__(self,  mapmatching, logger = None, **kwargs):
-        print 'TripGeomfilter.__init__'
+        print('TripGeomfilter.__init__')
         self._init_common(  'tripGeomfilter', 
                             parent = mapmatching,
                             name = 'Geometry trip filter', 
@@ -4209,7 +4209,7 @@ class TripGeomfilter(FilterMixin):
         """
         Previews selected trips after filtering.
         """
-        print 'TripGeomfilter.filterpreview'
+        print('TripGeomfilter.filterpreview')
         trips = self.parent.trips
         n_trips = len(trips)
         if n_trips == 0:
@@ -4221,7 +4221,7 @@ class TripGeomfilter(FilterMixin):
         return '%d/%d (currently %d/%d)'%(n_sel_after,n_trips,n_sel_current,n_trips)
             
     def do(self):
-        print 'TripGeomfilter.do'
+        print('TripGeomfilter.do')
         # execute filtering
         if len(self.parent.trips)>0:
             self.parent.trips.are_selected[self.filter_ids(is_eliminate_points = True)] = False
@@ -4253,7 +4253,7 @@ class TripGeomfilter(FilterMixin):
         Returns an array of ids to be eliminated or deselected.
         """
         c_cutoff = 1.0 - self.const_return_max
-        print 'TripGeomfilter.filter_ids c_cutoff',c_cutoff,'is_eliminate_points',is_eliminate_points
+        print('TripGeomfilter.filter_ids c_cutoff',c_cutoff,'is_eliminate_points',is_eliminate_points)
         dist_point_max = self.dist_point_max
         dist_point_min = self.dist_point_min_extr
         dist_point_min_inter = self.dist_point_min_inter
@@ -4263,10 +4263,10 @@ class TripGeomfilter(FilterMixin):
         ids_trip = trips.get_ids_selected()
         ids_points = trips.ids_points[ids_trip]
         speed_max = self.speed_max
-        print '  n_trips',len(ids_trip)
-        print '  n_points',len(ids_points)
+        print('  n_trips',len(ids_trip))
+        print('  n_points',len(ids_points))
         if len(ids_points) == 0:
-            print 'WARNING: no points found, no traces'
+            print('WARNING: no points found, no traces')
             return True
         intersects_boundaries = self.parent.get_scenario().net.intersects_boundaries
         in_boundaries = self.parent.get_scenario().net.in_boundaries
@@ -4287,17 +4287,17 @@ class TripGeomfilter(FilterMixin):
         surplus = 0
         
         for id_trip, ids_point in  zip(ids_trip, ids_points):
-            print 79*'-'
-            print '  filter id_trip ',id_trip,
+            print(79*'-')
+            print('  filter id_trip ',id_trip,)
             if ids_point is None:
                 is_eliminate = True 
-                print '    no points'
+                print('    no points')
                 
            
             
             elif (len(ids_point) < 2*self.num_external_points+2 and self.is_eliminate_external_points):
                 is_eliminate = True 
-                print '    not enough points, only',len(ids_point) 
+                print('    not enough points, only',len(ids_point) )
             
             else:
 ##                print 'ids_point',ids_point
@@ -4325,16 +4325,16 @@ class TripGeomfilter(FilterMixin):
                     # this happens if the points of a trip in the workout file
                     # have not been imported for some reason
                     is_eliminate = True  
-                    print 'it has no points'
+                    print('it has no points')
                 elif n<2:
                     is_eliminate = True
-                    print 'less than 2 points'    
+                    print('less than 2 points'    )
                 elif not intersects_boundaries(get_boundary(coords)):
                     is_eliminate = True  
-                    print 'do not intersect boundaries'
+                    print('do not intersect boundaries')
                 elif np.any(times<0):
                     is_eliminate = True 
-                    print 'has negative times' 
+                    print('has negative times' )
                 else:
                     dist_max = 0.0
                     is_eliminate = False
@@ -4396,7 +4396,7 @@ class TripGeomfilter(FilterMixin):
                         
                         #print '    ids_points_outside =',np.array(ids_point, dtype = np.int32)[are_outside]
                         ids_point_elim.update(np.array(ids_point, dtype = np.int32)[are_outside])
-                        print len(ids_point_elim), 'points outside box'
+                        print(len(ids_point_elim), 'points outside box')
                         i = 0
                         while (i<(n-2)):
                             i+=1
@@ -4411,7 +4411,7 @@ class TripGeomfilter(FilterMixin):
                                 if dists_to_start[i] < dist_point_min:
                                     #print '  eliminate',ids_point[i], dist_check
                                     ids_point_elim.add(ids_point[i])
-                                    print 'point', ids_point[i], dists_to_start[i], 'meters near start'
+                                    print('point', ids_point[i], dists_to_start[i], 'meters near start')
                                 
                                 
                                     
@@ -4422,7 +4422,7 @@ class TripGeomfilter(FilterMixin):
                                     if dists_to_end[i] < dist_point_min:
                                         #print '  eliminate',ids_point[i], dist_check
                                         ids_point_elim.add(ids_point[i])
-                                        print 'point', ids_point[i], dists_to_end[i], 'meters near end'
+                                        print('point', ids_point[i], dists_to_end[i], 'meters near end')
                                     else:
                                         
                                         #dist_check = np.sqrt(   (coords[i,0]-coord_last[0])**2\
@@ -4434,7 +4434,7 @@ class TripGeomfilter(FilterMixin):
                                             dists_inter[i+1] = np.sqrt(   (coords[i+1,0]-coords[i-surplus,0])**2\
                                                 + (coords[i+1,1]-coords[i-surplus,1])**2 )
                                             
-                                            print 'point', ids_point[i], (dists_inter[i]), 'meters near other point'
+                                            print('point', ids_point[i], (dists_inter[i]), 'meters near other point')
                                         else:
                                             surplus = 0
                                         #else:
@@ -4460,10 +4460,10 @@ class TripGeomfilter(FilterMixin):
                                     speeds_average[id_trip] = distances_gps[id_trip]/durations_gps[id_trip]
                                 else:
                                     speeds_average[id_trip] = 0.0
-                                print 'old dist', trips.distances_gps[id_trip], 'new dist', distances_gps[id_trip]
-                                print 'old duration', trips.durations_gps[id_trip], 'new duration',durations_gps[id_trip]
-                                print 'old speed', trips.speeds_average[id_trip], 'new speed', speeds_average[id_trip]
-                                print 'old max speed', trips.speeds_max[id_trip], 'new max speed', max_speeds_intern[id_trip]
+                                print('old dist', trips.distances_gps[id_trip], 'new dist', distances_gps[id_trip])
+                                print('old duration', trips.durations_gps[id_trip], 'new duration',durations_gps[id_trip])
+                                print('old speed', trips.speeds_average[id_trip], 'new speed', speeds_average[id_trip])
+                                print('old max speed', trips.speeds_max[id_trip], 'new max speed', max_speeds_intern[id_trip])
     
     
                             else:
@@ -4477,18 +4477,18 @@ class TripGeomfilter(FilterMixin):
                                         speeds_average[id_trip] = distances_gps[id_trip]/durations_gps[id_trip]
                                     else:
                                         speeds_average[id_trip] = 0.0
-                                    print 'old dist', trips.distances_gps[id_trip], 'new dist', distances_gps[id_trip]
-                                    print 'old duration', trips.durations_gps[id_trip], 'new duration',durations_gps[id_trip]
-                                    print 'old speed', trips.speeds_average[id_trip], 'new speed', speeds_average[id_trip]
-                                    print 'old max speed', trips.speeds_max[id_trip], 'new max speed', max_speeds_intern[id_trip]
+                                    print('old dist', trips.distances_gps[id_trip], 'new dist', distances_gps[id_trip])
+                                    print('old duration', trips.durations_gps[id_trip], 'new duration',durations_gps[id_trip])
+                                    print('old speed', trips.speeds_average[id_trip], 'new speed', speeds_average[id_trip])
+                                    print('old max speed', trips.speeds_max[id_trip], 'new max speed', max_speeds_intern[id_trip])
                         
                         elif len(np.unique(list(ids_point_elim)))>=len(ids_point2): 
                             is_eliminate = True  
-                            print 'all points eliminated'
+                            print('all points eliminated')
                         # no points left
                         elif len(ids_point2)<2:
                             is_eliminate = True  
-                            print 'no points left'      
+                            print('no points left'      )
                                 
 
                         ids_point_elim_perm += list(ids_point_elim)
@@ -4501,7 +4501,7 @@ class TripGeomfilter(FilterMixin):
                             #print '  after elim ids_point',trips.ids_points[id_trip]
 
                     if is_eliminate:
-                        print 'Deselected trace due to the point analysis'
+                        print('Deselected trace due to the point analysis')
                     if self.is_deselect_traces and not is_eliminate:
                         
                         #ricalculate dist_inter and duration_inter
@@ -4529,7 +4529,7 @@ class TripGeomfilter(FilterMixin):
                                                 
                      
                             dist_to_start_max = np.max(dists_to_start)
-                            print    'dist_to_start_max', dist_to_start_max
+                            print(   'dist_to_start_max', dist_to_start_max)
                             
         ##                    print dists_to_start, dist_to_start_max
                             dists_to_end = np.sqrt(   (coords[:,0]-coords[-1,0])**2\
@@ -4550,22 +4550,22 @@ class TripGeomfilter(FilterMixin):
                         
                         if np.any(dists_inter>dist_point_max):
                             is_eliminate = True
-                            print 'one internal distance over the tollerance. Max value:', np.max(dists_inter), 'meters'
+                            print('one internal distance over the tollerance. Max value:', np.max(dists_inter), 'meters')
                             
                         if self.is_deselect_duplicate:
                             dist_duration = [trips.distances_gps[id_trip], trips.durations_gps[id_trip]] 
 
                             if dist_duration in dists_durations and dist_duration != [0.,0.]:
                                 n_duplicate_trips += 1
-                                print dist_duration
-                                print 'duplicated trip'
+                                print(dist_duration)
+                                print('duplicated trip')
                                 is_eliminate = True
 ##                            else:
                             dists_durations[id_trip] = [trips.distances_gps[id_trip], trips.durations_gps[id_trip]]
                             
                         if np.any(durations_inter>duration_point_max):
                             is_eliminate = True
-                            print 'one internal duration over the tollerance. Max value:', np.max(durations_inter), 'seconds'
+                            print('one internal duration over the tollerance. Max value:', np.max(durations_inter), 'seconds')
 
                         n_invalid_speeds = 0
                         i = 0
@@ -4577,11 +4577,11 @@ class TripGeomfilter(FilterMixin):
 
                             if n_invalid_speeds == self.n_overspeed_max:
                                 is_eliminate = True
-                                print 'invalid internal speeds'
+                                print('invalid internal speeds')
                             i += 1   
                         if dists_to_start[-1] <= c_cutoff*dist_to_start_max:
                             is_eliminate = True 
-                            print 'round trip: return distance over the tollerance'
+                            print('round trip: return distance over the tollerance')
                        
                         if len(self.zones) > 0 and  not is_eliminate:    
                             if self.is_od_select:
@@ -4592,17 +4592,17 @@ class TripGeomfilter(FilterMixin):
                                 if self.select_type == 1:
                                     is_eliminate = not is_point_in_polygon(points.coords[id_initial_point], zone_shape_origin)
                                     if is_eliminate == True:
-                                        print 'deselected for the zone filter'
+                                        print('deselected for the zone filter')
                                 if self.select_type == 2:
                                     is_eliminate = not is_point_in_polygon(points.coords[id_final_point], zone_shape_dest)
                                     if is_eliminate == True:
-                                        print 'deselected for the zone filter'
+                                        print('deselected for the zone filter')
                                 if self.select_type == 3:
                                     is_eliminate = not is_point_in_polygon(points.coords[id_initial_point], zone_shape_origin)*is_point_in_polygon(points.coords[id_final_point], zone_shape_dest)
                                     if is_eliminate == True:
-                                        print 'deselected for the zone filter'
+                                        print('deselected for the zone filter')
             if is_eliminate:
-                print 'Deselected trace'
+                print('Deselected trace')
             inds_elim[j] = is_eliminate  
             j +=1 
             
@@ -4615,12 +4615,12 @@ class TripGeomfilter(FilterMixin):
 
 
                 
-            print '  permanently eliminated %d GPS points'%(len(ids_point_elim_perm)) 
+            print('  permanently eliminated %d GPS points'%(len(ids_point_elim_perm)) )
         if self.is_analyze_points:   
-            print '%d Invalid GPS points'%(len(np.unique(ids_point_elim_perm)))    
-        print '%d Invalid GPS traces'%(np.sum(inds_elim))
+            print('%d Invalid GPS points'%(len(np.unique(ids_point_elim_perm)))    )
+        print('%d Invalid GPS traces'%(np.sum(inds_elim)))
         if self.is_deselect_duplicate:
-            print '%d Duplicated GPS traces'%(np.sum(n_duplicate_trips))
+            print('%d Duplicated GPS traces'%(np.sum(n_duplicate_trips)))
         #print '+++++++++++ids_point_elim_perm',ids_point_elim_perm
         #print '            eliminate points?',(len(ids_point_elim_perm)>0),is_eliminate_points,(len(ids_point_elim_perm)>0) & is_eliminate_points
 
@@ -4629,7 +4629,7 @@ class TripGeomfilter(FilterMixin):
 
 class MobikeImporter(FilterMixin):
     def __init__(self,  mapmatching, logger = None, **kwargs):
-        print 'MobikeImporter.__init__',mapmatching.get_ident()
+        print('MobikeImporter.__init__',mapmatching.get_ident())
         self._init_common(  'mobikeimporter', 
                             parent = mapmatching,
                             name = 'Mobike Importer', 
@@ -4780,7 +4780,7 @@ class MobikeImporter(FilterMixin):
                         trips.durations_gps[id_trip] = timestamps[-1]-timestamps[0]
                                        
     def do(self):
-        print 'TraceImporter.do'
+        print('TraceImporter.do')
         log = self.get_logger()
         #ID Bicicletta;Data e ora inizio;Data e ora fine;Latitudine inizio;Longitudine inizio;Latitudine fine;Longitudine fine;Durata;Distanza
         #        0       1                    2                 3                4                  5              6              7        8 
@@ -4827,7 +4827,7 @@ class MobikeImporter(FilterMixin):
         for line in f.readlines()[1:]:# first line contains header
 
             cols = line.strip().split(sep)
-            print '    i_line',i_line,'len(cols)',len(cols),n_cols
+            print('    i_line',i_line,'len(cols)',len(cols),n_cols)
             if len(cols)==n_cols:
                 
                 # sep_date_clock = ' ', sep_date = '-', sep_clock = ':', 
@@ -4842,8 +4842,8 @@ class MobikeImporter(FilterMixin):
                                 )
                 
             else:
-                print 'WARNING: inconsistent number of columns (%d) in line %d, file %s'%(len(cols),i_line,self.pointsfilepath)
-                print '  cols =',cols
+                print('WARNING: inconsistent number of columns (%d) in line %d, file %s'%(len(cols),i_line,self.pointsfilepath))
+                print('  cols =',cols)
             
                 
             i_line += 1
@@ -4858,7 +4858,7 @@ class MobikeImporter(FilterMixin):
 
 class StravaImporter(FilterMixin):
     def __init__(self,  mapmatching, logger = None, **kwargs):
-        print 'StravaImporter.__init__',mapmatching.get_ident()
+        print('StravaImporter.__init__',mapmatching.get_ident())
         self._init_common(  'traceimporter', 
                             parent = mapmatching,
                             name = 'Strava Trace Importer', 
@@ -4964,7 +4964,7 @@ class StravaImporter(FilterMixin):
     
                    
     def do(self):
-        print 'TraceImporter.do'
+        print('TraceImporter.do')
         if self.year == 2013:
             self.import_points_2013()
             self.import_users_2013()
@@ -4976,40 +4976,40 @@ class StravaImporter(FilterMixin):
         return True
         
     def import_users_2013(self):
-		log = self.get_logger()
+        log = self.get_logger()
         
         
-		print 'import users'
-		if  (self.userinfofilepath == ''):
-			return
+        print('import users')
+        if  (self.userinfofilepath == ''):
+            return
         
         
-		null = 'NULL'
-		na = '#N/A'
-		trips = self.parent.trips
-		persons = self.parent.persons
-		persons.clear()
+        null = 'NULL'
+        na = '#N/A'
+        trips = self.parent.trips
+        persons = self.parent.persons
+        persons.clear()
         ## read users
         
-		persons.add_col(am.ArrayConf('ages_strava', default = AGES_STRAVA['unknown'],
-									choices = AGES_STRAVA,
-									dtype = np.int32,
-									symbol = 'Ages Str.',
-									groupnames = ['parameters'], 
-									name = 'Ages Strava',
-									info = 'Ages with Strava dictionary'
-									))
-                                    
-		persons.add_col(am.ArrayConf('incomes', default = INCOMES_STRAVA['unknown'],
-									dtype = np.int32,
-									symbol = 'Incomes Str.',
-									choices = INCOMES_STRAVA,
-									groupnames = ['parameters'], 
-									name = 'Incomes Strava',
-									info = 'Incomes of cyclists'
-									)) 
+        persons.add_col(am.ArrayConf('ages_strava', default = AGES_STRAVA['unknown'],
+                                    choices = AGES_STRAVA,
+                                    dtype = np.int32,
+                                    symbol = 'Ages Str.',
+                                    groupnames = ['parameters'], 
+                                    name = 'Ages Strava',
+                                    info = 'Ages with Strava dictionary'
+                                    ))
+                                    
+        persons.add_col(am.ArrayConf('incomes', default = INCOMES_STRAVA['unknown'],
+                                    dtype = np.int32,
+                                    symbol = 'Incomes Str.',
+                                    choices = INCOMES_STRAVA,
+                                    groupnames = ['parameters'], 
+                                    name = 'Incomes Strava',
+                                    info = 'Incomes of cyclists'
+                                    )) 
                                     
-		persons.add_col(am.ArrayConf('ethnicities', default = ETHNICITIES_STRAVA['unknown'],
+        persons.add_col(am.ArrayConf('ethnicities', default = ETHNICITIES_STRAVA['unknown'],
                                     dtype = np.int32,
                                     symbol = 'Ethn. Str.',
                                     choices = ETHNICITIES_STRAVA,
@@ -5018,7 +5018,7 @@ class StravaImporter(FilterMixin):
                                     info = 'Ethnicities of cyclists'
                                     )) 
 
-		persons.add_col(am.ArrayConf('cycling_frequencies', default = CYCLING_FREQUENCIES_STRAVA['unknown'],
+        persons.add_col(am.ArrayConf('cycling_frequencies', default = CYCLING_FREQUENCIES_STRAVA['unknown'],
                                     dtype = np.int32,
                                     symbol = 'Freq. Str.',
                                     choices = CYCLING_FREQUENCIES_STRAVA,
@@ -5027,7 +5027,7 @@ class StravaImporter(FilterMixin):
                                     info = 'Cycling frequencies of cyclists'
                                     )) 
                                     
-		persons.add_col(am.ArrayConf('cycling_histories', default = RIDER_HISTORIES_STRAVA['unknown'],
+        persons.add_col(am.ArrayConf('cycling_histories', default = RIDER_HISTORIES_STRAVA['unknown'],
                                     dtype = np.int32,
                                     symbol = 'Hist. Str.',
                                     choices = RIDER_HISTORIES_STRAVA,
@@ -5036,7 +5036,7 @@ class StravaImporter(FilterMixin):
                                     info = 'Cycling histories of cyclists'
                                     )) 
                                     
-		persons.add_col(am.ArrayConf('cyclist_types', default = RIDER_TYPES_STRAVA['unknown'],
+        persons.add_col(am.ArrayConf('cyclist_types', default = RIDER_TYPES_STRAVA['unknown'],
                                     dtype = np.int32,
                                     symbol = 'Type Str.',
                                     choices = RIDER_TYPES_STRAVA,
@@ -5044,7 +5044,7 @@ class StravaImporter(FilterMixin):
                                     name = 'Cyclist types Strava',
                                     info = 'Cyclist types of cyclists'
                                     )) 
-									
+                                    
                                     
                                     
                                     
@@ -5054,109 +5054,109 @@ class StravaImporter(FilterMixin):
         #print 'GpsPersons.versio,',self.get_version(),self.get_version()<0.2
         
         
-		if hasattr(self,'home_zips'):
+        if hasattr(self,'home_zips'):
+                #print '  zips',self.zips.get_value().dtype,self.zips.get_value()
+            if self.home_zips.get_value().dtype in [np.dtype(np.int32),np.dtype(np.int64)]:
+                print('WARNING: delete old person.home_zips')
+                self.delete('home_zips')
+        if hasattr(self,'school_zips'):
+                #print '  zips',self.zips.get_value().dtype,self.zips.get_value()
+                if self.school_zips.get_value().dtype in [np.dtype(np.int32),np.dtype(np.int64)]:
+                    print('WARNING: delete old person.school_zips')
+                    self.delete('school_zips')
+        if hasattr(self,'work_zips'):
                 #print '  zips',self.zips.get_value().dtype,self.zips.get_value()
-			if self.home_zips.get_value().dtype in [np.dtype(np.int32),np.dtype(np.int64)]:
-				print 'WARNING: delete old person.home_zips'
-				self.delete('home_zips')
-		if hasattr(self,'school_zips'):
-				#print '  zips',self.zips.get_value().dtype,self.zips.get_value()
-				if self.school_zips.get_value().dtype in [np.dtype(np.int32),np.dtype(np.int64)]:
-					print 'WARNING: delete old person.school_zips'
-					self.delete('school_zips')
-		if hasattr(self,'work_zips'):
-				#print '  zips',self.zips.get_value().dtype,self.zips.get_value()
-				if self.work_zips.get_value().dtype in [np.dtype(np.int32),np.dtype(np.int64)]:
-					print 'WARNING: delete old person.work_zips'
-					self.delete('work_zips')
+                if self.work_zips.get_value().dtype in [np.dtype(np.int32),np.dtype(np.int64)]:
+                    print('WARNING: delete old person.work_zips')
+                    self.delete('work_zips')
                                         
         #if self.get_version()<0.2:
         #    #if hasattr(self,'zips'):
         #   self.delete('zips')
         #Id_utente,Gender,YearOfBirth
-#ID tripid	userid	trip_type	created_date	      age	gender	income	ethnicity	homeZIP	schoolZip	workZip	cyclingfreq	rider_history	rider_type
-#0	7490	311	    Commute	    2012-11-05 05:32:04	  5	    2	    6	    1	        30306	-1	        30309	 4	        1	            1
-#1	7561	35	    Commute	    2012-10-12 15:07:22	  0  	0	    0	    1	        30316	-1	        30308	 3	        1	            2
-
-		n_cols = 15
-		j_id_line, j_tripid, j_userid, j_trip_type, j_created_date, j_age, j_gender, j_income, j_ethnicity, j_homeZIP, j_schoolZip, j_workZip, j_cyclingfreq, j_rider_history, j_rider_type  = range(15)
-		
-		#dd
+#ID tripid    userid    trip_type    created_date          age    gender    income    ethnicity    homeZIP    schoolZip    workZip    cyclingfreq    rider_history    rider_type
+#0    7490    311        Commute        2012-11-05 05:32:04      5        2        6        1            30306    -1            30309     4            1                1
+#1    7561    35        Commute        2012-10-12 15:07:22      0      0        0        1            30316    -1            30308     3            1                2
+
+        n_cols = 15
+        j_id_line, j_tripid, j_userid, j_trip_type, j_created_date, j_age, j_gender, j_income, j_ethnicity, j_homeZIP, j_schoolZip, j_workZip, j_cyclingfreq, j_rider_history, j_rider_type  = range(15)
+        
+        #dd
         
-		ids_person_sumo = {}
+        ids_person_sumo = {}
         
         #ids_trips = []
-		scenario = self.parent.get_scenario()
+        scenario = self.parent.get_scenario()
         
 
-		f=open(self.userinfofilepath,'r')
-		if log: log.w('import_users_2013 import user file %s'%os.path.basename(self.userinfofilepath))
-		sep = ','
-		i_line = 0
+        f=open(self.userinfofilepath,'r')
+        if log: log.w('import_users_2013 import user file %s'%os.path.basename(self.userinfofilepath))
+        sep = ','
+        i_line = 0
         #self.get_logger().w(100.0*self.simtime/self.duration, key ='progress')
-		persons_temp = {}
-		lines = f.readlines()[1:]
-		user_ids = []
+        persons_temp = {}
+        lines = f.readlines()[1:]
+        user_ids = []
         
         
-		for line in lines:
+        for line in lines:
             #if True:#i_line>1:
-			cols = line.split(sep)
+            cols = line.split(sep)
             #print '    len(cols)',len(cols),n_cols
             #print '    cols',cols
-			id_person_sumo = cols[j_userid].strip()
-			id_trip_gps = cols[j_tripid].strip()
+            id_person_sumo = cols[j_userid].strip()
+            id_trip_gps = cols[j_tripid].strip()
                 #print '  id_trip_gps',id_trip_gps
 ##                print id_trip_gps
 
-			if trips.ids_sumo.has_index(id_trip_gps):
-				id_trip = trips.ids_sumo.get_id_from_index(id_trip_gps) 
-				trips.ids_purpose[id_trip] = TRIPPUROPSES[cols[j_trip_type].strip()]
-				if not persons.ids_sumo.has_index(id_person_sumo):
-					if len(cols)>=n_cols:
-		                # row is complete
-		                #print '  id_trip_sumo',cols[j_id_trip]
-						persons_temp[cols[j_userid].strip()] = (cols[j_age], 
-		                cols[j_gender].strip(), 
-		                cols[j_income].strip(), 
-		                cols[j_ethnicity].strip(), 
-		                cols[j_homeZIP].strip(), 
-		                cols[j_schoolZip].strip(), 
-		                cols[j_workZip].strip(), 
-		                cols[j_cyclingfreq].strip(), 
-		                cols[j_rider_history].strip(), 
-						cols[j_rider_type].strip())
-		                
-		                                            
-					else:
-						print 'WARNING: inconsistent number of columns (%d) in line %d, file %s'%(len(cols),i_line,self.userinfofilepath)
-						print '  cols =',cols
-					if i_line%1000 == 0:
-						print i_line,'/',len(lines), 'users imported'
-					i_line += 1
-		            
-		            
-		            
-					if id_person_sumo != na:
-						age, gender, income, ethnicity, home_zip, school_zip, work_zip, cycling_frequency, cycling_history, cyclist_type = persons_temp[cols[j_userid].strip()]
-						id_pers = persons.make(     id_sumo = id_person_sumo,
-		                                                        gender = GENDERS_STRAVA[gender],
-		                                                        income=income,
-		                                                        ethnicity=ethnicity,
-		                                                        home_zip=home_zip,
-		                                                        school_zip=school_zip,
-		                                                        work_zip=work_zip,
-		                                                        cycling_frequency=cycling_frequency,
-		                                                        cycling_history=cycling_history,
-		                                                        cyclist_type=cyclist_type,
-		                                                        age_strava = age
-		                                                        ) 
-						persons.add_trip(cols[j_userid].strip(), id_trip)
-	                
-				else:
-					persons.add_trip(cols[j_userid].strip(), id_trip)
+            if trips.ids_sumo.has_index(id_trip_gps):
+                id_trip = trips.ids_sumo.get_id_from_index(id_trip_gps) 
+                trips.ids_purpose[id_trip] = TRIPPUROPSES[cols[j_trip_type].strip()]
+                if not persons.ids_sumo.has_index(id_person_sumo):
+                    if len(cols)>=n_cols:
+                        # row is complete
+                        #print '  id_trip_sumo',cols[j_id_trip]
+                        persons_temp[cols[j_userid].strip()] = (cols[j_age], 
+                        cols[j_gender].strip(), 
+                        cols[j_income].strip(), 
+                        cols[j_ethnicity].strip(), 
+                        cols[j_homeZIP].strip(), 
+                        cols[j_schoolZip].strip(), 
+                        cols[j_workZip].strip(), 
+                        cols[j_cyclingfreq].strip(), 
+                        cols[j_rider_history].strip(), 
+                        cols[j_rider_type].strip())
+                        
+                                                    
+                    else:
+                        print('WARNING: inconsistent number of columns (%d) in line %d, file %s'%(len(cols),i_line,self.userinfofilepath))
+                        print('  cols =',cols)
+                    if i_line%1000 == 0:
+                        print(i_line,'/',len(lines), 'users imported')
+                    i_line += 1
+                    
+                    
+                    
+                    if id_person_sumo != na:
+                        age, gender, income, ethnicity, home_zip, school_zip, work_zip, cycling_frequency, cycling_history, cyclist_type = persons_temp[cols[j_userid].strip()]
+                        id_pers = persons.make(     id_sumo = id_person_sumo,
+                                                                gender = GENDERS_STRAVA[gender],
+                                                                income=income,
+                                                                ethnicity=ethnicity,
+                                                                home_zip=home_zip,
+                                                                school_zip=school_zip,
+                                                                work_zip=work_zip,
+                                                                cycling_frequency=cycling_frequency,
+                                                                cycling_history=cycling_history,
+                                                                cyclist_type=cyclist_type,
+                                                                age_strava = age
+                                                                ) 
+                        persons.add_trip(cols[j_userid].strip(), id_trip)
+                    
+                else:
+                    persons.add_trip(cols[j_userid].strip(), id_trip)
 
-		f.close()
+        f.close()
         
         
     def add_trips(self, trips, points, distances_gps, durations_gps, speeds_av, ids_trip_sumo, ids_trips_points,
@@ -5166,39 +5166,39 @@ class StravaImporter(FilterMixin):
 ##            print timestamps_trips - timestamps_trips[0]
 
             
-			ids_vtype = np.zeros(len(ids_trip_sumo), dtype = np.int32)
-			i = 0
-			for id_mode in ids_mode:
-				ids_vtype[i] = self.get_vtype_for_mode(id_mode)
-				i+=1                   
+            ids_vtype = np.zeros(len(ids_trip_sumo), dtype = np.int32)
+            i = 0
+            for id_mode in ids_mode:
+                ids_vtype[i] = self.get_vtype_for_mode(id_mode)
+                i+=1                   
             # create new trip
-			print 'add trips'
-			ids_trip = trips.add_rows(ids_sumo = ids_trip_sumo,
-									timestamps = timestamps_trips,
-									ids_vtype = ids_vtype,
-									durations_gps = durations_gps,
-									distances_gps = distances_gps,
-									speeds_average = speeds_av,
-									)
-			print len(ids_trip), 'trips added'
-
-            
-			i_changes = [0]
-			current_id_trips_points = ids_trips_points[0]
-			for id_trips_points, i in zip(ids_trips_points, range(len(ids_trips_points))): 
-				if id_trips_points != current_id_trips_points:
-					i_changes.append(i)
-				current_id_trips_points = id_trips_points
-			i_changes.append(len(ids_trips_points))
-			print len(i_changes)-1, len(ids_trip)
-			for i, id_trip in zip(range(len(i_changes)-1), ids_trip):
-				ids_trips_points[i_changes[i]:i_changes[i+1]] = id_trip*np.ones(len(ids_trips_points[i_changes[i]:i_changes[i+1]]))
+            print('add trips')
+            ids_trip = trips.add_rows(ids_sumo = ids_trip_sumo,
+                                    timestamps = timestamps_trips,
+                                    ids_vtype = ids_vtype,
+                                    durations_gps = durations_gps,
+                                    distances_gps = distances_gps,
+                                    speeds_average = speeds_av,
+                                    )
+            print(len(ids_trip), 'trips added')
+
+            
+            i_changes = [0]
+            current_id_trips_points = ids_trips_points[0]
+            for id_trips_points, i in zip(ids_trips_points, range(len(ids_trips_points))): 
+                if id_trips_points != current_id_trips_points:
+                    i_changes.append(i)
+                current_id_trips_points = id_trips_points
+            i_changes.append(len(ids_trips_points))
+            print(len(i_changes)-1, len(ids_trip))
+            for i, id_trip in zip(range(len(i_changes)-1), ids_trip):
+                ids_trips_points[i_changes[i]:i_changes[i+1]] = id_trip*np.ones(len(ids_trips_points[i_changes[i]:i_changes[i+1]]))
                 
                 
-			print 'add points'
+            print('add points')
 
 ##            print timestamps_points, timestamps_trips
-			ids_point = points.add_rows(\
+            ids_point = points.add_rows(\
                         timestamps = timestamps_points,
                         ids_trip = ids_trips_points,
                         longitudes = longitudes,
@@ -5206,37 +5206,37 @@ class StravaImporter(FilterMixin):
                         altitudes = altitudes,
                         )
                         
-			print len(ids_point), 'points added'           
-			print 'add ids points'
+            print(len(ids_point), 'points added')
+            print('add ids points')
 
             # bellamossa does provide no altitude
             #points.coords[ids_point][:,:2] =  coords 
-			for i, id_trip in zip(range(len(i_changes)-1), ids_trip):
+            for i, id_trip in zip(range(len(i_changes)-1), ids_trip):
 ##                print points.get_ids()[(points.ids_trip[points.get_ids()] == id_trip)]
-				trips.set_points(id_trip, ids_point[i_changes[i]:i_changes[i+1]])
+                trips.set_points(id_trip, ids_point[i_changes[i]:i_changes[i+1]])
             #print '    timestamps',timestamps
 ##            if len(timestamps)>1:
 ##                trips.durations_gps[id_trip] = timestamps[-1]-timestamps[0]
-			for id_trip in ids_trip:
-				positive_elevation = 0.0
-				negative_elevation = 0.0
-				ids_point_trip = trips.ids_points[id_trip]
-				altitude_ahead = points.altitudes[ids_point_trip[0]]
-				if len(ids_point_trip)>3:
-					i = 0
-					for id_point in ids_point_trip:
-						i+=1
-						if i%20 == 0:
-							if points.altitudes[id_point] >= altitude_ahead:
-								positive_elevation += (points.altitudes[id_point] - altitude_ahead)
-								altitude_ahead = points.altitudes[id_point]
-							else:
-								negative_elevation +=  (altitude_ahead - points.altitudes[id_point])
-								altitude_ahead = points.altitudes[id_point]
-	
-				trips.positive_elevations[id_trip] = positive_elevation
-				trips.negative_elevations[id_trip] = negative_elevation
-				
+            for id_trip in ids_trip:
+                positive_elevation = 0.0
+                negative_elevation = 0.0
+                ids_point_trip = trips.ids_points[id_trip]
+                altitude_ahead = points.altitudes[ids_point_trip[0]]
+                if len(ids_point_trip)>3:
+                    i = 0
+                    for id_point in ids_point_trip:
+                        i+=1
+                        if i%20 == 0:
+                            if points.altitudes[id_point] >= altitude_ahead:
+                                positive_elevation += (points.altitudes[id_point] - altitude_ahead)
+                                altitude_ahead = points.altitudes[id_point]
+                            else:
+                                negative_elevation +=  (altitude_ahead - points.altitudes[id_point])
+                                altitude_ahead = points.altitudes[id_point]
+    
+                trips.positive_elevations[id_trip] = positive_elevation
+                trips.negative_elevations[id_trip] = negative_elevation
+                
 
     def check_trip(self, trips, points, id_trip_sumo, 
                                 id_mode, timestamps, longitudes, latitudes):
@@ -5297,16 +5297,16 @@ class StravaImporter(FilterMixin):
             return is_valid, 0., 0., 0.
                                 
     def import_points_2013(self):
-        print 'import_points_2013'
+        print('import_points_2013')
         log = self.get_logger()
         #pointDBNode,   pointPathId,    id,     timestamp,          latitude,   longitude,  altitude,distance,  heartRate,instruction,speed
         #4,             61565791,   23648171762,2013-05-01 06:33:58,44.501085,  11.372906,  NULL,       0,      NULL,       2,          NULL
         #0                  1         2          3                      4          5            6       7       8           9           10
-	#      tripid	datetime	           lat	       lon         	altitude	speed hAccuracy	vAccuracy
-	#221515	7490	2013-05-08 07:59:29	33.78492	-84.356894	259.6000061035	9.25	   3	    3
-	#221516	7490	2013-05-08 07:59:30	33.784921	-84.357001	259.700012207	9.5	3	   3
-	#221517	7490	2013-05-08 07:59:32	33.784918	-84.357205	259.5	9.5	4	4
-	#221518	7490	2013-05-08 07:59:34	33.784923	-84.357416	259.200012207	9.75	   3	     3
+    #      tripid    datetime               lat           lon             altitude    speed hAccuracy    vAccuracy
+    #221515    7490    2013-05-08 07:59:29    33.78492    -84.356894    259.6000061035    9.25       3        3
+    #221516    7490    2013-05-08 07:59:30    33.784921    -84.357001    259.700012207    9.5    3       3
+    #221517    7490    2013-05-08 07:59:32    33.784918    -84.357205    259.5    9.5    4    4
+    #221518    7490    2013-05-08 07:59:34    33.784923    -84.357416    259.200012207    9.75       3         3
 
         
         ind_id_path = 1
@@ -5361,7 +5361,7 @@ class StravaImporter(FilterMixin):
         lines = f.readlines()[1:]
         n_lines = len(lines)
         n_trips = len(lines)
-        print 'analyze', n_lines, 'points and', n_trips, 'trips'
+        print('analyze', n_lines, 'points and', n_trips, 'trips')
 
         ids_trip_sumo = np.zeros(n_trips,dtype = 'object')                      
         ids_mode  = np.zeros(n_trips,dtype = np.int32)                            
@@ -5461,11 +5461,11 @@ class StravaImporter(FilterMixin):
       
                 
             else:
-                print 'WARNING: inconsistent number of columns (%d) in line %d, file %s'%(len(cols),i_line,self.pointsfilepath)
-                print '  cols =',cols
+                print('WARNING: inconsistent number of columns (%d) in line %d, file %s'%(len(cols),i_line,self.pointsfilepath))
+                print('  cols =',cols)
             
             if i_line%500000 == 0:
-                print i_line,'/',len(lines), 'points imported'
+                print(i_line,'/',len(lines), 'points imported')
             i_line += 1
         
         # register points of last trip after loop ended
@@ -5518,7 +5518,7 @@ class StravaImporter(FilterMixin):
 
 class BellamossaImporter(FilterMixin):
     def __init__(self,  mapmatching, logger = None, **kwargs):
-        print 'BellamossaImporter.__init__',mapmatching.get_ident()
+        print('BellamossaImporter.__init__',mapmatching.get_ident())
         self._init_common(  'traceimporter', 
                             parent = mapmatching,
                             name = 'Bellamossa Trace Importer', 
@@ -5633,7 +5633,7 @@ class BellamossaImporter(FilterMixin):
     
                    
     def do(self):
-        print 'TraceImporter.do'
+        print('TraceImporter.do')
         if self.year == 2017:
             self.import_points_2017()
             self.import_users_2017()
@@ -5647,7 +5647,7 @@ class BellamossaImporter(FilterMixin):
     def import_users_2017(self):
         log = self.get_logger()
         
-        print 'import users'
+        print('import users')
         if (self.tripinfofilepath == '') | (self.userinfofilepath == ''):
             return
         
@@ -5693,10 +5693,10 @@ class BellamossaImporter(FilterMixin):
                 
                                             
             else:
-                print 'WARNING: inconsistent number of columns (%d) in line %d, file %s'%(len(cols),i_line,self.userinfofilepath)
-                print '  cols =',cols
+                print('WARNING: inconsistent number of columns (%d) in line %d, file %s'%(len(cols),i_line,self.userinfofilepath))
+                print('  cols =',cols)
             if i_line%1000 == 0:
-                print i_line,'/',len(lines), 'users imported'
+                print(i_line,'/',len(lines), 'users imported')
             i_line += 1
 
         f.close()
@@ -5739,10 +5739,10 @@ class BellamossaImporter(FilterMixin):
                     
                                             
             else:
-                print 'WARNING: inconsistent number of columns (%d) in line %d, file %s'%(len(cols),i_line,self.tripinfofilepath)
-                print '  cols =',cols
+                print('WARNING: inconsistent number of columns (%d) in line %d, file %s'%(len(cols),i_line,self.tripinfofilepath))
+                print('  cols =',cols)
             if i_line%500000 == 0:
-                print i_line,'/',len(lines), 'users imported'
+                print(i_line,'/',len(lines), 'users imported')
             i_line += 1                          
     
     def add_trips(self, trips, points, distances_gps, durations_gps, speeds_av, ids_trip_sumo, ids_trips_points,
@@ -5758,7 +5758,7 @@ class BellamossaImporter(FilterMixin):
                 ids_vtype[i] = self.get_vtype_for_mode(id_mode)
                 i+=1                   
             # create new trip
-            print 'add trips'
+            print('add trips')
             ids_trip = trips.add_rows(ids_sumo = ids_trip_sumo,
                                     timestamps = timestamps_trips,
                                     ids_vtype = ids_vtype,
@@ -5766,7 +5766,7 @@ class BellamossaImporter(FilterMixin):
                                     distances_gps = distances_gps,
                                     speeds_average = speeds_av,
                                     )
-            print len(ids_trip), 'trips added'
+            print(len(ids_trip), 'trips added')
 
             
             i_changes = [0]
@@ -5776,12 +5776,12 @@ class BellamossaImporter(FilterMixin):
                     i_changes.append(i)
                 current_id_trips_points = id_trips_points
             i_changes.append(len(ids_trips_points))
-            print len(i_changes)-1, len(ids_trip)
+            print(len(i_changes)-1, len(ids_trip))
             for i, id_trip in zip(range(len(i_changes)-1), ids_trip):
                 ids_trips_points[i_changes[i]:i_changes[i+1]] = id_trip*np.ones(len(ids_trips_points[i_changes[i]:i_changes[i+1]]))
                 
                 
-            print 'add points'
+            print('add points')
 
 ##            print timestamps_points, timestamps_trips
             ids_point = points.add_rows(\
@@ -5792,8 +5792,8 @@ class BellamossaImporter(FilterMixin):
                         altitudes = np.zeros(len(ids_trips_points), dtype = np.float32),
                         )
                         
-            print len(ids_point), 'points added'           
-            print 'add ids points'
+            print(len(ids_point), 'points added'           )
+            print('add ids points')
 
             # bellamossa does provide no altitude
             #points.coords[ids_point][:,:2] =  coords 
@@ -5863,7 +5863,7 @@ class BellamossaImporter(FilterMixin):
             return is_valid, 0., 0., 0.
                                 
     def import_points_2017(self):
-        print 'import_points_2017'
+        print('import_points_2017')
         log = self.get_logger()
         #    0          1           2     3        4        5        6       7              8
         # ActivityId,ActivityType,Time,Latitude,Longitude,Accuracy,Speed,IdentifiedType,IdentifiedConfidence
@@ -5926,7 +5926,7 @@ class BellamossaImporter(FilterMixin):
         lines = f.readlines()[1:]
         n_lines = len(lines)
         n_trips = len(lines)
-        print 'analyze', n_lines, 'points and', n_trips, 'trips'
+        print('analyze', n_lines, 'points and', n_trips, 'trips')
 
         ids_trip_sumo = np.zeros(n_trips,dtype = 'object')                      
         ids_mode  = np.zeros(n_trips,dtype = np.int32)                            
@@ -6025,11 +6025,11 @@ class BellamossaImporter(FilterMixin):
       
                 
             else:
-                print 'WARNING: inconsistent number of columns (%d) in line %d, file %s'%(len(cols),i_line,self.pointsfilepath)
-                print '  cols =',cols
+                print('WARNING: inconsistent number of columns (%d) in line %d, file %s'%(len(cols),i_line,self.pointsfilepath))
+                print('  cols =',cols)
             
             if i_line%500000 == 0:
-                print i_line,'/',len(lines), 'points imported'
+                print(i_line,'/',len(lines), 'points imported')
             i_line += 1
         
         # register points of last trip after loop ended
@@ -6078,7 +6078,7 @@ class BellamossaImporter(FilterMixin):
                                     
 class EccTracesImporter(FilterMixin):
     def __init__(self,  mapmatching, logger = None, **kwargs):
-        print 'EccTracesImporter.__init__',mapmatching.get_ident()
+        print('EccTracesImporter.__init__',mapmatching.get_ident())
         self._init_common(  'traceimporter', 
                             parent = mapmatching,
                             name = 'ECC Trace Importer', 
@@ -6179,7 +6179,7 @@ class EccTracesImporter(FilterMixin):
                    & (speed_av < self.speed_trip_max)
                    
     def do(self):
-        print 'TraceImporter.do'
+        print('TraceImporter.do')
         if self.year == 2014:
             self.import_workouts_2014()
             self.import_points_2014()
@@ -6283,17 +6283,17 @@ class EccTracesImporter(FilterMixin):
                             #print
                 
                 else:
-                    print '  invalid trip',cols[j_id_trip]
+                    print('  invalid trip',cols[j_id_trip])
                 
             else:
-                print 'WARNING: inconsistent number of columns (%d) in line %d, file %s'%(len(cols),i_line,self.workoutsfilepath)
-                print '  cols =',cols
+                print('WARNING: inconsistent number of columns (%d) in line %d, file %s'%(len(cols),i_line,self.workoutsfilepath))
+                print('  cols =',cols)
             
             i_line += 1
                                             
     
     def import_points_2016(self):
-        print 'import_points_2016'
+        print('import_points_2016')
         #    0          1    2            3         4          5         6    7        
         # TripID, TimeStamp,Latitude, Longitude, Altitude, Distance, Speed, Type
         # 574e98c988c5378163a3e11f,1462347278,44.52606,11.27617,78,0.027255420500625783,5,<start|mid|end>,
@@ -6385,8 +6385,8 @@ class EccTracesImporter(FilterMixin):
       
                 
             else:
-                print 'WARNING: inconsistent number of columns (%d) in line %d, file %s'%(len(cols),i_line,self.pointsfilepath)
-                print '  cols =',cols
+                print('WARNING: inconsistent number of columns (%d) in line %d, file %s'%(len(cols),i_line,self.pointsfilepath))
+                print('  cols =',cols)
             
                 
             i_line += 1
@@ -6498,13 +6498,13 @@ class EccTracesImporter(FilterMixin):
                                             zip = zip,
                                             )  
             else:
-                print 'WARNING: inconsistent number of columns (%d) in line %d, file %s'%(len(cols),i_line,self.workoutsfilepath)
+                print('WARNING: inconsistent number of columns (%d) in line %d, file %s'%(len(cols),i_line,self.workoutsfilepath))
                 #print '  cols =',cols
             
             i_line += 1
     
     def import_points_2015(self):
-        print 'import_points_2015'
+        print('import_points_2015')
         #    0          1    2   3         4          5         6         7       8  
         #TripID, TimeStamp,Date, Latitude, Longitude, Altitude, Distance, Speed, Type
         #54eb0737e71f394c2fa9a74d,1424692509,"Mon, 23 Feb 2015 11:55:09 GMT",44.499096,11.361185,49.419395,0,0.000815,start
@@ -6596,7 +6596,7 @@ class EccTracesImporter(FilterMixin):
       
                 
             else:
-                print 'WARNING: inconsistent number of columns (%d) in line %d, file %s'%(len(cols),i_line,self.pointsfilepath)
+                print('WARNING: inconsistent number of columns (%d) in line %d, file %s'%(len(cols),i_line,self.pointsfilepath))
                 #print '  cols =',cols
             
                 
@@ -6626,7 +6626,7 @@ class EccTracesImporter(FilterMixin):
                                 
     
     def import_workouts_2014(self):
-        print 'import_workouts_2014'
+        print('import_workouts_2014')
         # 2014 ecomondo workouts
         #id            pointDBNode    pointPathId    startTime            distance    duration    sport    calories    maxSpeed    altitudeMin    altitudeMax    metersAscent    metersDescent
         #329308466    7            37073516    2014-05-01 19:00:00        26        15600        1        1182.64        NULL        NULL        NULL        NULL            NULL 
@@ -6686,7 +6686,7 @@ class EccTracesImporter(FilterMixin):
         
     
     def import_points_2014(self):
-        print 'import_points_2014'
+        print('import_points_2014')
         # csv2014
         #pointDBNode,pointPathId,id,timestamp,latitude,longitude,altitude,distance,heartRate,instruction,speed
         #4,61565791,23648171762,2013-05-01 06:33:58,44.501085,11.372906,NULL,0,NULL,2,NULL
@@ -6782,7 +6782,7 @@ class EccTracesImporter(FilterMixin):
       
                 
             else:
-                print 'WARNING: inconsistent columns in line %d, file %s'%(i_line,os.path.basename(self.pointsfilepath))
+                print('WARNING: inconsistent columns in line %d, file %s'%(i_line,os.path.basename(self.pointsfilepath)))
             
                 
             i_line += 1
@@ -6808,7 +6808,7 @@ class EccTracesImporter(FilterMixin):
     
     
     def import_points_2013(self):
-        print 'import_points_2013'
+        print('import_points_2013')
         #pointDBNode,   pointPathId,    id,     timestamp,          latitude,   longitude,  altitude,distance,  heartRate,instruction,speed
         #4,             61565791,   23648171762,2013-05-01 06:33:58,44.501085,  11.372906,  NULL,       0,      NULL,       2,          NULL
         #0                  1         2          3                      4          5            6       7       8           9           10
@@ -6924,7 +6924,7 @@ class EccTracesImporter(FilterMixin):
       
                 
             else:
-                print 'WARNING: inconsistent columns in line %d, file %s'%(i_line,os.path.basename(self.pointsfilepath))
+                print('WARNING: inconsistent columns in line %d, file %s'%(i_line,os.path.basename(self.pointsfilepath)))
             
                 
             i_line += 1
@@ -6952,7 +6952,7 @@ class EccTracesImporter(FilterMixin):
 
 class GpxImporter(FilterMixin):
     def __init__(self,  mapmatching, logger = None, **kwargs):
-        print 'GpxImporter.__init__',mapmatching.get_ident()
+        print('GpxImporter.__init__',mapmatching.get_ident())
         self._init_common(  'gpximporter', 
                             parent = mapmatching,
                             name = 'GPX Importer', 
@@ -6996,7 +6996,7 @@ class GpxImporter(FilterMixin):
         Reads endomondo gpx xml file and stores point data in traces table.
         If there is no traces table, one will be initialized and returned
         """
-        print 'GpxImporter.do',self.filepaths
+        print('GpxImporter.do',self.filepaths)
         mapmatching = self.parent
         #scenario = mapmatching.get_scenario()
         logger = self.get_logger()
@@ -7015,7 +7015,7 @@ class GpxImporter(FilterMixin):
                             speed_trip_max = self.speed_trip_max,
                             )
         for filepath in self.filepaths.split(','):
-            print '  parse gpx file',    filepath            
+            print('  parse gpx file',    filepath            )
             parse(filepath.strip(), parser)
             
         ids_trips = parser.get_ids_trip()
@@ -7207,7 +7207,7 @@ class GpxParser(handler.ContentHandler):
 
 class GtfsShapeImporter(FilterMixin):
     def __init__(self,  mapmatching, logger = None, **kwargs):
-        print 'GtfsShapeImporter.__init__',mapmatching.get_ident()
+        print('GtfsShapeImporter.__init__',mapmatching.get_ident())
         self._init_common(  'gtfsshapeimporter', 
                             parent = mapmatching,
                             name = 'GTFS Importer', 
@@ -7250,7 +7250,7 @@ class GtfsShapeImporter(FilterMixin):
         Reads endomondo gpx xml file and stores point data in traces table.
         If there is no traces table, one will be initialized and returned
         """
-        print 'GtfsShapeImporter.do',self.gtfsdirpath
+        print('GtfsShapeImporter.do',self.gtfsdirpath)
         mapmatching = self.parent
         
         mapmatching.get_attrsman().do_not_save_attrs(['gtfsdirpath'])
@@ -7263,7 +7263,7 @@ class GtfsShapeImporter(FilterMixin):
         net = self.parent
         get_vtype_for_mode = scenario.demand.vtypes.get_vtype_for_mode#( id_mode)
         id_vtype = get_vtype_for_mode(self.id_mode)
-        print '  self.id_mode',self.id_mode,'id_vtype',id_vtype
+        print('  self.id_mode',self.id_mode,'id_vtype',id_vtype)
         tripshapes = mapmatching.trips
         points = mapmatching.points
         
@@ -7286,7 +7286,7 @@ class GtfsShapeImporter(FilterMixin):
         for fileattr_raw in f.readline().split(sep):
             
             fileattr = fileattr_raw.strip().strip(aa)
-            print '  check fileattr *%s*, %d'%(fileattr,i)
+            print('  check fileattr *%s*, %d'%(fileattr,i))
             if fileattr == 'shape_id':
                 ind_shape_id = i
                 
@@ -7324,7 +7324,7 @@ class GtfsShapeImporter(FilterMixin):
                 id_shape = tripshapes.add_row(  ids_sumo = cols[ind_shape_id].strip(aa),
                                                 ids_vtype = id_vtype)
                                                 
-                print '  id_shape',id_shape,tripshapes.ids_vtype[id_shape],id_vtype
+                print('  id_shape',id_shape,tripshapes.ids_vtype[id_shape],id_vtype)
                 lons = []
                 lats = []
                 ind_shape = ind_shape_new
@@ -7369,7 +7369,7 @@ class GtfsStopGenerator(Process):
             self._results = Matchresults(   'matchresults',mapmatching)
         else:
             self._results =  results
-        print 'GtfsGenerator.__init__'
+        print('GtfsGenerator.__init__')
         self._init_common(  ident, 
                             parent = mapmatching,
                             name = 'GTFS Stop Generator', 
@@ -7458,7 +7458,7 @@ class GtfsStopGenerator(Process):
     #def place_stop(self, id_stop, name_stop, lat_stop, lon_ stop, **kwargs):
         
     def do(self):
-        print 'GtfsStopGenerator.do'
+        print('GtfsStopGenerator.do')
         # go through shapes.txt and match shapes with id_edges
         # > shape_id -> ids_edge
         # done through mapmatching
@@ -7558,11 +7558,11 @@ class GtfsStopGenerator(Process):
                 #else:
                 #    map_service_to_route[id_service] = cols[ind_route_id].strip().strip(aa)
                 map_trip_to_route[id_trip] = cols[ind_route_id].strip().strip(aa)
-                print '      *id_trip',id_trip,'id_service',id_service,'id_route',cols[ind_route_id].strip().strip(aa),'-> id_shape',id_shape
+                print('      *id_trip',id_trip,'id_service',id_service,'id_route',cols[ind_route_id].strip().strip(aa),'-> id_shape',id_shape)
                 
         f.close()
         
-        print '  result: len(map_trip_to_shape)',len(map_trip_to_shape),'different shapes',len(set(map_trip_to_shape.values())),'of',len(ids_gtsshape_set)
+        print('  result: len(map_trip_to_shape)',len(map_trip_to_shape),'different shapes',len(set(map_trip_to_shape.values())),'of',len(ids_gtsshape_set))
         #ids_trip = {}
         #for id_shape in gpstrips.ids_sumo[gpstrips.get_ids()]:
         #    ids_trip[id_shape] = map_shape_to_trip[id_shape]
@@ -7593,13 +7593,13 @@ class GtfsStopGenerator(Process):
                 if not trip_stops.has_key(id_trip):
                     trip_stops[id_trip] = []
                     trip_times[id_trip] = []
-                print '    for id_trip',id_trip,'* found id_stop',id_stop,'at id_shape',map_trip_to_shape[id_trip]
+                print('    for id_trip',id_trip,'* found id_stop',id_stop,'at id_shape',map_trip_to_shape[id_trip])
                 trip_stops[id_trip].append(id_stop)
                 trip_times[id_trip].append(cols[ind_departure_time].strip().strip(aa))
             
             
         f.close()
-        print '  result: len(trip_stops)',len(trip_stops)
+        print('  result: len(trip_stops)',len(trip_stops))
         
         # dictionary to map stop ID to shape ID that will be used 
         # to identify edge of stop
@@ -7680,8 +7680,8 @@ class GtfsStopGenerator(Process):
         accesslevelsmap = self.parent.get_accesslevelsmap()
         #gtfsstop_to_simstop = {}
         for id_stop, coord, stopname in zip(ids_stop_gtfs,coords, stopnames):
-            print '\n  id_stop',id_stop, coord,'id_gpstrip',get_id_gpstrip(stop_shapes[id_stop])
-            print '    id_gpsroute',gpstrips.ids_route_matched[get_id_gpstrip(stop_shapes[id_stop])]
+            print('\n  id_stop',id_stop, coord,'id_gpstrip',get_id_gpstrip(stop_shapes[id_stop]))
+            print('    id_gpsroute',gpstrips.ids_route_matched[get_id_gpstrip(stop_shapes[id_stop])])
             ids_edge_target = ids_edges_shape[gpstrips.ids_route_matched[get_id_gpstrip(stop_shapes[id_stop])]]
             #print '    ids_edge_target',ids_edge_target
             
@@ -7697,12 +7697,12 @@ class GtfsStopGenerator(Process):
             ind = 0
             is_hit = False
             n_hits = len(ids_edge_hit)
-            print '    n_hits',n_hits,'len(ids_edge_target)',len(ids_edge_target),'dists',dists
+            print('    n_hits',n_hits,'len(ids_edge_target)',len(ids_edge_target),'dists',dists)
             while (not is_hit) & (ind<n_hits):
                 #for id_edge in  ids_edge_hit:
                 id_edge =  ids_edge_hit[ind]
                 
-                print '      check id_edge', id_edge,id_edge in ids_edge_target
+                print('      check id_edge', id_edge,id_edge in ids_edge_target)
                 if  id_edge in ids_edge_target:
                     is_hit = self.place_stop(id_stop, stopname, id_edge, coord, edges, lanes, ptstops, id_mode_pt, id_mode_ped)
                     
@@ -7710,7 +7710,7 @@ class GtfsStopGenerator(Process):
                 ind += 1
                 
             if not is_hit:
-                print 'WARNING: no edge found for stop_id',id_stop,'id_gpstrip' ,get_id_gpstrip(stop_shapes[id_stop])
+                print('WARNING: no edge found for stop_id',id_stop,'id_gpstrip' ,get_id_gpstrip(stop_shapes[id_stop]))
                          
         
         ptstops.update_centroids()
@@ -7738,41 +7738,41 @@ class GtfsStopGenerator(Process):
     def place_stop(self, id_stop, stopname, id_edge, coord, edges, lanes, ptstops, id_mode_pt, id_mode_ped):
         ids_lane = edges.ids_lanes[id_edge]
         edgelength = edges.lengths[id_edge]
-        print  'place_stop on id_edge',id_edge,'edgelength',edgelength,'len(ids_lane)',len(ids_lane)
+        print( 'place_stop on id_edge',id_edge,'edgelength',edgelength,'len(ids_lane)',len(ids_lane))
         if (len(ids_lane)>=2):
-            print  '      check ped access',lanes.get_accesslevel([ids_lane[0]], id_mode_ped)
+            print( '      check ped access',lanes.get_accesslevel([ids_lane[0]], id_mode_ped))
             
             
             
             if lanes.get_accesslevel([ids_lane[0]], id_mode_ped)>-1:
-                print  '      check bus access',lanes.get_accesslevel([ids_lane[1]], id_mode_pt)
+                print( '      check bus access',lanes.get_accesslevel([ids_lane[1]], id_mode_pt))
                 if lanes.get_accesslevel([ids_lane[1]], id_mode_pt)>-1:
                     
                     ids_simstop_exist = ptstops.select_ids(ptstops.ids_lane.get_value() == ids_lane[1])
                     if len(ids_simstop_exist)>0:
-                        print '     there are already stops ids_simstop_exist',ids_simstop_exist
+                        print('     there are already stops ids_simstop_exist',ids_simstop_exist)
                         d_init = np.min(ptstops.positions_from[ids_simstop_exist])
                         d_end = edgelength-np.max(ptstops.positions_to[ids_simstop_exist])
-                        print '        d_init,d_end',d_init,d_end
+                        print('        d_init,d_end',d_init,d_end)
                         if d_init>d_end:
-                            print '       place stop in front of previous stops'
+                            print('       place stop in front of previous stops')
                             pos_from = d_init - self.length_stop
                             pos_to = d_init
-                            print '       try pos_from',pos_from
+                            print('       try pos_from',pos_from)
                             if pos_from < self.dist_edge_stop_min:
                                 pos_from = d_init - self.length_stop_min
-                                print '       try with shorter stop pos_from',pos_from
+                                print('       try with shorter stop pos_from',pos_from)
 
                             is_hit = pos_from > self.dist_edge_stop_min
                             
                         else:
-                            print '      place stop in behind previous stops'
+                            print('      place stop in behind previous stops')
                             pos_from = edgelength-d_end
                             pos_to = pos_from+self.length_stop
-                            print '       try pos_to',pos_to
+                            print('       try pos_to',pos_to)
                             if pos_to > edgelength-self.dist_edge_stop_min:
                                 pos_to = pos_from+self.length_stop_min
-                                print '       try with shorter stop pos_to',pos_to
+                                print('       try with shorter stop pos_to',pos_to)
                                 
                             is_hit = pos_to < edgelength-self.dist_edge_stop_min
                             
@@ -7780,35 +7780,35 @@ class GtfsStopGenerator(Process):
                     else:
                         
                         pos = edges.get_pos_from_coord(id_edge, coord)-0.5*self.dist_edge_stop_min
-                        print '     place stop nearest to GPS coordinate pos',pos
+                        print('     place stop nearest to GPS coordinate pos',pos)
                         if pos < self.dist_edge_stop_min:
                             pos_from = self.dist_edge_stop_min
                             pos_to = self.dist_edge_stop_min + self.length_stop
-                            print '       try pos_to',pos_to
+                            print('       try pos_to',pos_to)
                             if pos_to > edgelength-self.dist_edge_stop_min:
                                 pos_to = self.dist_edge_stop_min + self.length_stop_min
-                                print '       try with shorter stop pos_to',pos_to
+                                print('       try with shorter stop pos_to',pos_to)
                             is_hit = pos_to < edgelength-self.dist_edge_stop_min
                             
                         elif pos+ self.length_stop > edgelength-self.dist_edge_stop_min:
                             pos_from = edgelength-self.dist_edge_stop_min- self.length_stop
                             pos_to = edgelength-self.dist_edge_stop_min
-                            print '       try pos_from',pos_from
+                            print('       try pos_from',pos_from)
                             if pos_from < self.dist_edge_stop_min:
                                 pos_from = edgelength-self.dist_edge_stop_min- self.length_stop_min
-                                print '       try with shorter stop pos_from',pos_from
+                                print('       try with shorter stop pos_from',pos_from)
                             
                             is_hit =   pos_from > self.dist_edge_stop_min
                              
                         else:
-                            print '       stop fits'
+                            print('       stop fits')
                             pos_from = pos
                             pos_to = pos + self.length_stop
                             is_hit = True
                             
                         
                     if  is_hit:
-                        print '    Add stop',id_stop,'at id_edge',id_edge,'pos_from %d'%pos_from,'pos_to %d'%pos_to,'edgelength %d'%edgelength
+                        print('    Add stop',id_stop,'at id_edge',id_edge,'pos_from %d'%pos_from,'pos_to %d'%pos_to,'edgelength %d'%edgelength)
                         id_simstop = ptstops.make( id_stop,
                                                     id_lane = ids_lane[1],
                                                     position_from = pos_from,
@@ -7829,7 +7829,7 @@ class GtfsServiceGenerator(Process):
             self._results = Matchresults(   'matchresults',mapmatching)
         else:
             self._results =  results
-        print 'GtfsServiceGenerator.__init__'
+        print('GtfsServiceGenerator.__init__')
         self._init_common(  ident, 
                             parent = mapmatching,
                             name = 'GTFS Service Generator', 
@@ -7948,16 +7948,16 @@ class GtfsServiceGenerator(Process):
             date = cols[ind_date].strip().strip(aa)
             year,month,day = (date[0:4],date[4:6],date[6:8])
             id_service = cols[ind_service_id].strip().strip(aa)
-            print '  id_service',id_service,'year,month,day',year,month,day,(int(year) == self.year) ,(int(month) == self.month),(int(day) == self.day),
+            print('  id_service',id_service,'year,month,day',year,month,day,(int(year) == self.year) ,(int(month) == self.month),(int(day) == self.day),)
             #service_to_date [cols[ind_service_id].strip().strip(aa)] = (date[0:4],date[4:6],date[6:8])
             
             
             
             if (int(year) == self.year) & (int(month) == self.month) &(int(day) == self.day):
-                print 'valid'
+                print('valid')
                 ids_service_valid.append(cols[ind_service_id].strip().strip(aa))
             else:
-                print 'not valid'
+                print('not valid')
                 
         f.close()
         
@@ -7967,7 +7967,7 @@ class GtfsServiceGenerator(Process):
             else:
                 return self.schedule_simple(ids_service_valid)
         else:
-            print 'WARNING: no services found on specified date.'
+            print('WARNING: no services found on specified date.')
             return True
         
     def schedule_frequ_est(self, ids_service_valid):
@@ -8000,7 +8000,7 @@ class GtfsServiceGenerator(Process):
         ids_edges_shape = gpstrips.routes.get_value().ids_edges
         
         if not hasattr(mapmatching,'trip_stops'):
-            print 'WARNING: no stops found, please run PT stop generation first'
+            print('WARNING: no stops found, please run PT stop generation first')
             return False
         ##
         ## Generate timetables for ids_trip
@@ -8018,7 +8018,7 @@ class GtfsServiceGenerator(Process):
                 for id_trip in ids_trip:
                     
                     hs,ms,ss = trip_times[id_trip][0].split(':')
-                    print '  examin valid id_service',id_service,'id_trip',id_trip,'t',hs,ms,ss
+                    print('  examin valid id_service',id_service,'id_trip',id_trip,'t',hs,ms,ss)
                     hs = int(hs)
                     if (hs >= self.hour_begin)&(hs<self.hour_end):
                         time_start = hs*3600+int(ms)*60+int(ss)
@@ -8048,11 +8048,11 @@ class GtfsServiceGenerator(Process):
                         for time_start_check, _id_service, _id_trip in stopsequence_to_services[ids_simstop]:
                             is_found = time_start==time_start_check
                             if is_found:
-                                print '    WARNING: already existing id_trip',id_trip,'with time_start',time_start
+                                print('    WARNING: already existing id_trip',id_trip,'with time_start',time_start)
                                 break
                             
                         if not  is_found:
-                            print '    add id_trip',id_trip,'id_route',map_trip_to_route[id_trip],'time_start %s:%s'%(hs,ms)#,'to ids_simstop',ids_simstop
+                            print('    add id_trip',id_trip,'id_route',map_trip_to_route[id_trip],'time_start %s:%s'%(hs,ms))#,'to ids_simstop',ids_simstop
                             stopsequence_to_services[ids_simstop].append((time_start, id_service, id_trip))  
                     
 
@@ -8116,14 +8116,14 @@ class GtfsServiceGenerator(Process):
                                     ids_edge= ids_edge,
                                     id_vtype= id_vtype,
                                     )
-            print '\n',70*'-'
-            print '  scheduled',linename,'time_start %d'%time_start,'time_end %d'%time_end,'frequ %d'%freq,'id_stop',trip_stops[id_trip][0]
-            print '      id_gpstrip',id_gpstrip,'id_gpsroute',gpstrips.ids_route_matched[id_gpstrip]
-            print '        ids_simstop',ids_simstop
-            print '        ids_edge',ids_edge
+            print('\n',70*'-')
+            print('  scheduled',linename,'time_start %d'%time_start,'time_end %d'%time_end,'frequ %d'%freq,'id_stop',trip_stops[id_trip][0])
+            print('      id_gpstrip',id_gpstrip,'id_gpsroute',gpstrips.ids_route_matched[id_gpstrip])
+            print('        ids_simstop',ids_simstop)
+            print('        ids_edge',ids_edge)
             t = time_first                        
             for time_start, id_service, id_trip in services:
-                print '           check id_trip',id_trip,'time_start %d'%time_start,'t %.d'%t,'delay',time_start-t
+                print('           check id_trip',id_trip,'time_start %d'%time_start,'t %.d'%t,'delay',time_start-t)
                 t = t + freq
             id_estservice += 1     
             
@@ -8196,7 +8196,7 @@ class GtfsServiceGenerator(Process):
         ids_edges_shape = gpstrips.routes.get_value().ids_edges
         
         if not hasattr(mapmatching,'trip_stops'):
-            print 'WARNING: no stops found, please run PT stop generation first'
+            print('WARNING: no stops found, please run PT stop generation first')
             return False
         ##
         ## Generate timetables for ids_trip
@@ -8207,8 +8207,8 @@ class GtfsServiceGenerator(Process):
         # which is different from the GTFS service ID
         stopsequence_to_services = {}
         for id_service, ids_trip in mapmatching.map_service_to_trips.iteritems():
-            print '-'*70
-            print 'id_service',id_service
+            print('-'*70)
+            print('id_service',id_service)
             schedules=[]# contains all trip data of a service
             for id_trip in ids_trip:
                 #print '  time',trip_times[id_trip][0],'\t id_stop',trip_stops[id_trip][0],id_trip
@@ -8249,9 +8249,9 @@ class GtfsServiceGenerator(Process):
                                     id_vtype= gpstrips.ids_vtype[id_gpstrip],
                                     )
                         
-                print '  scheduled',linename,"start%d"%time_start,'id_stop',trip_stops[id_trip][0],'id_gpstrip',id_gpstrip,'id_gpsroute',gpstrips.ids_route_matched[id_gpstrip]
-                print '        ids_simstop',ids_simstop
-                print '        ids_edge',ids_edge
+                print('  scheduled',linename,"start%d"%time_start,'id_stop',trip_stops[id_trip][0],'id_gpstrip',id_gpstrip,'id_gpsroute',gpstrips.ids_route_matched[id_gpstrip])
+                print('        ids_simstop',ids_simstop)
+                print('        ids_edge',ids_edge)
         
         
             
@@ -8752,7 +8752,7 @@ class GpsTrips(Trips):
         """
         Shortest fastest routing.
         """
-        print 'route_fastest_with_waits',time_modespecific,c_modespecific
+        print('route_fastest_with_waits',time_modespecific,c_modespecific)
         # TODO: if too mant vtypes, better go through id_modes
         exectime_start = time.clock()
         scenario = self.parent.get_scenario()
@@ -8857,7 +8857,7 @@ class GpsTrips(Trips):
                         #print '  routes.ids_edges' ,routes.ids_edges[id_route]
         
         
-        print '  exectime',time.clock()-exectime_start 
+        print('  exectime',time.clock()-exectime_start )
         
     def route_fastest(self, time_modespecific = 3.0, c_modespecific = 0.9, 
                         is_ignor_connections = False,
@@ -8865,7 +8865,7 @@ class GpsTrips(Trips):
         """
         Shortest fastest routing.
         """
-        print 'route_fastest',time_modespecific,c_modespecific
+        print('route_fastest',time_modespecific,c_modespecific)
         # TODO: if too mant vtypes, better go through id_modes
         exectime_start = time.clock()
         scenario = self.parent.get_scenario()
@@ -8960,14 +8960,14 @@ class GpsTrips(Trips):
                         #print '  routes.ids_edges' ,routes.ids_edges[id_route]
         
         
-        print '  exectime',time.clock()-exectime_start 
+        print('  exectime',time.clock()-exectime_start )
     
     def route_generic(self, weightsmap = None, is_ignor_connections = False, 
                                 color_route = None,):
         """
         Generic path routing.
         """
-        print 'route_generic'
+        print('route_generic')
         # TODO: if too mant vtypes, better go through id_modes
         exectime_start = time.clock()
         scenario = self.parent.get_scenario()
@@ -9043,7 +9043,7 @@ class GpsTrips(Trips):
                         #print '  routes.ids_edges' ,routes.ids_edges[id_route]
         
         
-        print '  exectime',time.clock()-exectime_start 
+        print('  exectime',time.clock()-exectime_start )
             
     def route_shortest(self, dist_modespecific = 5.0, c_modespecific = 0.9, 
                         is_ignor_connections = False, dist_min_modespecific= 15.0,
@@ -9051,7 +9051,7 @@ class GpsTrips(Trips):
         """
         Shortest path routing.
         """
-        print 'route_shortest',dist_modespecific,c_modespecific
+        print('route_shortest',dist_modespecific,c_modespecific)
         # TODO: if too mant vtypes, better go through id_modes
         exectime_start = time.clock()
         scenario = self.parent.get_scenario()
@@ -9140,7 +9140,7 @@ class GpsTrips(Trips):
                         #print '  routes.ids_edges' ,routes.ids_edges[id_route]
         
         
-        print '  exectime',time.clock()-exectime_start 
+        print('  exectime',time.clock()-exectime_start )
         
     def get_ids_edge_matched(self, id_trip):
         return self.get_routes().ids_edges[self.ids_route_matched[id_trip]]
@@ -9198,7 +9198,7 @@ class GpsTrips(Trips):
     
     def get_ids_route_selected(self):
         # TODO: here we could append direct routes 
-        print 'get_ids_route_selected'
+        print('get_ids_route_selected')
         ids_route_matched = self.ids_route_matched[self.get_ids_selected()]
         ids_route_shortest = self.ids_route_shortest[self.get_ids_selected()]
         ids_route_fastest = self.ids_route_fastest[self.get_ids_selected()]
@@ -9570,7 +9570,7 @@ class GpsPersons(am.ArrayObjman):
         if hasattr(self,'ids_genders'): self.delete('ids_genders') 
     
     def analyze(self):
-        print 'Persons.analyze'
+        print('Persons.analyze')
         #ids_person = self.select_ids(self.) 
         trips = self.parent.trips
         points = self.parent.points
@@ -9599,7 +9599,7 @@ class GpsPersons(am.ArrayObjman):
             # get selected trips only
             ids_trip = np.array(ids_trip_all)[trips.are_selected[ids_trip_all] ]      
             
-            print '   analyze person',id_person,'ids_trip',ids_trip
+            print('   analyze person',id_person,'ids_trip',ids_trip)
             
             if ids_trip is not None:
                 if len(ids_trip) > 0:
@@ -9649,7 +9649,7 @@ class GpsPersons(am.ArrayObjman):
             # get selected trips only
             ids_trip = np.array(ids_trip_all)[trips.are_selected[ids_trip_all] ]      
             
-            print '   analyze person',id_person,'ids_trip',ids_trip
+            print('   analyze person',id_person,'ids_trip',ids_trip)
             
             if ids_trip is not None:
                 n_trips = len(ids_trip)
@@ -9678,7 +9678,7 @@ class GpsPersons(am.ArrayObjman):
             self.ids_trips[id_pers].append(id_trip)
         
     def make(self, id_sumo, **kwargs):
-        print 'make id_pers_sumo',id_sumo
+        print('make id_pers_sumo',id_sumo)
         
         id_trip = kwargs.get('id_trip',-1)
         if self.ids_sumo.has_index(id_sumo):
@@ -9732,15 +9732,15 @@ class GpsPersons(am.ArrayObjman):
                                     years_birth= kwargs.get('year_birth',None),
                                     ids_occupation= id_occupation,
                                     are_frequent_user= kwargs.get('is_frequent_user',None),
-									incomes= kwargs.get('income',None),
-									ethnicities= kwargs.get('ethnicity',None),
-									home_zips= kwargs.get('home_zip',None),
-									school_zips= kwargs.get('school_zip',None),
-									work_zips= kwargs.get('work_zip',None),
-									cycling_frequencies= kwargs.get('cycling_frequency',None),
-									cycling_histories= kwargs.get('cycling_history',None),
-									cyclist_types= kwargs.get('cyclist_type',None),
-									ages_strava= kwargs.get('age_strava',None),
+                                    incomes= kwargs.get('income',None),
+                                    ethnicities= kwargs.get('ethnicity',None),
+                                    home_zips= kwargs.get('home_zip',None),
+                                    school_zips= kwargs.get('school_zip',None),
+                                    work_zips= kwargs.get('work_zip',None),
+                                    cycling_frequencies= kwargs.get('cycling_frequency',None),
+                                    cycling_histories= kwargs.get('cycling_history',None),
+                                    cyclist_types= kwargs.get('cyclist_type',None),
+                                    ages_strava= kwargs.get('age_strava',None),
                                     )
             if id_trip>=0:
                 self.ids_trips[id_pers] = [id_trip]
@@ -9785,7 +9785,7 @@ class Mapmatching(DemandobjMixin, cm.Bas
         
             
         def _init_attributes(self):
-            print 'Mapmatching._init_attributes'
+            print('Mapmatching._init_attributes')
             attrsman = self.get_attrsman()
             
             self.points = attrsman.add( cm.ObjConf(GpsPoints('points',self)))
@@ -9911,7 +9911,7 @@ class Mapmatching(DemandobjMixin, cm.Bas
             Returns a dictionary where key is id_mode and
             value is a distance-lookup table, mapping id_edge to edge distance
             """
-            print 'get_distancesmap',self._distancesmap is None
+            print('get_distancesmap',self._distancesmap is None)
             
             
             if self._distancesmap is None:
@@ -9920,7 +9920,7 @@ class Mapmatching(DemandobjMixin, cm.Bas
                     vtypes = self.get_scenario().demand.vtypes
                     ids_vtype = self.trips.ids_vtype[self.trips.get_ids()]
                     ids_mode = vtypes.ids_mode[ids_vtype]
-                print '    ids_mode',set(ids_mode),len(ids_mode)
+                print('    ids_mode',set(ids_mode),len(ids_mode))
             
                 self._distancesmap = {}
                 for id_mode in set(ids_mode):
@@ -9939,7 +9939,7 @@ class Mapmatching(DemandobjMixin, cm.Bas
             Returns a dictionary where key is id_mode and
             value is the corrisponding fstar.
             """
-            print 'get_fstarmap',self._fstarmap is None
+            print('get_fstarmap',self._fstarmap is None)
             
             
             if self._fstarmap is None:
@@ -9948,7 +9948,7 @@ class Mapmatching(DemandobjMixin, cm.Bas
                     vtypes = self.get_scenario().demand.vtypes
                     ids_vtype = self.trips.ids_vtype[self.trips.get_ids()]
                     ids_mode = vtypes.ids_mode[ids_vtype]
-                print '    ids_mode',set(ids_mode),len(ids_mode)
+                print('    ids_mode',set(ids_mode),len(ids_mode))
             
                 self._fstarmap = {}
                 for id_mode in set(ids_mode):
@@ -9976,7 +9976,7 @@ class Mapmatching(DemandobjMixin, cm.Bas
                     vtypes = self.get_scenario().demand.vtypes
                     ids_vtype = self.trips.ids_vtype[self.trips.get_ids()]
                     ids_mode = vtypes.ids_mode[ids_vtype]
-                print '    ids_mode',set(ids_mode),len(ids_mode)
+                print('    ids_mode',set(ids_mode),len(ids_mode))
                 
             
             
@@ -10253,17 +10253,17 @@ class Nodesresults(am.ArrayObjman):
         the average wait tie at node id_node is
         times_wait_est[id_node]
         """
-        print 'get_times_wait_est'
+        print('get_times_wait_est')
         nodes = self.ids_node.get_linktab()
         ids_node = nodes.get_ids()
         ids_node_signif = self.get_nodes_significant()
         #nodetypes = nodes.types[ids_node_signif]
         map_nodetype_to_times_wait = self.get_map_nodetype_to_times_wait()
         
-        print '  map_nodetype_to_times_wait',map_nodetype_to_times_wait
+        print('  map_nodetype_to_times_wait',map_nodetype_to_times_wait)
         
         times_wait = np.zeros(max(ids_node)+1, dtype = np.int32)
-        print '  ',np.min(nodes.types[ids_node_signif]),np.max(nodes.types[ids_node_signif])
+        print('  ',np.min(nodes.types[ids_node_signif]),np.max(nodes.types[ids_node_signif]))
         
         times_wait[ids_node_signif] = map_nodetype_to_times_wait[nodes.types[ids_node_signif]]
         
@@ -10272,7 +10272,7 @@ class Nodesresults(am.ArrayObjman):
         return  times_wait   
         
     def get_map_nodetype_to_times_wait(self):
-        print 'get_map_nodetype_to_times_wait'
+        print('get_map_nodetype_to_times_wait')
         nodes = self.ids_node.get_linktab()
         ids_res = self.get_ids()
         nodetypes =  nodes.types[self.ids_node[ids_res]]
@@ -10503,7 +10503,7 @@ class Edgesresults(am.ArrayObjman):
         # return result ids and respective edge ids
         ids_edgeresmap = np.zeros(np.max(ids_edge_init)+1,dtype = np.int32)
         ids_edgeresmap[ids_edge_init] = self.add_rows(n=len(ids_edge_init), ids_edge = ids_edge_init)
-        print 'init_for_routes: created',len(ids_edge_init),'entries for edgeresults  max(ids_edge)', np.max(ids_edge_init)
+        print('init_for_routes: created',len(ids_edge_init),'entries for edgeresults  max(ids_edge)', np.max(ids_edge_init))
 
         return ids_edgeresmap
     
@@ -10516,7 +10516,7 @@ class Edgesresults(am.ArrayObjman):
         # return result ids and respective edge ids
         ids_edgeresmap = np.zeros(np.max(ids_edge_init)+1,dtype = np.int32)
         ids_edgeresmap[ids_edge_init] = self.add_rows(n=len(ids_edge_init), ids_edge = ids_edge_init)
-        print 'init_for_routes: created',len(ids_edge_init),'entries for edgeresults  max(ids_edge)', np.max(ids_edge_init)
+        print('init_for_routes: created',len(ids_edge_init),'entries for edgeresults  max(ids_edge)', np.max(ids_edge_init))
         return ids_edgeresmap
     
     def get_edgeresmap(self):
@@ -10753,7 +10753,7 @@ class Connectionsresults(am.ArrayObjman)
         # return result ids and respective edge ids
         ids_connectionresmap = np.zeros(np.max(ids_connection_init)+1,dtype = np.int32)
         ids_connectionresmap[ids_connection_init] = self.add_rows(n=len(ids_connection_init), ids_connection = ids_connection_init)
-        print 'init_for_routes: created',len(ids_connection_init),'entries for connectionresults  max(ids_connection)', np.max(ids_connection_init)
+        print('init_for_routes: created',len(ids_connection_init),'entries for connectionresults  max(ids_connection)', np.max(ids_connection_init))
         return ids_connectionresmap
     
     def get_connectionresmap(self):
@@ -11383,7 +11383,7 @@ class Routesresults(am.ArrayObjman):
 
 class Shortestrouter(Process):
     def __init__(self, ident, mapmatching,  logger = None, **kwargs):
-        print 'Shortestrouter.__init__'
+        print('Shortestrouter.__init__')
         
         # TODO: let this be independent, link to it or child??
         
@@ -11441,7 +11441,7 @@ class Shortestrouter(Process):
                                         ))
                                         
     def do(self):
-        print 'Shortestrouter.do'
+        print('Shortestrouter.do')
         # links
         mapmatching = self.parent
         trips = mapmatching.trips
@@ -11455,7 +11455,7 @@ class Shortestrouter(Process):
                                          
 class Fastestrouter(Process):
     def __init__(self, ident, mapmatching,  logger = None, matchresults = None, **kwargs):
-        print 'Fastestrouter.__init__'
+        print('Fastestrouter.__init__')
         
         # TODO: let this be independent, link to it or child??
         
@@ -11528,7 +11528,7 @@ class Fastestrouter(Process):
     def do(self):
         mapmatching = self.parent
         trips = mapmatching.trips
-        print 'Shortestrouter.do is_use_nodeswaittimes_est',self.is_use_nodeswaittimes_est,(self.matchresults is not None)
+        print('Shortestrouter.do is_use_nodeswaittimes_est',self.is_use_nodeswaittimes_est,(self.matchresults is not None))
         # links
         
         # map_nodetype_to_times_wait = get_map_nodetype_to_times_wait
@@ -11698,7 +11698,7 @@ class AlternativeRoutesresults(am.ArrayO
                                                                                      
 class AlternativeRoutesanalyzer(Process):
     def __init__(self, ident, mapmatching, results = None,  logger = None, **kwargs):
-        print 'AlternativeRoutesanalyzer.__init__'
+        print('AlternativeRoutesanalyzer.__init__')
         
         # TODO: let this be independent, link to it or child??
         
@@ -11792,7 +11792,7 @@ class AlternativeRoutesanalyzer(Process)
         return   self._results 
     
     def do(self):
-        print 'AlternativeRoutesanalyzer.do'
+        print('AlternativeRoutesanalyzer.do')
         # results
         results = self.get_results()
         altroutesresults = results.altroutesresults
@@ -11864,10 +11864,10 @@ class AlternativeRoutesanalyzer(Process)
         
         #ind = 0
         if len(ids_trip)==0:
-            print 'WARNING: no trips selected.'
+            print('WARNING: no trips selected.')
             return True
         
-        print '  analyzing %d trips'%len(ids_trip)
+        print('  analyzing %d trips'%len(ids_trip))
         
         
         #ids_res = routesresults_matched.add_rows(n=len(ids_trip),)
@@ -11888,8 +11888,8 @@ class AlternativeRoutesanalyzer(Process)
                         routes.ids_edges[ids_route_fastest],
                         ids_mode, 
                         ):
-            print 79*'*'
-            print '  id_trip',id_trip
+            print(79*'*')
+            print('  id_trip',id_trip)
             
             # edge weights for routing, which is mode specific
             # because non accessible edges are marked with weight = -1 
@@ -11925,7 +11925,7 @@ class AlternativeRoutesanalyzer(Process)
                     if id_edge_matched != id_edge_shortest:
                         
                         dist = np.sum(weights[route_ol])
-                        print '     overlapped route len',len(route_ol),'d',dist
+                        print('     overlapped route len',len(route_ol),'d',dist)
                         if (len(route_ol) >= self.n_edge_min) & (dist > self.dist_alt_min):
                             #print '       store and finish route_ol',route_ol
                             routesets_overlap.append([route_ol,])
@@ -11960,7 +11960,7 @@ class AlternativeRoutesanalyzer(Process)
                         # collect data of matched and shortest route section
                         dist_matched = np.sum(weights[route_matched_nol])
                         dist_shortest = np.sum(weights[route_shortest_nol])
-                        print '     nonoverlapped route len',len(route_shortest_nol),'dm',dist_matched,'ds',dist_shortest,'dd',dist_matched-dist_shortest
+                        print('     nonoverlapped route len',len(route_shortest_nol),'dm',dist_matched,'ds',dist_shortest,'dd',dist_matched-dist_shortest)
                         if (len(route_matched_nol)>=self.n_edge_min)\
                            &(len(route_shortest_nol)>=self.n_edge_min)\
                            &(dist_matched > self.dist_alt_min)\
@@ -12014,7 +12014,7 @@ class AlternativeRoutesanalyzer(Process)
         
         
         
-        print '  create shortest routes around overlapping routes',len(routesets_overlap)
+        print('  create shortest routes around overlapping routes',len(routesets_overlap))
         for routeset_overlap, routeset_overlap_dists  in zip(routesets_overlap, routesets_overlap_dists):
             # routesets_overlap has initially the onlu selected route
             ids_edge = routeset_overlap[0]
@@ -12048,7 +12048,7 @@ class AlternativeRoutesanalyzer(Process)
             
         
         if 0:
-            print 79*'='  
+            print(79*'='  )
             n_overl = 0  
             for routeset_nonoverlap, routeset_nonoverlap_dists  in zip(routesets_nonoverlap,routesets_nonoverlap_dists):
                 print
@@ -12056,13 +12056,13 @@ class AlternativeRoutesanalyzer(Process)
                 if len(routeset_nonoverlap)>0:
                     n_overl += 1
                     for ids_edge, dist in zip(routeset_nonoverlap, routeset_nonoverlap_dists):
-                        print '    nonoverl d=%dfm, delta=%dm'%(dist,dist-dist_min),dist#,'ids_edge',ids_edge
+                        print('    nonoverl d=%dfm, delta=%dm'%(dist,dist-dist_min),dist)#,'ids_edge',ids_edge
                 
-            print '  len(routesets_nonoverlap)',len(routesets_nonoverlap),len(ids_trip_routesets_overlap),len(routesets_overlap_dists)
+            print('  len(routesets_nonoverlap)',len(routesets_nonoverlap),len(ids_trip_routesets_overlap),len(routesets_overlap_dists))
             
             
         if 0:
-            print 79*'='  
+            print(79*'='  )
             n_overl = 0  
             for routeset_overlap, routeset_overlap_dists  in zip(routesets_overlap,routesets_overlap_dists):
                 print
@@ -12070,10 +12070,10 @@ class AlternativeRoutesanalyzer(Process)
                 if len(routeset_overlap)>0:
                     n_overl += 1
                     for ids_edge, dist in zip(routeset_overlap, routeset_overlap_dists):
-                        print '    overl d=%dfm, delta=%dm'%(dist,dist-dist_min),'ids_edge',ids_edge
+                        print('    overl d=%dfm, delta=%dm'%(dist,dist-dist_min),'ids_edge',ids_edge)
                 
             
-            print '  len(routesets_overlap)',n_overl,len(ids_trip_routesets_nonoverlap),len(routesets_nonoverlap_dists)
+            print('  len(routesets_overlap)',n_overl,len(ids_trip_routesets_nonoverlap),len(routesets_nonoverlap_dists))
         
         self._samplecount = 0
         self._id_alt_last = 10**8
@@ -12083,13 +12083,13 @@ class AlternativeRoutesanalyzer(Process)
         #print '  routesets_nonoverlap',routesets_nonoverlap
         #print '  routesets_nonoverlap_dists',routesets_nonoverlap_dists
         
-        print 79*'*' 
-        print '  create alternative routes database'
+        print(79*'*' )
+        print('  create alternative routes database')
         
         # do all non-overlap routes
         for id_trip, routeset_nonoverlap, routeset_nonoverlap_dists, id_mode  in zip(ids_trip_routesets_nonoverlap, routesets_nonoverlap,routesets_nonoverlap_dists,ids_mode_routesets_nonoverlap):
-            print 79*'-'
-            print '  id_trip NOL',id_trip,len(routeset_overlap)
+            print(79*'-')
+            print('  id_trip NOL',id_trip,len(routeset_overlap))
             #print '    routeset_nonoverlap',routeset_nonoverlap
             #print '    dists',routeset_nonoverlap_dists
             if len(routeset_nonoverlap) >= 2:
@@ -12101,8 +12101,8 @@ class AlternativeRoutesanalyzer(Process)
         
         # do all overlap and generated routes
         for id_trip, routeset_overlap, routeset_overlap_dists, id_mode  in zip(ids_trip_routesets_overlap, routesets_overlap,routesets_overlap_dists, ids_mode_routesets_overlap):
-            print 79*'-'
-            print '  id_trip OL',id_trip,len(routeset_overlap)
+            print(79*'-')
+            print('  id_trip OL',id_trip,len(routeset_overlap))
             if len(routeset_overlap) >= 2:
                 # add chosen, matched and overlapping route
                 self.add_alternative(id_trip,np.array(routeset_overlap[0], dtype=np.int32),1, True, routeset_overlap_dists[0], id_mode)
@@ -12133,7 +12133,7 @@ class AlternativeRoutesanalyzer(Process)
         #print '  ids_edge[accesses[ids_edge]==1]',ids_edge[accesses[ids_edge]==1]
         #print '  edgelengths[ids_edge[accesses[ids_edge]==1]]',edgelengths[ids_edge[accesses[ids_edge]==1]]
         
-        print 'add_alternative',id_trip,id_alt,is_selected, 'dist',dist,np.sum(edgelengths[ids_edge]),'excl',np.sum(edgelengths[ids_edge[accesses[ids_edge]==2]])
+        print('add_alternative',id_trip,id_alt,is_selected, 'dist',dist,np.sum(edgelengths[ids_edge]),'excl',np.sum(edgelengths[ids_edge[accesses[ids_edge]==2]]))
         id_res = self.altroutesresults.add_row(\
                                   ids_trip = id_trip,
                                   counter = self._samplecount,
@@ -17001,7 +17001,7 @@ class TripsDatabaseAnalyzer(Process):
     
 class Routesanalyzer(Process):
     def __init__(self, ident, mapmatching, results = None,  logger = None, **kwargs):
-        print 'Routesanalyzer.__init__'
+        print('Routesanalyzer.__init__')
         
         # TODO: let this be independent, link to it or child??
         
@@ -17178,7 +17178,7 @@ class Routesanalyzer(Process):
     
     
     def do(self):
-        print 'Routesanalyzer.do'
+        print('Routesanalyzer.do')
         # results
         results = self.get_results()
         routesresults_shortest = results.routesresults_shortest
@@ -17243,10 +17243,10 @@ class Routesanalyzer(Process):
         
         #ind = 0
         if len(ids_trip)==0:
-            print 'WARNING: no trips selected.'
+            print('WARNING: no trips selected.')
             return True
         
-        print '  analyzing %d trips'%len(ids_trip)
+        print('  analyzing %d trips'%len(ids_trip))
         
         routesresults_shortest.clear()
         routesresults_matched.clear()
@@ -17320,8 +17320,8 @@ class Routesanalyzer(Process):
             
             
             if 1:
-                print 70*'-'
-                print 'id_trip',id_trip,'Routes: id_matched',id_route_matched,'id_shortest',id_route_shortest,'id_fastest',id_route_fastest
+                print(70*'-')
+                print('id_trip',id_trip,'Routes: id_matched',id_route_matched,'id_shortest',id_route_shortest,'id_fastest',id_route_fastest)
                 
             #ids_point = trips.ids_points[id_trip]
             distances = distancesmap[id_mode]
@@ -17473,7 +17473,7 @@ class Routesanalyzer(Process):
                         if element in possible_connections:
                             connections_list.append(element)
                     if connections_list == []:
-                        print 'Error: map matching process should be done without ignoring connections'  
+                        print('Error: map matching process should be done without ignoring connections'  )
                         break 
                     lane_index_connections = lanes.indexes[connections.ids_fromlane[connections_list]] + lanes.indexes[connections.ids_tolane[connections_list]]
                     connection = connections_list[np.argmin(lane_index_connections)]
@@ -17597,7 +17597,7 @@ class Routesanalyzer(Process):
                     else:
 ##                        print '11'
                         is_adeguate = False
-                        print 'too few or points or edges involved' 
+                        print('too few or points or edges involved' )
                         break
 ##                                                #If the problem occour to the second points 
 ##                                                else:
@@ -17807,7 +17807,7 @@ class Routesanalyzer(Process):
                                         
                                     if id_arc_point != id_arc_pre:
                                         n_wait_times_edge_at_int[lanes.ids_edge[connections.ids_fromlane[id_arc_point]]] += 1
-                                        print 'connection', id_arc_point, 'n +1'
+                                        print('connection', id_arc_point, 'n +1')
                                         n_wait_times_node[edges.ids_tonode[lanes.ids_edge[connections.ids_fromlane[id_arc_point]]]] += 1
                                         if connections.turns_type[id_arc_point] == 'left_turn':
                                             number_wait_route_at_left_turns += 1
@@ -17851,7 +17851,7 @@ class Routesanalyzer(Process):
                                 if id_arc_point != id_arc_pre and last_conn > 0:
                                     connections_waitingtimes[last_conn].append(current_waitingtime_total)
                                     nodes_waitingtimes[edges.ids_tonode[lanes.ids_edge[connections.ids_fromlane[last_conn]]]].append(current_waitingtime_total)
-                                    print 'ADD', 'current_waitingtime_total', current_waitingtime_total, 'id_arc_point', last_conn
+                                    print('ADD', 'current_waitingtime_total', current_waitingtime_total, 'id_arc_point', last_conn)
                                     current_waitingtime_total = 0.0
                                 
                                 if is_connection_point:
@@ -17863,7 +17863,7 @@ class Routesanalyzer(Process):
                                 if id_arc_point != id_arc_pre:
                                     current_waitingtime_total = 0.0
                                 current_waitingtime_total  += delta_time
-                                print 'current_waitingtime_total', current_waitingtime_total, 'id_arc_point', id_arc_point
+                                print('current_waitingtime_total', current_waitingtime_total, 'id_arc_point', id_arc_point)
                                 id_arc_pre = id_arc_point
 
                         
@@ -17871,10 +17871,10 @@ class Routesanalyzer(Process):
                     if last_conn > 0:
                         connections_waitingtimes[last_conn].append(current_waitingtime_total)
                         nodes_waitingtimes[edges.ids_tonode[lanes.ids_edge[connections.ids_fromlane[last_conn]]]].append(current_waitingtime_total)
-                        print 'ADD', 'current_waitingtime_total', current_waitingtime_total, 'id_arc_point', last_conn
+                        print('ADD', 'current_waitingtime_total', current_waitingtime_total, 'id_arc_point', last_conn)
                         current_waitingtime_total = 0.0
-                    print 'there were', len(irregular_indices), 'irregular indices'    
-                    print 'time_wait_route', time_wait_route,'time_wait_junction_route',time_wait_junction_route, 'time_wait_tls_route', time_wait_tls_route
+                    print('there were', len(irregular_indices), 'irregular indices'    )
+                    print('time_wait_route', time_wait_route,'time_wait_junction_route',time_wait_junction_route, 'time_wait_tls_route', time_wait_tls_route)
 ##                    print 'GOOD TRACES', good_traces, 'OF',(good_traces+bad_traces) ,'/',len(ids_trip)        
                     
                     #Find all connection for the connection results
@@ -17971,7 +17971,7 @@ class Routesanalyzer(Process):
 
 ##                    plt.show()
                     bad_traces+=1
-                    print 'trip', id_trip, 'is not adeguate for the speed analysis or too few points remained after point filtering, with', len(irregular_indices), 'irregular points'
+                    print('trip', id_trip, 'is not adeguate for the speed analysis or too few points remained after point filtering, with', len(irregular_indices), 'irregular points')
 
                     routesresults_matched.times_inmotion[id_res]= -1.
                     routesresults_matched.n_times_wait[id_res] = -1.
@@ -18001,7 +18001,7 @@ class Routesanalyzer(Process):
                     
                     
                 
-                print 'There were', good_traces, 'good traces and', bad_traces, 'bad traces', 'of',(good_traces+bad_traces) ,'/',len(ids_trip)
+                print('There were', good_traces, 'good traces and', bad_traces, 'bad traces', 'of',(good_traces+bad_traces) ,'/',len(ids_trip))
                     
 
         
@@ -18109,7 +18109,7 @@ class Routesanalyzer(Process):
                             if element in possible_connections:
                                 connections_list.append(element)
                         if connections_list == []:
-                            print 'Error: map matching process should be done without ignoring connections'  
+                            print('Error: map matching process should be done without ignoring connections'  )
                             break 
                         lane_index_connections = lanes.indexes[connections.ids_fromlane[connections_list]] + lanes.indexes[connections.ids_tolane[connections_list]]
                         connection = connections_list[np.argmin(lane_index_connections)]
@@ -18146,20 +18146,20 @@ class Routesanalyzer(Process):
                 dist_shortest = np.sum(distances[ids_edge_shortest])
                 
                 if 0:
-                    print '\n  shortest dist ana'
+                    print('\n  shortest dist ana')
                     d_cum = 0.0
                     l_cum = 0.0
                     for id_edge in ids_edge_shortest:
                         d_cum += distances[id_edge]
                         l_cum += edges.lengths[id_edge]
-                        print '  id_edge_short',id_edge,'dist',distances[id_edge],'length',edges.lengths[id_edge],'c_cum',d_cum,'l_cum',l_cum
+                        print('  id_edge_short',id_edge,'dist',distances[id_edge],'length',edges.lengths[id_edge],'c_cum',d_cum,'l_cum',l_cum)
                     print
                     d_cum = 0.0
                     l_cum = 0.0
                     for id_edge in ids_edge:
                         d_cum += distances[id_edge]
                         l_cum += edges.lengths[id_edge]
-                        print '  id_edge_matched',id_edge,'dist',distances[id_edge],'length',edges.lengths[id_edge],'c_cum',d_cum,'l_cum',l_cum
+                        print('  id_edge_matched',id_edge,'dist',distances[id_edge],'length',edges.lengths[id_edge],'c_cum',d_cum,'l_cum',l_cum)
                             
                     
                 n_nodes_shortest = len(nodetypes_shortest)
@@ -18531,7 +18531,7 @@ class Routesanalyzer(Process):
         routesresults_matched.expected_waiting_times_tot_route_matched_tls_nodes[ids_routesresults_matched] = expected_waiting_times_tot_route_matched_tls_nodes[ids_routesresults_matched]
         routesresults_matched.expected_waiting_times_tot_route_matched_edges[ids_routesresults_matched] = expected_waiting_times_tot_route_matched_edges[ids_routesresults_matched]
         
-        print '  Route analyses done.'
+        print('  Route analyses done.')
         return True
     
     def get_connectionsresults_map(self):
@@ -18565,7 +18565,7 @@ class Routesanalyzer(Process):
         """
         Only overlap calculations.
         """
-        print 'Routesanalyzer.do_overlap'
+        print('Routesanalyzer.do_overlap')
         # results
         results = self.get_results()
         routesresults_shortest = results.routesresults_shortest
@@ -18618,10 +18618,10 @@ class Routesanalyzer(Process):
         
         #ind = 0
         if len(ids_trip)==0:
-            print 'WARNING: no trips selected.'
+            print('WARNING: no trips selected.')
             return True
         
-        print '  analyzing %d trips'%len(ids_trip)
+        print('  analyzing %d trips'%len(ids_trip))
         
         routesresults_shortest.clear()
         #routesresults_matched.clear()
@@ -18644,8 +18644,8 @@ class Routesanalyzer(Process):
             
             
             if 0:
-                print 70*'-'
-                print 'id_trip',id_trip,'Routes: id_matched',id_route_matched,'id_shortest',id_route_shortest,'id_fastest',id_route_fastest
+                print(70*'-')
+                print('id_trip',id_trip,'Routes: id_matched',id_route_matched,'id_shortest',id_route_shortest,'id_fastest',id_route_fastest)
                 
             #ids_point = trips.ids_points[id_trip]
             distances = distancesmap[id_mode]
@@ -18710,7 +18710,7 @@ class Routesanalyzer(Process):
                 
         
         
-        print '  Route overlap analyses done.'
+        print('  Route overlap analyses done.')
         return True
 
 class PtRoutesresults(am.ArrayObjman):
@@ -18872,7 +18872,7 @@ class PtLinesresults(am.ArrayObjman):
 
 class PtRoutesanalyzer(Process):
     def __init__(self, ident, mapmatching, results = None,  logger = None, **kwargs):
-        print 'Routesanalyzer.__init__'
+        print('Routesanalyzer.__init__')
         
         # TODO: let this be independent, link to it or child??
         
@@ -18927,7 +18927,7 @@ class PtRoutesanalyzer(Process):
     
     
     def do(self):
-        print 'Routesanalyzer.do'
+        print('Routesanalyzer.do')
         # results
         results = self.get_results()
         ptlinesresults = results.ptlinesresults
@@ -18974,7 +18974,7 @@ class PtRoutesanalyzer(Process):
                             
                     if type_link == type_transit:
                         if not numbercounter_lines.has_key(id_line):
-                            print id_line
+                            print(id_line)
                             numbercounter_lines[id_line] = 0
                             distancecounter_lines[id_line] = 0.0
                             timecounter_lines[id_line]  = 0.0
@@ -19036,7 +19036,7 @@ def routes_to_shapefile(mapmatching,resu
     """
     Writes routes to file.
     """
-    print '\n routes_to_shapefile for mapmatching'
+    print('\n routes_to_shapefile for mapmatching')
     net = mapmatching.get_scenario().net
     edges = net.edges
     trips = mapmatching.trips
@@ -19105,7 +19105,7 @@ def edgesresults_to_shapefile(mapmatchin
     """
     Writes edge results of mapmatching to shape-file.
     """
-    print '\n edgesresults_to_shapefile for mapmatching'
+    print('\n edgesresults_to_shapefile for mapmatching')
     net = mapmatching.get_scenario().net
     edges = net.edges
     edgesresults = results.edgesresults
@@ -19179,7 +19179,7 @@ def points_to_shapefile(mapmatching, fil
     # 
     
     
-    print 'nodes_to_shapefile',filepath
+    print('nodes_to_shapefile',filepath)
     
     for attr in attrlist:
         shapedata.add_field(attr[2:])
--- a/tools/contributed/sumopy/plugins/mapmatching/results_mpl.py
+++ b/tools/contributed/sumopy/plugins/mapmatching/results_mpl.py
@@ -257,7 +257,7 @@ class PointresultPlotter(PlotoptionsMixi
 
         # Plot net
         if self.is_net:
-            print 'plot net'
+            print('plot net')
             plot_net(ax, net, color_edge="gray", width_edge=2, color_node=None,
                      alpha=0.5)
         # Plot zones
@@ -306,7 +306,7 @@ class PointresultPlotter(PlotoptionsMixi
 # ids_final_point.tolist()
             ids_point = ids_initial_point.tolist()
             ids_point.extend(ids_final_point)
-            print ids_initial_point, ids_final_point, ids_points
+            print(ids_initial_point, ids_final_point, ids_points)
         if self.points_type == 4:
             ids_point = points.get_ids(points.are_selected.get_value() == True)
         coords = points.coords[ids_point]
@@ -325,7 +325,7 @@ class PointresultPlotter(PlotoptionsMixi
             for coord, id_point in zip(coords, ids_point):
                 coord = np.array([coord[0], coord[1]])
                 id_closest_edge = net.edges.get_closest_edge(coord)
-                print 'point', id_point
+                print('point', id_point)
                 if id_closest_edge > 0:
                     if self.select_points == 1:
                         time = (points.timestamps[id_point] - trips.timestamps[points.ids_trip[id_point]])/60.0
@@ -346,10 +346,10 @@ class PointresultPlotter(PlotoptionsMixi
                         # For the isochrone plot
 # if self.is_isochrone:
 ##                    times_point[id_point] = time
-            print 'number of points:', np.sum(count)
+            print('number of points:', np.sum(count))
 
             # Plot result on map
-            print 'plot results on map'
+            print('plot results on map')
             if self.select_points == 1:
                 title = 'Isochrone from the origin zone'
             if self.select_points == 2:
@@ -470,7 +470,7 @@ class PointresultPlotter(PlotoptionsMixi
                     else:
                         isochrone_shapes[i].append([(points.coords[iso_points[np.argmax(iso_points[:, 3]), 1]][0]),
                                                     (points.coords[iso_points[np.argmax(iso_points[:, 3]), 1]][1])])
-        print isochrone_shapes
+        print(isochrone_shapes)
         for isochrone_shape in isochrone_shapes:
             verts = np.array(isochrone_shape)[:, :2].tolist()
             verts.append([0, 0])
@@ -487,9 +487,9 @@ class PointresultPlotter(PlotoptionsMixi
 
             if len(isochrone_shape) > 4:
                 zone_shape = isochrone_shape
-                print zone_shape
+                print(zone_shape)
                 for zone_shape_coords, i in zip(isochrone_shape, range(len(isochrone_shape))):
-                    print i, len(isochrone_shape)
+                    print(i, len(isochrone_shape))
                     if i == 0:
                         zone_shape[i] = ((np.array(isochrone_shape[i])+np.array(isochrone_shape[i+1])+np.array(
                             isochrone_shape[-1])+np.array(isochrone_shape[i+2])+np.array(isochrone_shape[-2]))/5.).tolist()
@@ -599,7 +599,7 @@ class NoderesultPlotter(PlotoptionsMixin
         return self.parent.nodesresults
 
     def show(self):
-        print 'NoderesultPlotter.show', self.plottheme
+        print('NoderesultPlotter.show', self.plottheme)
         # if self.axis  is None:
         #axis = init_plot()
         self.init_figures()
@@ -607,9 +607,9 @@ class NoderesultPlotter(PlotoptionsMixin
         axis = fig.add_subplot(111)
         self.plotthemefuncs[self.plottheme](axis)
 
-        print '  self.is_save', self.is_save
+        print('  self.is_save', self.is_save)
         if not self.is_save:
-            print '  show_plot'
+            print('  show_plot')
             show_plot()
         else:
             figname = 'nodeplot_'+self.plottheme
@@ -628,7 +628,7 @@ class NoderesultPlotter(PlotoptionsMixin
             plt.close(fig)
 
     def plot_times_wait(self, ax):
-        print 'show noderesults', len(self.parent.nodesresults)
+        print('show noderesults', len(self.parent.nodesresults))
         # if self.axis  is None:
 
         nodesresults = self.parent.nodesresults
@@ -824,7 +824,7 @@ class SpeedprofilePlotter(PlotoptionsMix
 
     def plot_speed_over_time(self, ax, id_trip, id_route, edges, i_min=None, i_max=None,
                              is_pointlabel=True, alpha=1.0):
-        print 'plot_speed_over_time', id_trip, type(id_trip), self.parent.parent
+        print('plot_speed_over_time', id_trip, type(id_trip), self.parent.parent)
 
         #mapmatching = self.parent.parent
         #trips = mapmatching.trips
@@ -868,7 +868,7 @@ class SpeedprofilePlotter(PlotoptionsMix
 
         if is_scipy & (not (self.method_interp == 'linear')):
 
-            print 'use scipy to interpolate'
+            print('use scipy to interpolate')
             #tck = interpolate.splrep(x, y, s=0)
             #xnew = np.linspace(np.min(x), np.max(x), 200)
             #ynew = interpolate.splev(xnew, tck, der=0)
@@ -895,7 +895,7 @@ class SpeedprofilePlotter(PlotoptionsMix
 
     def plot_speed_over_way(self, ax, id_trip, id_route, edges, i_min=None, i_max=None,
                             is_pointlabel=True, alpha=1.0):
-        print 'plot_speed_over_way', id_trip, type(id_trip), self.parent.parent
+        print('plot_speed_over_way', id_trip, type(id_trip), self.parent.parent)
 
         #mapmatching = self.parent.parent
         #trips = mapmatching.trips
@@ -933,10 +933,10 @@ class SpeedprofilePlotter(PlotoptionsMix
         y = np.array(speeds, dtype=np.float32)*3.6  # in km/h
 
         #ax = init_plot()
-        print '  ids_point', routeresults.ids_valid_point_speedana[id_routeres]
-        print '  position', pointspositions
-        print '  x', x
-        print '  y', y
+        print('  ids_point', routeresults.ids_valid_point_speedana[id_routeres])
+        print('  position', pointspositions)
+        print('  x', x)
+        print('  y', y)
         #ax.plot(locations, speeds, color = self.color_line[:2], lw = self.width_line ,alpha=0.9 ,zorder = 0)
 
         if is_scipy & (not (self.method_interp == 'linear')):
@@ -964,7 +964,7 @@ class SpeedprofilePlotter(PlotoptionsMix
                         fontsize=int(0.8*self.size_labelfont))  # baseline
 
     def show(self):
-        print 'show', self.id_trip, type(self.id_trip), self.parent.parent
+        print('show', self.id_trip, type(self.id_trip), self.parent.parent)
         # if self.axis  is None:
 
         if self.id_trip >= 0:
@@ -1054,8 +1054,8 @@ class SpeedprofilePlotter(PlotoptionsMix
             id_arc_last = 0
             i_point = 0
             pointstime = routeresults.speedana_point_times[id_routeres]
-            print '  len(ids_pointedge)', len(ids_pointedge)
-            print '  len(pointstime)', len(pointstime)
+            print('  len(ids_pointedge)', len(ids_pointedge))
+            print('  len(pointstime)', len(pointstime))
 
             # if len(pointstime)>1:
             #    t_last = pointstime[1]
@@ -1076,7 +1076,7 @@ class SpeedprofilePlotter(PlotoptionsMix
                 routeresults.speedana_point_pos[id_routeres],
             ):
 
-                print '  id_arc_point', id_arc_point, 'is_connection_point', is_connection_point, 'id_arc_last', id_arc_last, id_arc_point != id_arc_last, 'pos=%.2fm, t=%.2fs, v=%.2fkm/h' % (pos, t, v*3.6),
+                print('  id_arc_point', id_arc_point, 'is_connection_point', is_connection_point, 'id_arc_last', id_arc_last, id_arc_point != id_arc_last, 'pos=%.2fm, t=%.2fs, v=%.2fkm/h' % (pos, t, v*3.6),)
                 color = 'k'
                 if (id_arc_point != id_arc_last):
 
@@ -1181,7 +1181,7 @@ class SpeedprofilePlotter(PlotoptionsMix
             cumulative_dists = np.insert(cumulative_dists, 0, 0.).tolist()
             ids_arc = routeresults.ids_arc[id_routeres]
             are_connections = routeresults.is_connection[id_routeres]
-            print cumulative_dists, ids_arc
+            print(cumulative_dists, ids_arc)
 
             for cumulative_dist, id_arc, is_connection in zip(cumulative_dists, ids_arc, are_connections):
 
@@ -1210,7 +1210,7 @@ class SpeedprofilePlotter(PlotoptionsMix
                         if self.is_waitslabel_tls & (time_wait_tls > 0):
                             label += ' $T_{\mathrm{TL}}=%ds$' % time_wait_tls
 
-                        print '  id_edge', id_arc, 'pos=%df' % cumulative_dist, 'time_wait', time_wait, 'time_wait_junc', time_wait_junc, 'time_wait_tls', time_wait_tls
+                        print('  id_edge', id_arc, 'pos=%df' % cumulative_dist, 'time_wait', time_wait, 'time_wait_junc', time_wait_junc, 'time_wait_tls', time_wait_tls)
 
                         ax.text(cumulative_dist, ymin, label,
                                 verticalalignment='bottom',
@@ -1219,7 +1219,7 @@ class SpeedprofilePlotter(PlotoptionsMix
                                 color=color,
                                 fontsize=int(0.8*self.size_labelfont))
                     else:
-                        print 'the edge', id_arc, 'is not in the edgeresult database'
+                        print('the edge', id_arc, 'is not in the edgeresult database')
                 else:
                     if connectionsresults.ids_connection.has_index(id_arc):
                         id_connectionres = connectionsresults.ids_connection.get_id_from_index(id_arc)
@@ -1237,7 +1237,7 @@ class SpeedprofilePlotter(PlotoptionsMix
                         if self.is_waitslabel_tls & (time_wait_tls > 0):
                             label += ' $T_{\mathrm{TL}}=%ds$' % time_wait_tls
 
-                        print '  id_connection', id_arc, 'pos=%df' % x, 'time_wait', time_wait, 'time_wait_junc', time_wait_junc, 'time_wait_tls', time_wait_tls
+                        print('  id_connection', id_arc, 'pos=%df' % x, 'time_wait', time_wait, 'time_wait_junc', time_wait_junc, 'time_wait_tls', time_wait_tls)
 
                         ax.text(cumulative_dist, ymin, label,
                                 verticalalignment='bottom',
@@ -1246,7 +1246,7 @@ class SpeedprofilePlotter(PlotoptionsMix
                                 color=color,
                                 fontsize=int(0.8*self.size_labelfont))
                     else:
-                        print 'the connection', id_arc, 'is not in the connectionresult database'
+                        print('the connection', id_arc, 'is not in the connectionresult database')
 
                 ax.plot([cumulative_dist, cumulative_dist], [ymin, ymax], color=color, linestyle=linestyle)
 
@@ -1336,7 +1336,7 @@ class EdgeresultPlotter(PlotoptionsMixin
             self.show()
 
     def show(self):
-        print 'EdgeresultPlotter.show', self.plottheme
+        print('EdgeresultPlotter.show', self.plottheme)
         # if self.axis  is None:
         #axis = init_plot()
         self.init_figures()
@@ -1344,9 +1344,9 @@ class EdgeresultPlotter(PlotoptionsMixin
         axis = fig.add_subplot(111)
         self.plotthemefuncs[self.plottheme](axis)
 
-        print '  self.is_save', self.is_save
+        print('  self.is_save', self.is_save)
         if not self.is_save:
-            print '  show_plot'
+            print('  show_plot')
             show_plot()
         else:
             figname = 'edgeplot_'+self.plottheme
@@ -1373,7 +1373,7 @@ class EdgeresultPlotter(PlotoptionsMixin
         ids_edge = edges.get_ids()
         #resultattrconf = getattr(self.parent.edgesresults, self.edgeattrname)
         average_slopes = edges.average_slopes
-        print ids_edge, average_slopes[ids_edge]
+        print(ids_edge, average_slopes[ids_edge])
         self.plot_results_on_map(ax,
                                  values=average_slopes[ids_edge],
                                  ids_edge=ids_edge,
@@ -1387,7 +1387,7 @@ class EdgeresultPlotter(PlotoptionsMixin
         ids_edge = edges.get_ids()
         #resultattrconf = getattr(self.parent.edgesresults, self.edgeattrname)
         positive_climbs = edges.positive_climbs
-        print ids_edge, positive_climbs[ids_edge]
+        print(ids_edge, positive_climbs[ids_edge])
         self.plot_results_on_map(ax,
                                  values=positive_climbs[ids_edge],
                                  ids_edge=ids_edge,
@@ -1401,7 +1401,7 @@ class EdgeresultPlotter(PlotoptionsMixin
         ids_edge = edges.get_ids()
         #resultattrconf = getattr(self.parent.edgesresults, self.edgeattrname)
         negative_climbs = edges.negative_climbs
-        print ids_edge, negative_climbs[ids_edge]
+        print(ids_edge, negative_climbs[ids_edge])
         self.plot_results_on_map(ax,
                                  values=negative_climbs[ids_edge],
                                  ids_edge=ids_edge,
@@ -1459,7 +1459,7 @@ class EdgeresultPlotter(PlotoptionsMixin
     def plot_speeds_average(self, ax):
         edgesresults = self.parent.edgesresults
 
-        print 'plot_speeds_average'
+        print('plot_speeds_average')
 
         #ids_result = edgesresults.get_ids()
         ids_result = edgesresults.select_ids(
@@ -1583,7 +1583,7 @@ class ConnectionresultPlotter(Plotoption
             self.show()
 
     def show(self):
-        print 'connectionresultPlotter.show', self.plottheme
+        print('connectionresultPlotter.show', self.plottheme)
         # if self.axis  is None:
         #axis = init_plot()
         self.init_figures()
@@ -1591,9 +1591,9 @@ class ConnectionresultPlotter(Plotoption
         axis = fig.add_subplot(111)
         self.plotthemefuncs[self.plottheme](axis)
 
-        print '  self.is_save', self.is_save
+        print('  self.is_save', self.is_save)
         if not self.is_save:
-            print '  show_plot'
+            print('  show_plot')
             show_plot()
         else:
             figname = 'connectionplot_'+self.plottheme
@@ -1699,7 +1699,7 @@ class AlternativeRoutesPlotter(Plotoptio
             attrconf.add_groupnames(['_private'])
 
     def show(self):
-        print 'AlternativeRoutesPlotter.show'
+        print('AlternativeRoutesPlotter.show')
         # if self.axis  is None:
         #axis = init_plot()
         title = 'Route alternatives'
@@ -1772,7 +1772,7 @@ class AlternativeRoutesPlotter(Plotoptio
                                       is_colorbar=False,
                                       )
             else:
-                print 'WARNING in AlternativeRoutesPlotter.show ids_edge=', ids_edge_all, 'of id_trip', id_trip
+                print('WARNING in AlternativeRoutesPlotter.show ids_edge=', ids_edge_all, 'of id_trip', id_trip)
 
         if self.is_show_title:
             axis.set_title(title, fontsize=self.size_titlefont)
@@ -1787,9 +1787,9 @@ class AlternativeRoutesPlotter(Plotoptio
         axis.tick_params(axis='y', labelsize=int(0.8*self.size_labelfont))
 
         ## save or show
-        print '  self.is_save', self.is_save
+        print('  self.is_save', self.is_save)
         if not self.is_save:
-            print '  show_plot'
+            print('  show_plot')
             show_plot()
         else:
             self.save_fig('altroutesplot')
@@ -1804,7 +1804,7 @@ class RouteresultPlotter(PlotoptionsMixi
         self._init_common('routeresultplotter', parent=results, name=name,
                           info=info, logger=logger)
 
-        print 'Resultplotter.__init__', results, self.parent
+        print('Resultplotter.__init__', results, self.parent)
         attrsman = self.get_attrsman()
 
         mapmatching = self.parent.parent
@@ -2158,7 +2158,7 @@ class RouteresultPlotter(PlotoptionsMixi
             show_plot()
 
     def plot_bike_availability_ffbss(self):
-        print 'plot_bike_availability_ffbss'
+        print('plot_bike_availability_ffbss')
         # Print the number of bikes simultaneously used every 24h/n_bins hours by selecting traces of a particular day
         fig = self.create_figure()
         mapmatching = self.parent.parent
@@ -2171,7 +2171,7 @@ class RouteresultPlotter(PlotoptionsMixi
             dep_arr_times[i, 1] = dep_arr_times[i, 0] + trips.durations_gps[id_trip]/3600.0
         self.n_bins
 ##        dep_arr_times = np.sort(dep_arr_times.sort, axis = 0)
-        print dep_arr_times[:1000]
+        print(dep_arr_times[:1000])
         ax = fig.add_subplot(111)
         x_min = min(dep_arr_times[:, 0])
         x_max = max(dep_arr_times[:, 0])
@@ -2182,7 +2182,7 @@ class RouteresultPlotter(PlotoptionsMixi
             for bin, i in zip(bins, range(self.n_bins)):
                 if dep_arr_time[0] < bin and dep_arr_time[1] > bin:
                     bike_usage[i-1] += 1
-        print bike_usage
+        print(bike_usage)
         bincenters = plt.plot(bins, bike_usage,  color=self.color_matched,
                               label='Bike usage distribution of GPS Mobike traces')
         ax.legend(loc='best', shadow=True, fontsize=self.size_labelfont)
@@ -2197,7 +2197,7 @@ class RouteresultPlotter(PlotoptionsMixi
             self.save_fig('bike_usage')
 
     def plot_bike_availability_ffbss_zone(self):
-        print 'plot_bike_availability_ffbss_zone'
+        print('plot_bike_availability_ffbss_zone')
         # Plot the difference between attracted and generated trips froma zone in a day every 24h/n_bins hours
         fig = self.create_figure()
         mapmatching = self.parent.parent
@@ -2217,7 +2217,7 @@ class RouteresultPlotter(PlotoptionsMixi
         for id_trip, ids_point in zip(ids_trip, ids_points):
             id_initial_point = ids_point[0]
             id_final_point = ids_point[-1]
-            print id_trip
+            print(id_trip)
             starting_time = np.int(points.timestamps[id_initial_point] % 86400/86400.*np.float(n_bins))
             arriving_time = np.int(points.timestamps[id_final_point] % 86400/86400.*np.float(n_bins))
 
@@ -2271,7 +2271,7 @@ class RouteresultPlotter(PlotoptionsMixi
             self.save_fig('bike_availability')
 
     def analyze_bike_availability_ffbss_zones(self):
-        print 'analyze_bike_availability_ffbss_zones'
+        print('analyze_bike_availability_ffbss_zones')
         # Save a .txt file with generated trips and attracted trips every 24h/n_bins hours for each zone with selected trips
         fig = self.create_figure()
         mapmatching = self.parent.parent
@@ -2290,7 +2290,7 @@ class RouteresultPlotter(PlotoptionsMixi
         for id_trip, ids_point in zip(ids_trip, ids_points):
             id_initial_point = ids_point[0]
             id_final_point = ids_point[-1]
-            print id_trip
+            print(id_trip)
             starting_time = np.int(points.timestamps[id_initial_point] % 86400/86400.*np.float(n_bins))
             arriving_time = np.int(points.timestamps[id_final_point] % 86400/86400.*np.float(n_bins))
             i = 0
@@ -2408,7 +2408,7 @@ class RouteresultPlotter(PlotoptionsMixi
             self.save_fig('bike_availability')
 
     def plot_deptimedistrib(self):
-        print 'plot_deptimedistrib'
+        print('plot_deptimedistrib')
         fig = self.create_figure()
         mapmatching = self.parent.parent
         trips = mapmatching.trips
@@ -2451,7 +2451,7 @@ class RouteresultPlotter(PlotoptionsMixi
             self.save_fig('plot_deptimedistrib')
 
     def plot_tldensity(self):
-        print 'plot_tldensity'
+        print('plot_tldensity')
         fig = self.create_figure()
         results = self.parent
         routesresults_shortest = results.routesresults_shortest
@@ -2488,7 +2488,7 @@ class RouteresultPlotter(PlotoptionsMixi
             self.save_fig('routeana_tldensity')
 
     def plot_nodesdensity(self):
-        print 'plot_nodesdensity'
+        print('plot_nodesdensity')
         fig = self.create_figure()
         results = self.parent
 
@@ -2526,7 +2526,7 @@ class RouteresultPlotter(PlotoptionsMixi
             self.save_fig('routeana_nodesdensity')
 
     def plot_prioritychangedensity(self):
-        print 'plot_prioritychangedensity'
+        print('plot_prioritychangedensity')
         fig = self.create_figure()
         results = self.parent
         routesresults_shortest = results.routesresults_shortest
@@ -2563,7 +2563,7 @@ class RouteresultPlotter(PlotoptionsMixi
             self.save_fig('routeana_nodesdensity')
 
     def plot_lowpriorityshare(self):
-        print 'plot_lowpriorityshare'
+        print('plot_lowpriorityshare')
         fig = self.create_figure()
         results = self.parent
         routesresults_shortest = results.routesresults_shortest
@@ -2600,7 +2600,7 @@ class RouteresultPlotter(PlotoptionsMixi
             self.save_fig('routeana_lowpriorityshare')
 
     def plot_exclusiveshare(self):
-        print 'plot_exclusiveshare'
+        print('plot_exclusiveshare')
         fig = self.create_figure()
         results = self.parent
         routesresults_shortest = results.routesresults_shortest
@@ -2637,7 +2637,7 @@ class RouteresultPlotter(PlotoptionsMixi
             self.save_fig('routeana_exclusiveshare')
 
     def plot_mixshare(self):
-        print 'plot_mixshare'
+        print('plot_mixshare')
         fig = self.create_figure()
         results = self.parent
         routesresults_shortest = results.routesresults_shortest
@@ -2675,7 +2675,7 @@ class RouteresultPlotter(PlotoptionsMixi
             self.save_fig('routeana_mixshare')
 
     def plot_lengthdistrib_by_class(self):
-        print 'plot_lengthdistrib_by_class'
+        print('plot_lengthdistrib_by_class')
         fig = self.create_figure()
         results = self.parent
         routesresults_shortest = results.routesresults_shortest
@@ -2716,11 +2716,11 @@ class RouteresultPlotter(PlotoptionsMixi
                     ratiolabel = '%d%%' % (means_shortest[i]/means_match[i]*100)
             ratiolabels.append(ratiolabel)
 
-        print '  dists_class_center', dists_class_center
-        print '  means_match', means_match
-        print '  stds_match', stds_match
-        print '  means_shortest', means_shortest
-        print '  stds_shortest', stds_shortest
+        print('  dists_class_center', dists_class_center)
+        print('  means_match', means_match)
+        print('  stds_match', stds_match)
+        print('  means_shortest', means_shortest)
+        print('  stds_shortest', stds_shortest)
 
         x = np.arange(n_class, dtype=np.float32)  # the x locations for the groups
         width = 0.35       # the width of the bars
@@ -2779,7 +2779,7 @@ class RouteresultPlotter(PlotoptionsMixi
                                                                     time.                                          routesresults_matched.distances.get_value() > 0,
                                                                     # routesresults_matched.distances.get_value()<20000)
                                                                     ))
-        print 'plot_lengthdistrib', len(ids_valid)
+        print('plot_lengthdistrib', len(ids_valid))
         # print '  ids_valid',ids_valid
         if len(ids_valid) == 0:
             return False
@@ -2808,7 +2808,7 @@ class RouteresultPlotter(PlotoptionsMixi
         return True
 
     def plot_timedistrib(self):
-        print 'plot_timedistrib'
+        print('plot_timedistrib')
         fig = self.create_figure()
         results = self.parent
         mapmatching = results.parent
@@ -2856,7 +2856,7 @@ class RouteresultPlotter(PlotoptionsMixi
         return True
 
     def plot_lengthprob(self):
-        print 'plot_lengthprob'
+        print('plot_lengthprob')
         fig = self.create_figure()
         results = self.parent
         routesresults_shortest = results.routesresults_shortest
@@ -2901,7 +2901,7 @@ class RouteresultPlotter(PlotoptionsMixi
             self.save_fig('routeana_lengthprob')
 
     def plot_lengthoverlap(self):
-        print 'plot_lengthoverlap'
+        print('plot_lengthoverlap')
         fig = self.create_figure()
         results = self.parent
         routesresults_shortest = results.routesresults_shortest
@@ -2933,10 +2933,10 @@ class RouteresultPlotter(PlotoptionsMixi
             self.save_fig('routeana_lengthoverlap')
 
     def plot_lengthoverlap_fastest(self):
-        print 'plot_lengthoverlap_fastest'
+        print('plot_lengthoverlap_fastest')
         fig = self.create_figure()
         results = self.parent
-        print 'dir(results)', dir(results)
+        print('dir(results)', dir(results))
         routesresults_fastest = results.routesresults_fastest
         routesresults_matched = results.routesresults_matched
         edgesresults = results.edgesresults
@@ -2966,7 +2966,7 @@ class RouteresultPlotter(PlotoptionsMixi
             self.save_fig('routeana_lengthoverlap_fastest')
 
     def plot_lengthratio(self):
-        print 'plot_lengthratio'
+        print('plot_lengthratio')
         fig = self.create_figure()
         results = self.parent
         routesresults_shortest = results.routesresults_shortest
@@ -3002,7 +3002,7 @@ class RouteresultPlotter(PlotoptionsMixi
     # non-overlap
 
     def plot_lengthratio_nonoverlap(self):
-        print 'plot_lengthratio_nonoverlap'
+        print('plot_lengthratio_nonoverlap')
         fig = self.create_figure()
         results = self.parent
         routesresults_shortest = results.routesresults_shortest
@@ -3041,7 +3041,7 @@ class RouteresultPlotter(PlotoptionsMixi
             self.save_fig('routeana_lengthratio_nonoverlap')
 
     def plot_tldensity_nonoverlap(self):
-        print 'plot_tldensity_nonoverlap'
+        print('plot_tldensity_nonoverlap')
         fig = self.create_figure()
         results = self.parent
         routesresults_shortest = results.routesresults_shortest
@@ -3080,7 +3080,7 @@ class RouteresultPlotter(PlotoptionsMixi
             self.save_fig('routeana_tldensity_nonoverlap')
 
     def plot_nodesdensity_nonoverlap(self):
-        print 'plot_nodesdensity_nonoverlap'
+        print('plot_nodesdensity_nonoverlap')
         fig = self.create_figure()
         results = self.parent
         routesresults_shortest = results.routesresults_shortest
@@ -3119,7 +3119,7 @@ class RouteresultPlotter(PlotoptionsMixi
             self.save_fig('routeana_nodesdensity_nonoverlap')
 
     def plot_prioritychangedensity_nonoverlap(self):
-        print 'plot_prioritychangedensity_nonoverlap'
+        print('plot_prioritychangedensity_nonoverlap')
         fig = self.create_figure()
         results = self.parent
         routesresults_shortest = results.routesresults_shortest
@@ -3159,7 +3159,7 @@ class RouteresultPlotter(PlotoptionsMixi
             self.save_fig('routeana_nodesdensity_nonoverlap')
 
     def plot_lowpriorityshare_nonoverlap(self):
-        print 'plot_lowpriorityshare_nonoverlap'
+        print('plot_lowpriorityshare_nonoverlap')
         fig = self.create_figure()
         results = self.parent
         routesresults_shortest = results.routesresults_shortest
@@ -3199,7 +3199,7 @@ class RouteresultPlotter(PlotoptionsMixi
             self.save_fig('routeana_lowpriorityshare_nonoverlap')
 
     def plot_exclusiveshare_nonoverlap(self):
-        print 'plot_exclusiveshare_nonoverlap'
+        print('plot_exclusiveshare_nonoverlap')
         fig = self.create_figure()
         results = self.parent
         routesresults_shortest = results.routesresults_shortest
@@ -3239,7 +3239,7 @@ class RouteresultPlotter(PlotoptionsMixi
             self.save_fig('routeana_exclusiveshare_nonoverlap')
 
     def plot_mixshare_nonoverlap(self):
-        print 'plot_mixshare_nonoverlap'
+        print('plot_mixshare_nonoverlap')
         fig = self.create_figure()
         results = self.parent
         routesresults_shortest = results.routesresults_shortest
@@ -3295,7 +3295,7 @@ class PtFlowdigramPlotter(PlotoptionsMix
         self._init_common('ptrouteresultplotter', parent=results, name=name,
                           info=info, logger=logger)
 
-        print 'PtFlowdigramPlotter.__init__', results, self.parent
+        print('PtFlowdigramPlotter.__init__', results, self.parent)
         attrsman = self.get_attrsman()
 
         self.id_line = attrsman.add(cm.AttrConf('id_line', kwargs.get('id_line', -1),
@@ -3369,7 +3369,7 @@ class PtFlowdigramPlotter(PlotoptionsMix
         self.add_save_options(**kwargs)
 
     def show(self):
-        print 'show'
+        print('show')
         # if self.axis  is None:
         self.init_figures()
         plt.rc('lines', linewidth=self.width_line)
@@ -3392,7 +3392,7 @@ class PtFlowdigramPlotter(PlotoptionsMix
         ptlinks = ptlines.get_ptlinks()
 
         if not self.id_line in ptlines:
-            print 'WARNING: line with ID', self.id_line, 'not found.'
+            print('WARNING: line with ID', self.id_line, 'not found.')
             return False
 
         #id_line = ptlines.linenames.get_id_from_index(self.linename)
--- a/tools/contributed/sumopy/plugins/mapmatching/wxgui.py
+++ b/tools/contributed/sumopy/plugins/mapmatching/wxgui.py
@@ -36,7 +36,7 @@ try:
     import results_mpl as results_mpl
     is_mpl = True  # we have matplotlib support
 except:
-    print "WARNING: python matplotlib package not installed, no matplotlib plots."
+    print("WARNING: python matplotlib package not installed, no matplotlib plots.")
     is_mpl = False
 
 
@@ -284,7 +284,7 @@ class WxGui(ModuleGui):
         and reset widgets. For exampe enable/disable widgets
         dependent on the availability of data. 
         """
-        print 'MapmatchingWxGui.refresh_widgets'
+        print('MapmatchingWxGui.refresh_widgets')
         scenario = self.get_scenario()
         is_refresh = False
         if self._scenario != scenario:
@@ -303,7 +303,7 @@ class WxGui(ModuleGui):
 
         if is_refresh | self._is_needs_refresh:
             self._is_needs_refresh = False
-            print '  is_refresh', is_refresh, self._is_needs_refresh
+            print('  is_refresh', is_refresh, self._is_needs_refresh)
             neteditor = self.get_neteditor()
             #canvas = self.get_canvas()
             drawing = self.get_drawing()  # canvas.get_drawing()
@@ -947,7 +947,7 @@ class WxGui(ModuleGui):
         """
         Export edge results to shape file.
         """
-        print 'on_nodes_to_shapefile'
+        print('on_nodes_to_shapefile')
         scenario = self._mapmatching.get_scenario()
         dirpath = scenario.get_workdirpath()
         #defaultFile = scenario.get_rootfilename()+'.edgeres.shp'
@@ -971,7 +971,7 @@ class WxGui(ModuleGui):
         """
         Export GPS points to shapefile.
         """
-        print 'on_points_to_shapefile'
+        print('on_points_to_shapefile')
         scenario = self._mapmatching.get_scenario()
         dirpath = scenario.get_workdirpath()
         defaultFile = scenario.get_rootfilename()+'.points.shp'
@@ -1707,7 +1707,7 @@ class WxGui(ModuleGui):
             self._mainframe.refresh_moduleguis()
             self._is_needs_refresh = True
             self.refresh_widgets()
-            print '  set browser to', self.get_scenario().net.ptstops
+            print('  set browser to', self.get_scenario().net.ptstops)
             self._mainframe.browse_obj(self.get_scenario().net.ptstops)
 
     def on_gtfsservicegenerate(self, event=None):
@@ -1738,7 +1738,7 @@ class WxGui(ModuleGui):
             # apply current widget values to scenario instance
             dlg.apply()
             dlg.Destroy()
-            print '  set browser to', self.get_scenario().demand.ptlines
+            print('  set browser to', self.get_scenario().demand.ptlines)
             self._mainframe.browse_obj(self.get_scenario().demand.ptlines)
             # self._mainframe.refresh_moduleguis()
             #self._is_needs_refresh = True
--- a/tools/contributed/sumopy/plugins/prt/__init__.py
+++ b/tools/contributed/sumopy/plugins/prt/__init__.py
@@ -18,7 +18,7 @@
 
 __version__ = "0.0"
 
-print 'init', __name__
+print('init', __name__)
 
 
 def get_wxgui():
--- a/tools/contributed/sumopy/plugins/prt/prt.py
+++ b/tools/contributed/sumopy/plugins/prt/prt.py
@@ -148,7 +148,7 @@ class Compressors(am.ArrayObjman):
         ])
 
     def make(self, id_detectoredge=None, **kwargs):
-        print 'make', kwargs
+        print('make', kwargs)
         # print '  ids_shuntedge',kwargs.get('ids_shuntedge',None),type(kwargs.get('ids_shuntedge',None)[0])
         id_comp = self.add_row(ids_shuntedges=kwargs.get('ids_shuntedge', None),
                                ids_detectoredge=id_detectoredge
@@ -158,13 +158,13 @@ class Compressors(am.ArrayObjman):
         return id_comp
 
     def update(self, id_comp):
-        print 'update id_comp', id_comp
+        print('update id_comp', id_comp)
         edges = self.get_scenario().net.edges
 
         self.ids_detectoredge[id_comp] = edges.get_incoming(self.ids_shuntedges[id_comp][0])[0]
 
     def update_all(self):
-        print 'update_all'
+        print('update_all')
         for id_comp in self.get_ids():
             self.update(id_comp)
 
@@ -172,7 +172,7 @@ class Compressors(am.ArrayObjman):
         return self.parent.get_scenario()
 
     def prepare_sim(self, process):
-        print 'Compressors.prepare_sim'
+        print('Compressors.prepare_sim')
         net = self.get_scenario().net
         nodes = net.nodes
         edges = net.edges
@@ -248,8 +248,8 @@ class Compressors(am.ArrayObjman):
 
     def process_step(self, process):
         simtime = process.simtime
-        print 79*'_'
-        print 'Compressors.process_step at', simtime
+        print(79*'_')
+        print('Compressors.process_step at', simtime)
         net = self.get_scenario().net
         edges = net.edges
         vehicles = self.parent.prtvehicles
@@ -284,11 +284,11 @@ class Compressors(am.ArrayObjman):
                 id_detectedge_sumo, ids_veh_detect_sumo)
 
             if 0:
-                print '  id_detectedge_sumo', id_detectedge_sumo
-                print '  ids_veh_detect_sumo', ids_veh_detect_sumo
-                print '  ids_veh_new_sumo', ids_veh_new_sumo
-                print '  ids_veh_entered_sumo=', ids_veh_entered_sumo
-                print '  ids_veh_left_sumo=', ids_veh_left_sumo
+                print('  id_detectedge_sumo', id_detectedge_sumo)
+                print('  ids_veh_detect_sumo', ids_veh_detect_sumo)
+                print('  ids_veh_new_sumo', ids_veh_new_sumo)
+                print('  ids_veh_entered_sumo=', ids_veh_entered_sumo)
+                print('  ids_veh_left_sumo=', ids_veh_left_sumo)
 
             if len(ids_veh_entered_sumo) > 0:
 
@@ -388,10 +388,10 @@ class Compressors(am.ArrayObjman):
                         capacities, ids_edge_sumo_target,
                         edges.ids_sumo[ids_shuntedge], releasetime_queues):
                     if 0:
-                        print '    OOOO shunt %s --> target %s' % (id_shuntedge_sumo, id_edge_sumo_target)
-                        print '    simtime-releasetime_queue', simtime-releasetime_queue
-                        print '    queue', queue, id(queue)
-                        print '    queue_alloc', queue_alloc
+                        print('    OOOO shunt %s --> target %s' % (id_shuntedge_sumo, id_edge_sumo_target))
+                        print('    simtime-releasetime_queue', simtime-releasetime_queue)
+                        print('    queue', queue, id(queue))
+                        print('    queue_alloc', queue_alloc)
 
                     # check if allocated arrived
                     ids_veh_arrived = []
@@ -472,7 +472,7 @@ class Decompressors(Compressors):
         ])
 
     def prepare_sim(self, process):
-        print 'Decompressors.prepare_sim'
+        print('Decompressors.prepare_sim')
         net = self.get_scenario().net
         nodes = net.nodes
         edges = net.edges
@@ -551,8 +551,8 @@ class Decompressors(Compressors):
 
     def process_step(self, process):
         simtime = process.simtime
-        print 79*'_'
-        print 'Deompressors.process_step at', simtime
+        print(79*'_')
+        print('Deompressors.process_step at', simtime)
         net = self.get_scenario().net
         edges = net.edges
         vehicles = self.parent.prtvehicles
@@ -586,11 +586,11 @@ class Decompressors(Compressors):
 
             ids_veh_sumo = set(traci.edge.getLastStepVehicleIDs(id_detectedge_sumo))
             if 0:
-                print '  id_detectedge_sumo', id_detectedge_sumo
-                print '  ids_veh_detect_sumo', ids_veh_detect_sumo, ids_veh_detect_sumo != ids_veh_sumo
-                print '  ids_veh_sumo=', ids_veh_sumo
+                print('  id_detectedge_sumo', id_detectedge_sumo)
+                print('  ids_veh_detect_sumo', ids_veh_detect_sumo, ids_veh_detect_sumo != ids_veh_sumo)
+                print('  ids_veh_sumo=', ids_veh_sumo)
                 ids_veh_sumo_raw = traci.edge.getLastStepVehicleIDs(id_detectedge_sumo)
-                print '  ids_veh_sumo_raw=', ids_veh_sumo_raw
+                print('  ids_veh_sumo_raw=', ids_veh_sumo_raw)
 
             if ids_veh_detect_sumo != ids_veh_sumo:
                 # there are new vehicles
@@ -601,12 +601,12 @@ class Decompressors(Compressors):
                 ids_veh_entered = vehicles.get_ids_from_ids_sumo(ids_veh_entered_sumo)
 
                 if 0:
-                    print '  ids_veh_entered', ids_veh_entered, type(ids_veh_entered)
+                    print('  ids_veh_entered', ids_veh_entered, type(ids_veh_entered))
                     # print '  poss',poss
-                    print '  ids_veh_entered_sumo', ids_veh_entered_sumo
-                    print '  ids_leader', vehicles.ids_leader[ids_veh_entered]
-                    print '  ids_follower', vehicles.ids_follower[ids_veh_entered]
-                    print '  lengths_plat', vehicles.lengths_plat[ids_veh_entered]
+                    print('  ids_veh_entered_sumo', ids_veh_entered_sumo)
+                    print('  ids_leader', vehicles.ids_leader[ids_veh_entered])
+                    print('  ids_follower', vehicles.ids_follower[ids_veh_entered])
+                    print('  lengths_plat', vehicles.lengths_plat[ids_veh_entered])
 
                 for id_veh_entered, id_veh_entered_sumo, id_leader, length_plat\
                     in zip(ids_veh_entered, ids_veh_entered_sumo,
@@ -693,12 +693,12 @@ class Decompressors(Compressors):
                         ids_targetedges_sumo, capacities,
                         edges.ids_sumo[ids_shuntedge], releasetime_queues):
                     if 0:
-                        print '    QQQQQQQQQQQ shunt %s ' % (id_shuntedge_sumo)
-                        print '      simtime-releasetime_queue', simtime-releasetime_queue, (simtime - releasetime_queue > self.time_accumulation_max.get_value()), (simtime - self.releasetimes[id_comp] > 10)
-                        print '      queue', queue, id(queue)
-                        print '      ids_targetedge_sumo', ids_targetedge_sumo
-                        print '      queue_alloc', queue_alloc
-                        print '      releasetime_queue', releasetime_queue, simtime - releasetime_queue, simtime - releasetime_queue > self.time_accumulation_max.get_value()
+                        print('    QQQQQQQQQQQ shunt %s ' % (id_shuntedge_sumo))
+                        print('      simtime-releasetime_queue', simtime-releasetime_queue, (simtime - releasetime_queue > self.time_accumulation_max.get_value()), (simtime - self.releasetimes[id_comp] > 10))
+                        print('      queue', queue, id(queue))
+                        print('      ids_targetedge_sumo', ids_targetedge_sumo)
+                        print('      queue_alloc', queue_alloc)
+                        print('      releasetime_queue', releasetime_queue, simtime - releasetime_queue, simtime - releasetime_queue > self.time_accumulation_max.get_value())
                     # here we could also test timeout conditions
                     if (simtime - self.releasetimes[id_comp] > self.time_release_min.get_value()) & (simtime - releasetime_queue > self.time_accumulation_max.get_value()):
                         # if (simtime - self.releasetimes[id_comp]> self.time_release_min.get_value()):
@@ -926,7 +926,7 @@ class Mergenodes(am.ArrayObjman):
         """
         Make merge node database from network.
         """
-        print 'Mergenodes.make_from_net'
+        print('Mergenodes.make_from_net')
         self.clear()
         id_prtmode = self.parent.id_prtmode
 
@@ -947,9 +947,9 @@ class Mergenodes(am.ArrayObjman):
         ids = compressors.get_ids()
         for id_unit, ids_edge in zip(ids, compressors.ids_shuntedges[ids]):
             # put in all shunts except for the bypass
-            print '    bypass of compressor', id_unit, '=', ids_edge[0]
+            print('    bypass of compressor', id_unit, '=', ids_edge[0])
             ids_mainlinedges.add(ids_edge[0])
-            print '    update ids_shuntedges with compressors', ids_edge[1:]
+            print('    update ids_shuntedges with compressors', ids_edge[1:])
             ids_shuntedges.update(ids_edge[1:])
 
         # collect decompressornodes, wich will not become entry merges
@@ -957,12 +957,12 @@ class Mergenodes(am.ArrayObjman):
         ids_node_decompressorout = []
         for id_unit, ids_edge in zip(ids, decompressors.ids_shuntedges[ids]):
             # put in all shunts except for the bypass
-            print '    bypass of decompressor', id_unit, '=', ids_edge[0], 'id_tonode', edges.ids_tonode[ids_edge[0]]
+            print('    bypass of decompressor', id_unit, '=', ids_edge[0], 'id_tonode', edges.ids_tonode[ids_edge[0]])
             ids_mainlinedges.add(ids_edge[0])
             ids_node_decompressorout.append(edges.ids_tonode[ids_edge[0]])
-            print '    update ids_shuntedges with decompressors', ids_edge[1:]
+            print('    update ids_shuntedges with decompressors', ids_edge[1:])
             ids_shuntedges.update(ids_edge[1:])
-        print '  ids_node_decompressorout', ids_node_decompressorout
+        print('  ids_node_decompressorout', ids_node_decompressorout)
         ids_node_compressorout = edges.ids_tonode[list(ids_mainlinedges)]
         ids_mainlinefromnodes = edges.ids_fromnode[list(ids_mainlinedges)]
 
@@ -972,7 +972,7 @@ class Mergenodes(am.ArrayObjman):
         #    print '  update ids_shuntedges with mainline incoming',edges.get_incoming(id_edge)
         #    ids_shuntedges.update(edges.get_incoming(id_edge))
 
-        print '  ids_shuntedges',  ids_shuntedges
+        print('  ids_shuntedges',  ids_shuntedges)
         #ids_ptstop = ptstops.get_ids()
         #id_mode_prt = self.parent.id_prtmode
 
@@ -982,7 +982,7 @@ class Mergenodes(am.ArrayObjman):
         #edgelengths = net.edges.lengths
 
         ids_node = nodes.get_ids()
-        print '  ids_node', ids_node
+        print('  ids_node', ids_node)
         for id_node, ids_edge_from, ids_edge_to, id_type in zip(
             ids_node,
             nodes.ids_incoming[ids_node],
@@ -993,14 +993,14 @@ class Mergenodes(am.ArrayObjman):
             if True:
                 #
 
-                print 60*'-'
-                print '  check node', id_node, nodes.ids_sumo[id_node], id_type, id_zippertype == id_type
+                print(60*'-')
+                print('  check node', id_node, nodes.ids_sumo[id_node], id_type, id_zippertype == id_type)
 
                 # id merge to be created, for debugging
                 id_merge = -1
 
                 if (ids_edge_from is None):
-                    print '    WARNING: isolate node: ids_edge_from,ids_edge_to', ids_edge_from, ids_edge_to
+                    print('    WARNING: isolate node: ids_edge_from,ids_edge_to', ids_edge_from, ids_edge_to)
                     pass
 
                 elif (len(ids_edge_from) == 2) & (len(ids_edge_to) == 1):
@@ -1011,28 +1011,28 @@ class Mergenodes(am.ArrayObjman):
                     # check accesslevels
                     id_edge1, id_edge2 = ids_edge_from
                     ids_lane1, ids_lane2 = edges.ids_lanes[ids_edge_from]
-                    print '    id_edge1', id_edge1, 'ids_lane1', ids_lane1, self.is_prt_only(ids_lane1, lanes)
-                    print '    id_edge2', id_edge2, 'ids_lane2', ids_lane2, self.is_prt_only(ids_lane2, lanes)
+                    print('    id_edge1', id_edge1, 'ids_lane1', ids_lane1, self.is_prt_only(ids_lane1, lanes))
+                    print('    id_edge2', id_edge2, 'ids_lane2', ids_lane2, self.is_prt_only(ids_lane2, lanes))
                     if self.is_prt_only(ids_lane1, lanes) & self.is_prt_only(ids_lane2, lanes):
-                        print '      +PRT merge with 2 PRT lines entering'
+                        print('      +PRT merge with 2 PRT lines entering')
 
                         if id_type != id_zippertype:
-                            print 'WARNING: PRT network node %d %s is NOT in zipper mode!' % (id_node, nodes.ids_sumo[id_node])
+                            print('WARNING: PRT network node %d %s is NOT in zipper mode!' % (id_node, nodes.ids_sumo[id_node]))
 
                         if not ids_shuntedges.isdisjoint(ids_edge_from):
-                            print '    one incoming edge is  a shunt edge. Detect last shunt node.'
+                            print('    one incoming edge is  a shunt edge. Detect last shunt node.')
 
                             # TODO: this should be a function of the compressor class
                             id_tonode_out = edges.ids_tonode[ids_edge_to[0]]
                             if id_tonode_out in ids_node_compressorout:
-                                print '    output node of compressor => station merge node with output node', id_tonode_out
+                                print('    output node of compressor => station merge node with output node', id_tonode_out)
                                 # model this node as a platform end node of a station
                                 id_merge = self.add_row(ids_node=id_node,
                                                         ids_nodes_out=[id_tonode_out],
                                                         are_station=True,
                                                         )
                             else:
-                                print '    compressor internal node'
+                                print('    compressor internal node')
                                 pass
 
                         # elif not ids_mainlinedges.isdisjoint(ids_edge_from):
@@ -1046,7 +1046,7 @@ class Mergenodes(am.ArrayObjman):
                         #                        )
 
                         else:
-                            print '    regular merge'
+                            print('    regular merge')
                             id_node_up1, dist1 = self.search_upstream_merge(id_edge1, edges, lanes, id_prtmode)
                             id_node_up2, dist2 = self.search_upstream_merge(id_edge2, edges, lanes, id_prtmode)
 
@@ -1068,7 +1068,7 @@ class Mergenodes(am.ArrayObjman):
                     #al_in = lanes.get_accesslevel(edges.ids_lanes[id_edge_from], id_prtmode)
                     #is_prt_in = lanes.ids_modes_allow[edges.ids_lanes[id_edge_from]] == id_prtmode
                     is_prt_in = self.is_prt_only(ids_lane_in, lanes)
-                    print '    one in, 2 out => diverge node, access is_prt_in', is_prt_in, 'is_platform_in', self.is_platform(ids_lane_in, lanes)
+                    print('    one in, 2 out => diverge node, access is_prt_in', is_prt_in, 'is_platform_in', self.is_platform(ids_lane_in, lanes))
 
                     # if id_edge_from in ids_detectoredges:
                     #    print '    fromnode is a detectoredge of a compressor'
@@ -1083,7 +1083,7 @@ class Mergenodes(am.ArrayObjman):
                     # check if node is outgoing node at a station
                     if 0:  # no longer considered
                         if is_prt_in & (id_node in ids_mainlinefromnodes):
-                            print '    Diverge node in front of a compressor/decompressorr.'
+                            print('    Diverge node in front of a compressor/decompressorr.')
                             id_node_up, dist = self.search_upstream_merge(id_edge_from, edges, lanes, id_prtmode)
 
                             id_edge1, id_edge2 = ids_edge_to
@@ -1102,19 +1102,19 @@ class Mergenodes(am.ArrayObjman):
                                          )
 
                     if self.is_platform(ids_lane_in, lanes):
-                        print '    mixed access level of incoming edge, check for platform exit node'
+                        print('    mixed access level of incoming edge, check for platform exit node')
 
                         id_edge1, id_edge2 = ids_edge_to
                         ids_lane1, ids_lane2 = edges.ids_lanes[ids_edge_to]
 
                         # here we could also decide on the number of lanes
                         # but this may not be robust in the future
-                        print '    out id_edge1', id_edge1, 'ids_lane1', ids_lane1, 'is_prt_only', self.is_prt_only(ids_lane1, lanes)
-                        print '    out id_edge2', id_edge2, 'ids_lane2', ids_lane2, 'is_prt_only', self.is_prt_only(ids_lane2, lanes)
+                        print('    out id_edge1', id_edge1, 'ids_lane1', ids_lane1, 'is_prt_only', self.is_prt_only(ids_lane1, lanes))
+                        print('    out id_edge2', id_edge2, 'ids_lane2', ids_lane2, 'is_prt_only', self.is_prt_only(ids_lane2, lanes))
                         # if self.is_prt_only(ids_lane1, lanes) & self.is_prt_only(ids_lane2, lanes):
                         if self.is_prt_only(ids_lane2, lanes):
 
-                            print '      Ped exit on outedge 1'
+                            print('      Ped exit on outedge 1')
                             #id_node_up, dist = self.search_upstream_merge(id_edge_from, edges, lanes, id_prtmode)
                             ids_node_out = self.search_downstream_merges(
                                 id_edge2, edges, lanes, id_prtmode, ids_sinkedge=ids_shuntedges)
@@ -1126,7 +1126,7 @@ class Mergenodes(am.ArrayObjman):
                                                     )
 
                         elif self.is_prt_only(ids_lane1, lanes):
-                            print '      Ped exit on outedge 2'
+                            print('      Ped exit on outedge 2')
                             #id_node_up, dist = self.search_upstream_merge(id_edge_from, edges, lanes, id_prtmode)
                             ids_node_out = self.search_downstream_merges(
                                 id_edge1, edges, lanes, id_prtmode, ids_sinkedge=ids_shuntedges)
@@ -1148,16 +1148,16 @@ class Mergenodes(am.ArrayObjman):
 
             id_node_in1 = self.ids_node_in1[id_merge]
             id_node_in2 = self.ids_node_in2[id_merge]
-            print '  check entry of id_merge', id_merge, 'id_node', self.ids_node[id_merge], ' no decomp', self.ids_node[id_merge] not in ids_node_decompressorout
+            print('  check entry of id_merge', id_merge, 'id_node', self.ids_node[id_merge], ' no decomp', self.ids_node[id_merge] not in ids_node_decompressorout)
             if (id_node_in1 > -1) & (id_node_in2 > -1)\
                     & (self.ids_node[id_merge] not in ids_node_decompressorout):
 
-                print '  id_node_in1', self.ids_node_in1[id_merge], nodes.ids_sumo[self.ids_node_in1[id_merge]], self.ids_node.has_index(self.ids_node_in1[id_merge])
-                print '  id_node_in2', self.ids_node_in2[id_merge], nodes.ids_sumo[self.ids_node_in2[id_merge]], self.ids_node.has_index(self.ids_node_in2[id_merge])
+                print('  id_node_in1', self.ids_node_in1[id_merge], nodes.ids_sumo[self.ids_node_in1[id_merge]], self.ids_node.has_index(self.ids_node_in1[id_merge]))
+                print('  id_node_in2', self.ids_node_in2[id_merge], nodes.ids_sumo[self.ids_node_in2[id_merge]], self.ids_node.has_index(self.ids_node_in2[id_merge]))
                 if 1:
                     id_merge_in1 = self.ids_node.get_id_from_index(self.ids_node_in1[id_merge])
                     id_merge_in2 = self.ids_node.get_id_from_index(self.ids_node_in2[id_merge])
-                    print '    station check id_merge', id_merge, 'id_merge_in1', id_merge_in1, 'station', self.are_station[id_merge_in1], 'id_merge_in2', id_merge_in2, 'station', self.are_station[id_merge_in2]
+                    print('    station check id_merge', id_merge, 'id_merge_in1', id_merge_in1, 'station', self.are_station[id_merge_in1], 'id_merge_in2', id_merge_in2, 'station', self.are_station[id_merge_in2])
 
                     if self.are_station[id_merge_in2]:
                         self.are_entry[id_merge] = True
@@ -1183,7 +1183,7 @@ class Mergenodes(am.ArrayObjman):
         return self.parent.get_scenario()
 
     def prepare_sim(self, process):
-        print 'Mergenodes.prepare_sim'
+        print('Mergenodes.prepare_sim')
         net = self.get_scenario().net
         nodes = net.nodes
         edges = net.edges
@@ -1274,8 +1274,8 @@ class Mergenodes(am.ArrayObjman):
 
     def process_step(self, process):
         simtime = process.simtime
-        print 79*'_'
-        print 'Mergenodes.process_step at', simtime
+        print(79*'_')
+        print('Mergenodes.process_step at', simtime)
         net = self.get_scenario().net
         vehicles = self.parent.prtvehicles
         ids = self.get_ids()
@@ -1287,8 +1287,8 @@ class Mergenodes(am.ArrayObjman):
                 self.ids_vehs_out_sumo[ids],
                 self.are_entry[ids],
                 ):
-            print '  '+60*'.'
-            print '  process id_merge', id_merge, ',id_node', id_node, net.nodes.ids_sumo[id_node]
+            print('  '+60*'.')
+            print('  process id_merge', id_merge, ',id_node', id_node, net.nodes.ids_sumo[id_node])
 
             ####
             debug = 0  # id_merge in [3,4]
@@ -1297,14 +1297,14 @@ class Mergenodes(am.ArrayObjman):
             ###
 
             if debug > 0:
-                print '  ids_vehs_merged_sumo', self.ids_vehs_merged_sumo[id_merge]
+                print('  ids_vehs_merged_sumo', self.ids_vehs_merged_sumo[id_merge])
 
             # check for new vehicle arrivals/departures
             ids_veh_sumo = set(traci.edge.getLastStepVehicleIDs(id_edge_out))
 
             if debug:
-                print '    ids_veh_sumo_prev=', ids_veh_out_sumo
-                print '    ids_veh_sumo=', ids_veh_sumo
+                print('    ids_veh_sumo_prev=', ids_veh_out_sumo)
+                print('    ids_veh_sumo=', ids_veh_sumo)
 
             if ids_veh_out_sumo != ids_veh_sumo:
 
@@ -1315,7 +1315,7 @@ class Mergenodes(am.ArrayObjman):
                 ids_veh_entered = vehicles.get_ids_from_ids_sumo(ids_veh_entered_sumo)
                 #ids_veh_left = vehicles.get_ids_from_ids_sumo(list(ids_veh_sumo_prev.difference(ids_veh_sumo)))
                 if debug > 0:
-                    print '  ids_veh_entered', ids_veh_entered, type(ids_veh_entered)
+                    print('  ids_veh_entered', ids_veh_entered, type(ids_veh_entered))
                 # print '  ids_veh_entered_sumo',ids_veh_entered_sumo
                 # print '  ids_leader',vehicles.ids_leader[ids_veh_entered]
 
@@ -1338,13 +1338,13 @@ class Mergenodes(am.ArrayObjman):
 
                         id_veh_sumo = ids_veh_entered_sumo[ind_entered]
                         if debug > 0:
-                            print '    >>exiting vehicle', id_veh_sumo, 'is_leader', vehicles.ids_leader[id_veh] == -1, 'ids_node_out', ids_node_out, 'ids_merge_out', ids_merge_out
+                            print('    >>exiting vehicle', id_veh_sumo, 'is_leader', vehicles.ids_leader[id_veh] == -1, 'ids_node_out', ids_node_out, 'ids_merge_out', ids_merge_out)
 
                         # print '      route_sumo',route_sumo
 
                         if ids_node_out is not None:
                             if debug > 0:
-                                print '  check which out mergenode are on the current route of the vehicle'
+                                print('  check which out mergenode are on the current route of the vehicle')
 
                             # exit from previous merge
                             # if debug:
@@ -1371,23 +1371,23 @@ class Mergenodes(am.ArrayObjman):
                                 mergeind = np.argmin(routeinds)
 
                                 if debug > 0:
-                                    print '      route_sumo', route_sumo
-                                    print '      routeinds', routeinds, 'downstream merge', routeinds[mergeind] < INFINT
-                                    print '      ids_edge_mergeout_sumo', ids_edge_mergeout_sumo
-                                    print '      mergeind,routeinds', mergeind, routeinds
-                                    print '      ids_merge_out[mergeind]', ids_merge_out[mergeind], ids_edge_mergeout_sumo[mergeind]
+                                    print('      route_sumo', route_sumo)
+                                    print('      routeinds', routeinds, 'downstream merge', routeinds[mergeind] < INFINT)
+                                    print('      ids_edge_mergeout_sumo', ids_edge_mergeout_sumo)
+                                    print('      mergeind,routeinds', mergeind, routeinds)
+                                    print('      ids_merge_out[mergeind]', ids_merge_out[mergeind], ids_edge_mergeout_sumo[mergeind])
 
                                 if routeinds[mergeind] < INFINT:
                                     if debug > 0:
-                                        print '      merge %d is on the route is_entry' % (ids_merge_out[mergeind])
+                                        print('      merge %d is on the route is_entry' % (ids_merge_out[mergeind]))
                                     if self.are_entry[ids_merge_out[mergeind]]:
                                         if debug > 0:
-                                            print '      call enter_veh_entry'
+                                            print('      call enter_veh_entry')
                                         self.enter_veh_entry(
                                             id_veh, id_veh_sumo, id_merge, ids_merge_out[mergeind], ids_edge_mergeout_sumo[mergeind], vehicles, debug=debug)
                                     else:
                                         if debug > 0:
-                                            print '      call enter_veh'
+                                            print('      call enter_veh')
                                         self.enter_veh(
                                             id_veh, id_veh_sumo, id_merge, ids_merge_out[mergeind], ids_edge_mergeout_sumo[mergeind], vehicles, debug=debug)
                                 else:
@@ -1399,7 +1399,7 @@ class Mergenodes(am.ArrayObjman):
 
                         else:
                             if debug:
-                                print '  ids_node_out is  None means that there is a station or compressor'
+                                print('  ids_node_out is  None means that there is a station or compressor')
                             # shunt edges behind.
                             # completely disconnect from all merge controlls
                             # including ghosts
@@ -1414,7 +1414,7 @@ class Mergenodes(am.ArrayObjman):
             if is_entry:
                 self.process_step_entry(id_merge, vehicles, debug)
         if 0:
-            print '========check mergeprocess'
+            print('========check mergeprocess')
             for id_merge, id_node_sumo, ids_veh_merged_sumo, ids_veh_merged in\
                 zip(ids,
                     net.nodes.ids_sumo[self.ids_node[ids]],
@@ -1422,11 +1422,11 @@ class Mergenodes(am.ArrayObjman):
                     self.ids_vehs_merged[ids]
                     ):
 
-                print '  ', id_merge, id_node_sumo, ids_veh_merged_sumo
+                print('  ', id_merge, id_node_sumo, ids_veh_merged_sumo)
                 # print '    ids_veh_merged',ids_veh_merged
 
     def exit_veh(self, id_veh, id_veh_sumo, id_merge_from, vehicles, is_remove_from_control=False, debug=0):
-        print 'exit_veh id_veh %s, id_merge_from %d ' % (id_veh_sumo, id_merge_from), 'entry', self.are_entry[id_merge_from]
+        print('exit_veh id_veh %s, id_merge_from %d ' % (id_veh_sumo, id_merge_from), 'entry', self.are_entry[id_merge_from])
         # print '    check for platooned vehicles:'
         # vehicles.get_platoon(id_veh)
         # in id_merge_from: take vehicle out of merged queue and input queue
@@ -1451,8 +1451,8 @@ class Mergenodes(am.ArrayObjman):
                 id_veh_tail = vehicles.get_platoontail(id_veh)  # get last in platoon
                 vehicles.del_ghost(id_veh_behind, id_veh_tail)
                 if debug > 0:
-                    print '  del ghost from veh', id_veh_behind, 'ghost', id_veh_tail
-                    print '    check ghosts:', vehicles.ids_ghosts[id_veh_behind]
+                    print('  del ghost from veh', id_veh_behind, 'ghost', id_veh_tail)
+                    print('    check ghosts:', vehicles.ids_ghosts[id_veh_behind])
                 # is there a vehicle in fron of the removed vehicle
                 # this happens if a vehicle is interactively deviated
                 if ind_pos > 0:
@@ -1477,14 +1477,14 @@ class Mergenodes(am.ArrayObjman):
             self.ids_vehs_merged_sumo[id_merge_from].pop(ind_pos)  # remove(id_veh_sumo)
             self.lineinds_vehs_merged[id_merge_from].pop(ind_pos)
             if debug > 0:
-                print '    vehicle has been on line index', lineind
+                print('    vehicle has been on line index', lineind)
             # remove vehicle from line buffers
             if lineind == 1:
                 self.ids_vehs_in1[id_merge_from].remove(id_veh)  # pop()
                 self.ids_vehs_in1_sumo[id_merge_from].remove(id_veh_sumo)  # .pop()
                 if self.are_entry[id_merge_from]:
                     if debug > 0:
-                        print '    vehicle is involved in entry merge processes?', self.vehicles_mains[id_merge_from].has_key(id_veh)
+                        print('    vehicle is involved in entry merge processes?', self.vehicles_mains[id_merge_from].has_key(id_veh))
                     if self.vehicles_mains[id_merge_from].has_key(id_veh):
                         #
                         #id_veh_entry = self.vehicles_mains[id_merge_from][id_veh]
@@ -1509,7 +1509,7 @@ class Mergenodes(am.ArrayObjman):
 
                 if self.are_entry[id_merge_from]:
                     if debug > 0:
-                        print '    del veh prt.%s from vehicles_entries' % id_veh
+                        print('    del veh prt.%s from vehicles_entries' % id_veh)
                     del self.vehicles_entries[id_merge_from][id_veh]
             else:
                 pass
@@ -1524,12 +1524,12 @@ class Mergenodes(am.ArrayObjman):
             # just be sure that the vehicle is not in any queue
             # but actually this cannot happen
             if id_veh in self.ids_vehs_in1[id_merge_from]:
-                print 'WARNING in exit_veh: new veh %d should not be in inqueue 1' % id_veh
+                print('WARNING in exit_veh: new veh %d should not be in inqueue 1' % id_veh)
                 self.ids_vehs_in1[id_merge_from].remove(id_veh)
                 self.ids_vehs_in1_sumo[id_merge_from].remove(id_veh_sumo)
 
             if id_veh in self.ids_vehs_in2[id_merge_from]:
-                print 'WARNING in exit_veh: new veh %d should not be in inqueue 2' % id_veh
+                print('WARNING in exit_veh: new veh %d should not be in inqueue 2' % id_veh)
                 self.ids_vehs_in2[id_merge_from].remove(id_veh)
                 self.ids_vehs_in2_sumo[id_merge_from].remove(id_veh_sumo)
 
@@ -1555,24 +1555,24 @@ class Mergenodes(am.ArrayObjman):
         #dist_diff = dist_max-dist_min+10.0
         if np.all([dist1_min, dist1_max, dist2_min, dist2_max]) > 0:
             f = float(pos_max)/dist_max
-            print '________________________'
-            print 'vehicle %s from line %d: %.f--%2f' % (id_veh1, lineind1, dist1_min, dist1_max)
+            print('________________________')
+            print('vehicle %s from line %d: %.f--%2f' % (id_veh1, lineind1, dist1_min, dist1_max))
             pos_min = int(dist1_min*f)
             pos_max = int(dist1_max*f)
-            print max(pos_min-1, 0)*' '+'<'+(pos_max-pos_min)*'X'+'|'
+            print(max(pos_min-1, 0)*' '+'<'+(pos_max-pos_min)*'X'+'|')
 
             pos_min = int(dist2_min*f)
             pos_max = int(dist2_max*f)
-            print max(pos_min-1, 0)*' '+'<'+(pos_max-pos_min)*'X'+'|'
-            print 'vehicle %s from line %d: %.f--%2f' % (id_veh2, lineind2, dist2_min, dist2_max)
-            print '________________________'
+            print(max(pos_min-1, 0)*' '+'<'+(pos_max-pos_min)*'X'+'|')
+            print('vehicle %s from line %d: %.f--%2f' % (id_veh2, lineind2, dist2_min, dist2_max))
+            print('________________________')
         else:
-            print 'WARNING: some negative distances:'
-            print 'vehicle %s from line %d: %.f--%2f' % (id_veh1, lineind1, dist1_min, dist1_max)
-            print 'vehicle %s from line %d: %.f--%2f' % (id_veh2, lineind2, dist2_min, dist2_max)
+            print('WARNING: some negative distances:')
+            print('vehicle %s from line %d: %.f--%2f' % (id_veh1, lineind1, dist1_min, dist1_max))
+            print('vehicle %s from line %d: %.f--%2f' % (id_veh2, lineind2, dist2_min, dist2_max))
 
     def enter_veh(self, id_veh, id_veh_sumo, id_merge_from, id_merge_to, id_edge_merge_sumo, vehicles, debug=0):
-        print 'enter_veh id_veh %s, id_merge_from %d to id_merge_to %d' % (id_veh_sumo, id_merge_from, id_merge_to)
+        print('enter_veh id_veh %s, id_merge_from %d to id_merge_to %d' % (id_veh_sumo, id_merge_from, id_merge_to))
 
         # in id_merge_from: take vehicle out of merged queue and input queue
 
@@ -1610,7 +1610,7 @@ class Mergenodes(am.ArrayObjman):
         if indpos == -1:
             # vehicle is new and must be merged into   ids_vehs_merged
             if debug > 0:
-                print '  merge veh %d arriving from in %d at dist %.2fm' % (id_veh, lineind, dist_tomerge_head_new)
+                print('  merge veh %d arriving from in %d at dist %.2fm' % (id_veh, lineind, dist_tomerge_head_new))
 
             ids_vehs_merged = self.ids_vehs_merged[id_merge_to]
             ids_vehs_merged_sumo = self.ids_vehs_merged_sumo[id_merge_to]
@@ -1624,7 +1624,7 @@ class Mergenodes(am.ArrayObjman):
             # print '  lineinds_vehs_merged[%d]'%id_merge_to,lineinds_vehs_merged
             if (ind_insert == 0) | self.are_station[id_merge_to]:
                 if debug > 0:
-                    print '    new vehicle is the only vehicle or station', ind_insert, self.are_station[id_merge_to]
+                    print('    new vehicle is the only vehicle or station', ind_insert, self.are_station[id_merge_to])
 
                 # vehicles heading toward a station merge are not
                 # really merged because only one incoming line
@@ -1642,7 +1642,7 @@ class Mergenodes(am.ArrayObjman):
                 dist_tomerge_tail_new = get_traci_distance(id_veh_tail_new_sumo, id_edge_merge_sumo, 3.0)
                 if debug > 0:
                     # print '    new veh %d arriving from in %d at dist head %.2f /__| tail %.2fm'%(id_veh,lineind,dist_tomerge_head_new,dist_tomerge_tail_new)
-                    print '       ids_vehs_merged_sumo', ids_vehs_merged_sumo
+                    print('       ids_vehs_merged_sumo', ids_vehs_merged_sumo)
                 for id_veh_merged, id_veh_merged_sumo in zip(ids_vehs_merged[::-1], ids_vehs_merged_sumo[::-1]):
                     dist_tomerge_head = get_traci_distance(id_veh_merged_sumo, id_edge_merge_sumo, 3.0)
                     #stoppeddist_tomerge = dist-0.5/self.decel*get_traci_velocity(id_veh_merged_sumo)**2+vehicles.lengths_plat[id_veh]
@@ -1679,11 +1679,11 @@ class Mergenodes(am.ArrayObjman):
                 if is_insert:
                     # at least one vehicle is in front
                     if debug > 0:
-                        print '    insert veh %d behind veh %d, index %d' % (id_veh, id_veh_merged, ind_insert)
+                        print('    insert veh %d behind veh %d, index %d' % (id_veh, id_veh_merged, ind_insert))
                     # send control info to involved vehicles
                     if ind_insert == len(ids_vehs_merged):
                         if debug > 0:
-                            print '    appended vehicle after veh', id_veh_tail_sumo, 'with leader', ids_vehs_merged_sumo[ind_insert-1], 'dtm=%.2fm' % dist_tomerge_tail
+                            print('    appended vehicle after veh', id_veh_tail_sumo, 'with leader', ids_vehs_merged_sumo[ind_insert-1], 'dtm=%.2fm' % dist_tomerge_tail)
                         # V
                         # |
                         # G ind_insert-1
@@ -1698,7 +1698,7 @@ class Mergenodes(am.ArrayObjman):
                     elif ind_insert > 0:
                         # there is at least 1 other veh in front
                         if debug > 0:
-                            print '    vehicle will be inserted in front of', ids_vehs_merged_sumo[ind_insert], 'and in behind', id_veh_tail_sumo, 'with leader', ids_vehs_merged_sumo[ind_insert-1], 'dtm=%.2fm' % dist_tomerge_tail
+                            print('    vehicle will be inserted in front of', ids_vehs_merged_sumo[ind_insert], 'and in behind', id_veh_tail_sumo, 'with leader', ids_vehs_merged_sumo[ind_insert-1], 'dtm=%.2fm' % dist_tomerge_tail)
                         # G1
                         # |
                         # V
@@ -1718,7 +1718,7 @@ class Mergenodes(am.ArrayObjman):
 
                 else:
                     if debug > 0:
-                        print '    prepend veh %d in front of veh %d, first index %d' % (id_veh, id_veh_merged, ind_insert)
+                        print('    prepend veh %d in front of veh %d, first index %d' % (id_veh, id_veh_merged, ind_insert))
                     # is vehicle and ghost in the same input line?
                     if lineinds_vehs_merged[ind_insert] != lineind:
                         id_veh_behind = ids_vehs_merged[ind_insert]  # last veh in queue
@@ -1738,7 +1738,7 @@ class Mergenodes(am.ArrayObjman):
             #    lineinds_vehs_merged[0] = lineind
 
     def enter_veh_entry(self, id_veh, id_veh_sumo, id_merge_from, id_merge_to, id_edge_merge_sumo, vehicles, debug=0):
-        print 'enter_veh_entry id_veh %s, id_merge_from %d to id_merge_to %d' % (id_veh_sumo, id_merge_from, id_merge_to)
+        print('enter_veh_entry id_veh %s, id_merge_from %d to id_merge_to %d' % (id_veh_sumo, id_merge_from, id_merge_to))
 
         # in id_merge_from: take vehicle out of merged queue and input queue
 
@@ -1770,8 +1770,8 @@ class Mergenodes(am.ArrayObjman):
         if lineind == 1:
             # from line 1 (main line)
             if debug > 0:
-                print '  Detected veh', id_veh_sumo, 'on mainline. Is new', indpos == -1
-                print '    check for platooned vehicles:'
+                print('  Detected veh', id_veh_sumo, 'on mainline. Is new', indpos == -1)
+                print('    check for platooned vehicles:')
                 vehicles.get_platoon(id_veh)
 
             id_edge_out_sumo = self.ids_merge_to_ids_edge_out_sumo[id_merge_to]
@@ -1845,12 +1845,12 @@ class Mergenodes(am.ArrayObjman):
         elif lineind == 2:
             # from line 2 (entry line)
             if debug > 0:
-                print '  Detected veh', id_veh_sumo, 'on entry line. Is new', indpos == -1
+                print('  Detected veh', id_veh_sumo, 'on entry line. Is new', indpos == -1)
 
             self.ids_vehs_in2[id_merge_to].append(id_veh)
             self.ids_vehs_in2_sumo[id_merge_to].append(id_veh_sumo)
             if debug > 0:
-                print '    command vehicle to stop and wait further instructions'
+                print('    command vehicle to stop and wait further instructions')
             #vehicles.control_slow_down(id_veh, speed = 6.0/3.6)
             #traci.vehicle.setMaxSpeed(id_veh_sumo, 6.0/3.6)
             # print '    set speed to',traci.vehicle.getMaxSpeed(id_veh_sumo)
@@ -1861,10 +1861,10 @@ class Mergenodes(am.ArrayObjman):
             # prevent SUMO from reaccelerating vehicle
             # vehicles.switch_off_control(id_veh)
             if debug > 0:
-                print '    set veh id_veh prt.%d' % id_veh
+                print('    set veh id_veh prt.%d' % id_veh)
             self.vehicles_entries[id_merge_to][id_veh] = {'status': 'wait'}
             if debug > 0:
-                print '    vehicles_entries[', id_merge_to, ']=', self.vehicles_entries[id_merge_to]
+                print('    vehicles_entries[', id_merge_to, ']=', self.vehicles_entries[id_merge_to])
             #
             # self.vehicles_mains[id_merge_to][id_veh] = {}# later when used
 
@@ -1885,10 +1885,10 @@ class Mergenodes(am.ArrayObjman):
             return vehicles_entries.keys()[0], vehicles_entries.values()[0]
 
     def process_step_entry(self, id_merge, vehicles, debug):
-        print 'process_step_entry id_merge', id_merge
+        print('process_step_entry id_merge', id_merge)
         if debug > 0:
-            print '  vehicles_entries=', self.vehicles_entries[id_merge]
-            print '  vehicles_mains', self.vehicles_mains[id_merge]
+            print('  vehicles_entries=', self.vehicles_entries[id_merge])
+            print('  vehicles_mains', self.vehicles_mains[id_merge])
         # print '  self.vehicles_entries',self.vehicles_entries
         #self.vehicles_entries[id_merge]= OrderedDict()
         # self.vehicles_mains[id_merge] = OrderedDict()
@@ -1914,7 +1914,7 @@ class Mergenodes(am.ArrayObjman):
             ids_vehs_merged_sumo = self.ids_vehs_merged_sumo[id_merge]
             lineinds_vehs_merged = self.lineinds_vehs_merged[id_merge]
             if debug > 0:
-                print '  check id_veh_sumo', id_veh_sumo, 'status', state['status'], 'n vehs on main', len(ids_veh_in1)
+                print('  check id_veh_sumo', id_veh_sumo, 'status', state['status'], 'n vehs on main', len(ids_veh_in1))
             if state['status'] == 'wait':
                 if traci.vehicle.isStopped(id_veh_sumo):
                     # check potential conflict vehicle on main line
@@ -1922,7 +1922,7 @@ class Mergenodes(am.ArrayObjman):
                     n1 = len(ids_veh_in1)
                     if n1 == 0:
                         if debug > 0:
-                            print '    main line is empty => accelerate immediately'
+                            print('    main line is empty => accelerate immediately')
                         for id_veh_plat in vehicles.get_platoon(id_veh):
                             vehicles.control_speedup(id_veh_plat)
                         state['status'] = 'accelerate'
@@ -1943,7 +1943,7 @@ class Mergenodes(am.ArrayObjman):
                             id_veh1_sumo = ids_veh_in1_sumo[i]
                             id_veh1 = ids_veh_in1[i]
                             if debug > 0:
-                                print '    check', id_veh1_sumo  # ,'free',id_veh1 not in vehicles_main
+                                print('    check', id_veh1_sumo)  # ,'free',id_veh1 not in vehicles_main
 
                             if True:  # id_veh1 not in vehicles_main:
 
@@ -1959,9 +1959,9 @@ class Mergenodes(am.ArrayObjman):
                                                                        dist_in1, dist_in2,
                                                                        vehicles)
                                 if debug > 0:
-                                    print '    potential veh %s (tail %s)' % (id_veh1_sumo, id_veh1_tail_sumo), 'at pos1_tail=%.1f>p_to=%.1f' % (pos1_tail, p_to), pos1_tail > p_to
+                                    print('    potential veh %s (tail %s)' % (id_veh1_sumo, id_veh1_tail_sumo), 'at pos1_tail=%.1f>p_to=%.1f' % (pos1_tail, p_to), pos1_tail > p_to)
 
-                                    print '       i=%d, n1=%d' % (i, n1), 'last vehicle on main', i == n1-1, 'more', i < n1-1
+                                    print('       i=%d, n1=%d' % (i, n1), 'last vehicle on main', i == n1-1, 'more', i < n1-1)
 
                                     #self.print_vehs(id_veh1, id_veh2, dist1_min, dist1_max, dist2_min, dist2_max,lineind1, lineind2, pos_max = 79)
 
@@ -1972,7 +1972,7 @@ class Mergenodes(am.ArrayObjman):
 
                                     if i == n1-1:  # last vehicle on main
                                         if debug > 0:
-                                            print '      insert id_veh', id_veh_sumo, 'behind id_veh1', id_veh1_sumo, 'the only veh on main'
+                                            print('      insert id_veh', id_veh_sumo, 'behind id_veh1', id_veh1_sumo, 'the only veh on main')
                                         state['id_veh_infront'] = id_veh1
                                         vehicles_main[id_veh1] = id_veh  # no, it does not get a ghost
                                         # vehicles_main[id_veh1] = {  'id_veh':id_veh,
@@ -1989,7 +1989,7 @@ class Mergenodes(am.ArrayObjman):
                                         id_veh_behind_sumo = vehicles.ids_sumo[id_veh_behind]
                                         pos1 = dist_in1 - get_traci_distance(id_veh_behind_sumo, id_edge_out_sumo, 3.0)
                                         if debug > 0:
-                                            print '      vehicle behind', id_veh_behind_sumo, 'pos=%.1f, p_from=%.1f' % (pos1, p_from), 'ok', pos1 < p_from
+                                            print('      vehicle behind', id_veh_behind_sumo, 'pos=%.1f, p_from=%.1f' % (pos1, p_from), 'ok', pos1 < p_from)
                                         if pos1 < p_from:
                                             state['id_veh_infront'] = id_veh1
                                             state['id_veh_behind'] = id_veh_behind
@@ -2008,7 +2008,7 @@ class Mergenodes(am.ArrayObjman):
                                 elif pos1 < p_from:
                                     if i == 0:  # first vehicle on main
                                         if debug > 0:
-                                            print '      insert id_veh', id_veh_sumo, 'in front of id_veh1', id_veh1_sumo, 'the only veh on main'
+                                            print('      insert id_veh', id_veh_sumo, 'in front of id_veh1', id_veh1_sumo, 'the only veh on main')
                                         state['id_veh_behind'] = id_veh1
                                         vehicles_main[id_veh1] = id_veh
                                         is_found = True
@@ -2034,7 +2034,7 @@ class Mergenodes(am.ArrayObjman):
 
                         if is_found:
                             if debug > 0:
-                                print '    suitable vehicle after which entry vehicle can run has been found'
+                                print('    suitable vehicle after which entry vehicle can run has been found')
                             # Note: if no vehicle has been found then
                             # nothing will happen and the vehicle will
                             # wait until the righ moment has arrived
@@ -2044,13 +2044,13 @@ class Mergenodes(am.ArrayObjman):
 
                         else:
                             if debug > 0:
-                                print '    nothing will happen and the vehicle will  wait until the righ moment has arrived'
+                                print('    nothing will happen and the vehicle will  wait until the righ moment has arrived')
 
             elif state['status'] == 'accelerate':
                 # test if speed reached
                 if traci.vehicle.getSpeed(id_veh_sumo) > 0.9*vehicles.speed_max:
                     if debug > 0:
-                        print '    synchronization reached for veh', id_veh_sumo
+                        print('    synchronization reached for veh', id_veh_sumo)
                     state['status'] = 'sync'
                     #id_veh_del = id_veh
                     # now create ghosts
@@ -2062,7 +2062,7 @@ class Mergenodes(am.ArrayObjman):
                         dist_tomerge = get_traci_distance(id_veh_sumo, id_edge_out_sumo, 3.0)
                         dist_tomerge_tail = get_traci_distance(id_veh_infront_tail_sumo, id_edge_out_sumo, 3.0)
                         if debug > 0:
-                            print '      add ghost to entering veh', id_veh_sumo, ' behind', id_veh_infront_tail_sumo, 'with leader', id_veh_in_front
+                            print('      add ghost to entering veh', id_veh_sumo, ' behind', id_veh_infront_tail_sumo, 'with leader', id_veh_in_front)
                         vehicles.add_ghost(id_veh, id_veh_infront_tail, dist_tomerge,
                                            dist_tomerge_tail, is_substitute=True)
 
@@ -2082,7 +2082,7 @@ class Mergenodes(am.ArrayObjman):
                 else:
                     if debug > 0:
                         speed = traci.vehicle.getSpeed(id_veh_sumo)
-                        print '    sync of veh', id_veh_sumo, ',v=%.1f, not yet reached: %.2f' % (speed, speed/vehicles.speed_max)
+                        print('    sync of veh', id_veh_sumo, ',v=%.1f, not yet reached: %.2f' % (speed, speed/vehicles.speed_max))
 
                     if state.has_key('id_veh_behind'):
                         id_veh_behind_sumo = vehicles.ids_sumo[state['id_veh_behind']]
@@ -2095,17 +2095,17 @@ class Mergenodes(am.ArrayObjman):
                             dist_safe = vehicles.tau*speed + 0.5*speed**2/vehicles.decel_emergency
                             dist_target = 2*dist_safe+vehicles.lengths_plat[id_veh]
                             if debug > 0:
-                                print '      behind', id_veh_behind_sumo, 'with infront', id_leader_sumo, 'at dist=%.2f' % dist_leader, 'at ds=%.2f' % dist_safe, 'is_brake', dist_leader < dist_target
+                                print('      behind', id_veh_behind_sumo, 'with infront', id_leader_sumo, 'at dist=%.2f' % dist_leader, 'at ds=%.2f' % dist_safe, 'is_brake', dist_leader < dist_target)
                             if dist_leader < dist_target:
                                 dv = time_update*vehicles.decel
                                 if (speed-dv) > 0:
                                     if debug > 0:
-                                        print '      slowdown', id_veh_behind_sumo, 'from speed %.2f to %.2f' % (speed, speed-dv)
+                                        print('      slowdown', id_veh_behind_sumo, 'from speed %.2f to %.2f' % (speed, speed-dv))
                                     traci.vehicle.slowDown(id_veh_behind_sumo, speed-dv, time_update)
                             else:
                                 dv = time_update*vehicles.decel
                                 if debug > 0:
-                                    print '      accel', id_veh_behind_sumo, 'from speed %.2f to %.2f' % (speed, speed+dv)
+                                    print('      accel', id_veh_behind_sumo, 'from speed %.2f to %.2f' % (speed, speed+dv))
                                 traci.vehicle.slowDown(id_veh_behind_sumo, speed+dv, time_update)
 
             elif state['status'] == 'sync':
@@ -2584,7 +2584,7 @@ class PrtStops(am.ArrayObjman):
         return positions+offset
 
     def prepare_sim(self, process):
-        print 'PrtStops.prepare_sim'
+        print('PrtStops.prepare_sim')
         net = self.get_scenario().net
         ptstops = net.ptstops
         ids_edge_sumo = net.edges.ids_sumo
@@ -2620,11 +2620,11 @@ class PrtStops(am.ArrayObjman):
             lastberthstoppos = berths.stoppositions[ids_berth_board][-1]
             if (length_stopedge-lastberthstoppos) > stoplinegap+1:
                 self.stoplines[id_stop] = length_stopedge-stoplinegap
-                print '  LI:id_stop', id_stop, 'length_stopedge', length_stopedge, 'stopline', self.stoplines[id_stop]
+                print('  LI:id_stop', id_stop, 'length_stopedge', length_stopedge, 'stopline', self.stoplines[id_stop])
 
             elif length_stopedge > lastberthstoppos:
                 self.stoplines[id_stop] = 0.5*(length_stopedge+lastberthstoppos)
-                print '  AV:id_stop', id_stop, 'length_stopedge', length_stopedge, 'stopline', self.stoplines[id_stop]
+                print('  AV:id_stop', id_stop, 'length_stopedge', length_stopedge, 'stopline', self.stoplines[id_stop])
 
         self.ids_stop_to_ids_acceledge_sumo = np.zeros(np.max(ids)+1, dtype=np.object)
         for id_stop, id_stopedge in zip(ids, ids_stopedge):
@@ -2726,8 +2726,8 @@ class PrtStops(am.ArrayObjman):
 
     def process_step(self, process):
         simtime = process.simtime
-        print 79*'_'
-        print 'PrtStops.process_step at', simtime
+        print(79*'_')
+        print('PrtStops.process_step at', simtime)
         net = self.get_scenario().net
         ptstops = net.ptstops
         berths = self.get_berths()
@@ -2741,22 +2741,22 @@ class PrtStops(am.ArrayObjman):
             zip(ids, self.ids_stop_to_ids_edge_sumo[ids],
                 self.ids_vehs_sumo_prev[ids],
                 self.ids_persons_sumo_prev[ids]):
-            print '  '+60*'.'
-            print '  process id_stop,id_edge_sumo', id_stop, id_edge_sumo
+            print('  '+60*'.')
+            print('  process id_stop,id_edge_sumo', id_stop, id_edge_sumo)
             if 0:  # id_stop==1:
 
                 # print '    ids_berth_alight',self.ids_berth_alight[id_stop]
                 # print '    ids_berth_board',self.ids_berth_board[id_stop]
-                print '    ids_vehs', self.ids_vehs[id_stop]
-                print '    ids_vehs_toallocate', self.ids_vehs_toallocate[id_stop]
-                print '    inds_berth_alight_allocated', self.inds_berth_alight_allocated[id_stop]
-                print '    ids_vehs_alight_allocated', self.ids_vehs_alight_allocated[id_stop]
-                print '    ids_vehs_board_allocated', self.ids_vehs_board_allocated[id_stop]
+                print('    ids_vehs', self.ids_vehs[id_stop])
+                print('    ids_vehs_toallocate', self.ids_vehs_toallocate[id_stop])
+                print('    inds_berth_alight_allocated', self.inds_berth_alight_allocated[id_stop])
+                print('    ids_vehs_alight_allocated', self.ids_vehs_alight_allocated[id_stop])
+                print('    ids_vehs_board_allocated', self.ids_vehs_board_allocated[id_stop])
                 # print '    id_veh_lead prt.%d'%self.ids_veh_lead[id_stop]
                 # print '    ids_vehs_prog',self.ids_vehs_prog[id_stop]
 
-                print '    iiinds_berth_alight_allocated', self.inds_berth_alight_allocated[id_stop]
-                print '    iiinds_berth_board_allocated', self.inds_berth_board_allocated[id_stop]
+                print('    iiinds_berth_alight_allocated', self.inds_berth_alight_allocated[id_stop])
+                print('    iiinds_berth_board_allocated', self.inds_berth_board_allocated[id_stop])
                 # print '    numbers_person_wait',self.numbers_person_wait[id_stop]
 
                 # print '    flow_person',self.flows_person[id_stop]
@@ -2769,7 +2769,7 @@ class PrtStops(am.ArrayObjman):
 
             if 0:
                 for id_veh_sumo in self.ids_vehs_sumo_prev[id_stop]:
-                    print '    stopstate ', id_veh_sumo, bin(traci.vehicle.getStopState(id_veh_sumo))[2:], traci.vehicle.getRoute(id_veh_sumo)
+                    print('    stopstate ', id_veh_sumo, bin(traci.vehicle.getStopState(id_veh_sumo))[2:], traci.vehicle.getRoute(id_veh_sumo))
 
             if 0:
                 self.get_berthqueues(id_stop)
@@ -2963,8 +2963,8 @@ class PrtStops(am.ArrayObjman):
             if ids_person_sumo_prev != ids_person_sumo:
 
                 if 0:
-                    print '  change\n  id_person_sumo', ids_person_sumo
-                    print '  ids_person_sumo_prev', ids_person_sumo_prev
+                    print('  change\n  id_person_sumo', ids_person_sumo)
+                    print('  ids_person_sumo_prev', ids_person_sumo_prev)
                 # print '  dir(traci.person)',dir(traci.person)
                 # for id_person_sumo in ids_person_sumo:
                 #    print '  id_person_sumo',id_person_sumo,traci.person.getRoadID(id_person_sumo),traci.person.getVehicle(id_person_sumo)
@@ -3019,7 +3019,7 @@ class PrtStops(am.ArrayObjman):
 
             if 0:
                 for id_person_sumo in ids_person_sumo_prev:
-                    print '    ids_person_sumo=%s pos = %.2f ' % (id_person_sumo, traci.person.getLanePosition(id_person_sumo))
+                    print('    ids_person_sumo=%s pos = %.2f ' % (id_person_sumo, traci.person.getLanePosition(id_person_sumo)))
                 # nomore print '    ids_persons_sumo_boarded',self.ids_persons_sumo_boarded[id_stop]
 
             # check if boarding is completed in load area,
@@ -3082,7 +3082,7 @@ class PrtStops(am.ArrayObjman):
                 self.start_vehicles(id_stop, process)
 
     def start_vehicles(self, id_stop, process):
-        print 'start_vehicles=\n', self.ids_vehs_prog[id_stop]
+        print('start_vehicles=\n', self.ids_vehs_prog[id_stop])
         i = 0
         vehicles = self.parent.prtvehicles
         ids_vehs_prog = self.ids_vehs_prog[id_stop]
@@ -3319,7 +3319,7 @@ class PrtStops(am.ArrayObjman):
             return True
 
         else:
-            print '  no leader prt.%d exists' % (id_veh,)
+            print('  no leader prt.%d exists' % (id_veh,))
             return False
 
     def init_trip_occupied(self, id_stop, id_berth, id_veh, id_veh_sumo, simtime):
@@ -3350,7 +3350,7 @@ class PrtStops(am.ArrayObjman):
             #    id_person_sumo_inveh = id_person_sumo
 
         if id_person_sumo_inveh is not None:
-            print '  found person %s in veh %s' % (id_person_sumo_inveh, id_veh_sumo)
+            print('  found person %s in veh %s' % (id_person_sumo_inveh, id_veh_sumo))
 
             # program vehicle to person's destination
             # print '    found person,origs_dests',id_person_sumo_inveh,self.id_person_to_origs_dests[id_person_sumo_inveh]
@@ -3376,7 +3376,7 @@ class PrtStops(am.ArrayObjman):
             return id_person_sumo_inveh
 
         else:
-            print 'WARNING: on stop %d edge %s, berth %d no person found inside vehicle prt.%d' % (id_stop, self.ids_stop_to_ids_edge_sumo[id_stop], id_berth, id_veh)
+            print('WARNING: on stop %d edge %s, berth %d no person found inside vehicle prt.%d' % (id_stop, self.ids_stop_to_ids_edge_sumo[id_stop], id_berth, id_veh))
             return None
 
     def _get_stopline(self, id_stop, simtime):
@@ -3430,7 +3430,7 @@ class PrtStops(am.ArrayObjman):
         # self.ids_vehs_outset[id_stop].add(id_veh)
 
     def foreward_boardzone(self, id_stop,  ids_berth_board, simtime):
-        print 'foreward_boardzone', id_stop, ids_berth_board, 'simtime', simtime
+        print('foreward_boardzone', id_stop, ids_berth_board, 'simtime', simtime)
         berths = self.get_berths()
         #ids_berth_board = self.ids_berth_board[id_stop][::-1]
         # inds_o berths.states[ids_berth_board] != BERTHSTATES['free']
@@ -3442,7 +3442,7 @@ class PrtStops(am.ArrayObjman):
         self.times_lastboard[id_stop] = 10**4  # reset last board counter
 
     def enter(self, id_stop, id_veh):
-        print 'enter id_stop, id_veh', id_stop, 'prt.%d' % id_veh
+        print('enter id_stop, id_veh', id_stop, 'prt.%d' % id_veh)
 
         self.parent.prtvehicles.decatenate(id_veh)
 
@@ -3464,10 +3464,10 @@ class PrtStops(am.ArrayObjman):
             # print '  id_veh_sumo',id_veh_sumo
             #pos = traci.vehicle.getLanePosition(id_veh_sumo)
             if 0:
-                print '     send entering vehicle id_veh %d, pos=%.2f to id_berth_alight %d at pos %.2fm' % (id_veh, traci.vehicle.getLanePosition(id_veh_sumo), id_berth, self.get_berths().stoppositions[id_berth])
-                print '       ids_ghost', self.parent.prtvehicles.ids_ghosts[id_veh]
-                print '       ids_leader', self.parent.prtvehicles.ids_leader[id_veh]
-                print '       ids_follower', self.parent.prtvehicles.ids_follower[id_veh]
+                print('     send entering vehicle id_veh %d, pos=%.2f to id_berth_alight %d at pos %.2fm' % (id_veh, traci.vehicle.getLanePosition(id_veh_sumo), id_berth, self.get_berths().stoppositions[id_berth]))
+                print('       ids_ghost', self.parent.prtvehicles.ids_ghosts[id_veh])
+                print('       ids_leader', self.parent.prtvehicles.ids_leader[id_veh])
+                print('       ids_follower', self.parent.prtvehicles.ids_follower[id_veh])
 
             self.parent.prtvehicles.control_stop_alight(id_veh, id_stop, id_berth,
                                                         id_edge_sumo=self.ids_stop_to_ids_edge_sumo[id_stop],
@@ -3572,7 +3572,7 @@ class PrtStops(am.ArrayObjman):
         """
         Make prt stop database from PT stops in network.
         """
-        print 'make_from_net'
+        print('make_from_net')
         self.clear()
         net = self.get_scenario().net
         ptstops = net.ptstops
@@ -3620,7 +3620,7 @@ class PrtStops(am.ArrayObjman):
 
 class VehicleAdder(Process):
     def __init__(self,  vehicles, logger=None, **kwargs):
-        print 'VehicleAdder.__init__', vehicles, vehicles.parent.get_ident()
+        print('VehicleAdder.__init__', vehicles, vehicles.parent.get_ident())
         self._init_common('vehicleadder', name='Vehicle adder',
                           logger=logger,
                           info='Add vehicles to PRT stops of network.',
@@ -3795,7 +3795,7 @@ class PrtVehicles(am.ArrayObjman):
         return self.parent.get_scenario().net
 
     def make_vtype(self, is_renew=False):
-        print 'make_vtype PRT'
+        print('make_vtype PRT')
         vtypes = self.get_scenario().demand.vtypes
         prttype = 'PRT'
 
@@ -3901,7 +3901,7 @@ class PrtVehicles(am.ArrayObjman):
         return self.length
 
     def prepare_sim(self, process):
-        print 'PrtVehicles.prepare_sim'
+        print('PrtVehicles.prepare_sim')
         if len(self) == 0:
             return []
 
@@ -3962,7 +3962,7 @@ class PrtVehicles(am.ArrayObjman):
         #    self.del_ghost(id_veh, id_ghost_old)
         # else:
         # add new ghost
-        print 'add_ghost id_veh %d id_ghost %d' % (id_veh, id_ghost)  # ,self.ids_ghosts.shape
+        print('add_ghost id_veh %d id_ghost %d' % (id_veh, id_ghost))  # ,self.ids_ghosts.shape
 
         if -1 not in ids_ghosts:
             # print 'ERROR: no more ghosts available, ids_ghosts',ids_ghosts
@@ -3981,7 +3981,7 @@ class PrtVehicles(am.ArrayObjman):
                         ind_ghost -= 1
 
         if ind_ghost > 0:
-            print 'WARNING: unusual number of ghosts, ids_ghosts', ids_ghosts
+            print('WARNING: unusual number of ghosts, ids_ghosts', ids_ghosts)
             # sys.exit(1)
 
         self.ids_ghosts[id_veh][ind_ghost] = id_ghost
@@ -4068,8 +4068,8 @@ class PrtVehicles(am.ArrayObjman):
 
     def process_step(self, process):
         simtime = process.simtime
-        print 79*'_'
-        print 'PrtVehicles.process_step at', simtime
+        print(79*'_')
+        print('PrtVehicles.process_step at', simtime)
         net = self.get_scenario().net
         vehicles = self.parent.prtvehicles
         ids = self.get_ids()
@@ -4098,7 +4098,7 @@ class PrtVehicles(am.ArrayObjman):
 
             if 0:
                 ids_ghost = self.ids_ghosts[id_veh]
-                print '  %7s' % id_veh_sumo, 'ghosts', ids_ghost, self.ids_leader[id_veh], "lp=%.1fm" % self.lengths_plat[id_veh]
+                print('  %7s' % id_veh_sumo, 'ghosts', ids_ghost, self.ids_leader[id_veh], "lp=%.1fm" % self.lengths_plat[id_veh])
                 #odo = self.odos[id_veh]
                 #delta_vehs = odo-self.odos0_vehicles[id_veh]
                 #delta_ghosts = self.odos[ids_ghost] - self.odos0_ghosts[id_veh]
@@ -4234,7 +4234,7 @@ class PrtVehicles(am.ArrayObjman):
         #self.tau = vtypes.taus[id_vtype]
 
     def reset_speedmode(self, id_veh_sumo):
-        print 'reset_speedmode', id_veh_sumo
+        print('reset_speedmode', id_veh_sumo)
         # speed mode (0xb3)
         # Per default, the vehicle is using the given speed regarding the safe gap, the maximum acceleration, and the maximum deceleration. Furthermore, vehicles follow the right-of-way rules when approaching an intersection and if necessary they brake hard to avoid driving across a red light. One can control this behavior using the speed mode (0xb3) command, the given integer is a bitset (bit0 is the least significant bit) with the following fields:
         # 1 bit0: Regard safe speed
@@ -4250,7 +4250,7 @@ class PrtVehicles(am.ArrayObjman):
         # pass
 
     def concatenate(self, id_veh, id_veh_pre):
-        print 'concatenate prt.%d' % id_veh, 'behind  prt.%d' % id_veh_pre
+        print('concatenate prt.%d' % id_veh, 'behind  prt.%d' % id_veh_pre)
         # print '  >>'
         self.ids_leader[id_veh] = id_veh_pre
         self.ids_follower[id_veh_pre] = id_veh
@@ -4258,13 +4258,13 @@ class PrtVehicles(am.ArrayObjman):
         id_veh_sumo = self.get_id_sumo(id_veh)
 
         if 0:
-            print 'follower params'
-            print '  speedmode', self._speedmode_follower
-            print '  factor_speed', self._factor_speed_follower
-            print '  decel', self._decel_emergency_follower, '= decel_emergency'
-            print '  accel_follower', self._accel_follower
-            print '  dist_min', self._dist_min_follower
-            print '  tau', self._tau_follower
+            print('follower params')
+            print('  speedmode', self._speedmode_follower)
+            print('  factor_speed', self._factor_speed_follower)
+            print('  decel', self._decel_emergency_follower, '= decel_emergency')
+            print('  accel_follower', self._accel_follower)
+            print('  dist_min', self._dist_min_follower)
+            print('  tau', self._tau_follower)
 
         # if 0:
         #    traci.vehicle.setSpeedFactor(id_veh_sumo,2.0)# +random.uniform(-0.01,0.01)
@@ -4302,7 +4302,7 @@ class PrtVehicles(am.ArrayObjman):
             self._update_concatenate(self.ids_leader[id_veh], length_plat + self.length)
 
     def decatenate(self, id_veh):
-        print 'decatenate prt.%d' % id_veh
+        print('decatenate prt.%d' % id_veh)
 
         id_leader = self.ids_leader[id_veh]
         # print '  id_leader',id_leader
@@ -4317,7 +4317,7 @@ class PrtVehicles(am.ArrayObjman):
                 # TODO
                 self.lengths_plat[id_veh] = self.lengths_plat[id_leader]-self.length
             else:
-                print 'WARNING in decatenate: platoon broken up in the middel at', id_veh_sumo
+                print('WARNING in decatenate: platoon broken up in the middel at', id_veh_sumo)
                 self.lengths_plat[id_veh] = 0.0
 
             # this vehicle will become first in the platoon
@@ -4357,16 +4357,16 @@ class PrtVehicles(am.ArrayObjman):
         return id_veh
 
     def get_platoon(self, id_veh):
-        print 'get_platoon', id_veh
+        print('get_platoon', id_veh)
         ids_veh = [id_veh, ]
         id_veh = self.ids_follower[id_veh]
         # print '  id_veh',id_veh
         while id_veh > -1:
             ids_veh.append(id_veh)
             id_veh = self.ids_follower[id_veh]
-            print '  id_veh', id_veh
+            print('  id_veh', id_veh)
 
-        print '   ids_veh', ids_veh
+        print('   ids_veh', ids_veh)
         return ids_veh
 
     def get_entered_left(self, id_edge_sumo, ids_veh_previous_sumo):
@@ -4429,7 +4429,7 @@ class PrtVehicles(am.ArrayObjman):
         stopline = pos + 3.0 + 0.5/self.decel*speed**2
         #time_slowdown = np.abs((speed0-speed)/self.decel)
 
-        print 'control_stop', id_veh_sumo, 'v = %.2f at pos %.1fm to stop at %.1fm on %s' % (speed, pos, stopline, traci.vehicle.getRoadID(id_veh_sumo))
+        print('control_stop', id_veh_sumo, 'v = %.2f at pos %.1fm to stop at %.1fm on %s' % (speed, pos, stopline, traci.vehicle.getRoadID(id_veh_sumo)))
         traci.vehicle.setStop(id_veh_sumo,
                               traci.vehicle.getRoadID(id_veh_sumo),
                               pos=stopline,
@@ -4439,7 +4439,7 @@ class PrtVehicles(am.ArrayObjman):
     def control_speedup(self, id_veh):
 
         id_veh_sumo = self.get_id_sumo(id_veh)
-        print 'control_speedup', id_veh_sumo, 'isStopped', traci.vehicle.isStopped(id_veh_sumo), self.speed_max
+        print('control_speedup', id_veh_sumo, 'isStopped', traci.vehicle.isStopped(id_veh_sumo), self.speed_max)
 
         if traci.vehicle.isStopped(id_veh_sumo):
             traci.vehicle.resume(id_veh_sumo)
@@ -4448,7 +4448,7 @@ class PrtVehicles(am.ArrayObjman):
         #self.control_slow_down(id_veh, self.speed_max)
 
     def control_slow_down(self, id_veh, speed=1.0, time_slowdown=None):
-        print 'control_slow_down', self.get_id_sumo(id_veh), speed, time_slowdown
+        print('control_slow_down', self.get_id_sumo(id_veh), speed, time_slowdown)
         id_veh_sumo = self.get_id_sumo(id_veh)
         if time_slowdown is None:
             speed0 = traci.vehicle.getSpeed(id_veh_sumo)
@@ -4467,7 +4467,7 @@ class PrtVehicles(am.ArrayObjman):
                             ):
         id_veh_sumo = self.get_id_sumo(id_veh)
         p = traci.vehicle.getLanePosition(id_veh_sumo)
-        print 'control_stop_alight', id_veh_sumo, p, '->', position, 'id_berth', id_berth
+        print('control_stop_alight', id_veh_sumo, p, '->', position, 'id_berth', id_berth)
         #d = position - p
         #v = traci.vehicle.getSpeed(id_veh_sumo)
         #d_save = 1.0/(2*2.5)*(v**2)
@@ -4488,7 +4488,7 @@ class PrtVehicles(am.ArrayObjman):
                            ):
 
         id_veh_sumo = self.get_id_sumo(id_veh)
-        print 'control_stop_board', id_veh_sumo, id_stop, id_berth, id_edge_sumo, 'pos=%.2f,target %.2f' % (traci.vehicle.getLanePosition(id_veh_sumo), position)
+        print('control_stop_board', id_veh_sumo, id_stop, id_berth, id_edge_sumo, 'pos=%.2f,target %.2f' % (traci.vehicle.getLanePosition(id_veh_sumo), position))
         # print '  v=',traci.vehicle.getSpeed(id_veh_sumo)
 
         # print 'control_stop_board',id_veh_sumo,traci.vehicle.getLanePosition(id_veh_sumo),'->',position,id_berth
@@ -4535,7 +4535,7 @@ class PrtVehicles(am.ArrayObjman):
         # print 'board ',id_veh_sumo, traci.vehicle.getStopState(id_veh_sumo )# bin(traci.vehicle.getStopState(id_veh_sumo ))[2:]
 
     def set_stop(self, id_veh, id_edge_sumo, stopline, laneindex=1):
-        print 'set_stop', self.get_id_sumo(id_veh), stopline
+        print('set_stop', self.get_id_sumo(id_veh), stopline)
         traci.vehicle.setStop(self.get_id_sumo(id_veh),
                               id_edge_sumo,
                               pos=stopline,
@@ -4560,7 +4560,7 @@ class PrtVehicles(am.ArrayObjman):
         elif self.states[id_veh] == VEHICLESTATES['await_forwarding']:
             return True
         else:
-            print 'WARNING: strange vehicle state %s while alighting prt.%d' % (self.states[id_veh], id_veh)
+            print('WARNING: strange vehicle state %s while alighting prt.%d' % (self.states[id_veh], id_veh))
             return True
 
     def is_completed_boarding(self, id_veh):
@@ -4593,7 +4593,7 @@ class PrtVehicles(am.ArrayObjman):
 
     def init_trip_occupied(self, id_veh, id_edge_sumo, stopline=None):
         id_veh_sumo = self.get_id_sumo(id_veh)
-        print 'init_trip_occupied', self.get_id_sumo(id_veh), 'from edge', id_edge_sumo, stopline
+        print('init_trip_occupied', self.get_id_sumo(id_veh), 'from edge', id_edge_sumo, stopline)
         # print '  current route:',traci.vehicle.getRoute(id_veh_sumo)
         self.states[id_veh] = VEHICLESTATES['occupiedtrip']
 
@@ -4614,7 +4614,7 @@ class PrtVehicles(am.ArrayObjman):
             #traci.vehicle.slowDown(id_veh_sumo, speed_crawl, time_accel)
 
     def init_trip_empty(self, id_veh, id_edge_sumo, stopline=None):
-        print 'Vehicles.init_trip_empty', self.get_id_sumo(id_veh), id_edge_sumo, stopline
+        print('Vehicles.init_trip_empty', self.get_id_sumo(id_veh), id_edge_sumo, stopline)
         self.states[id_veh] = VEHICLESTATES['emptytrip']
         id_veh_sumo = self.get_id_sumo(id_veh)
         if traci.vehicle.isStopped(id_veh_sumo):
@@ -4637,7 +4637,7 @@ class PrtVehicles(am.ArrayObjman):
             #traci.vehicle.slowDown(id_veh_sumo, speed_crawl, time_accel)
 
     def reschedule_trip_sumo(self, id_veh_sumo, id_edge_sumo_to=None, route_sumo=None):
-        print 'reschedule_trip_sumo', id_veh_sumo, id_edge_sumo_to, route_sumo
+        print('reschedule_trip_sumo', id_veh_sumo, id_edge_sumo_to, route_sumo)
         if traci.vehicle.isStopped(id_veh_sumo):
             traci.vehicle.resume(id_veh_sumo)
 
@@ -4654,7 +4654,7 @@ class PrtVehicles(am.ArrayObjman):
         #traci.vehicle.slowDown(id_veh_sumo, 13.0, 5.0)
 
     def reschedule_trip(self, id_veh, id_edge_sumo_to=None, route_sumo=None):
-        print 'reschedule_trip', self.get_id_sumo(id_veh), id_edge_sumo_to, route_sumo
+        print('reschedule_trip', self.get_id_sumo(id_veh), id_edge_sumo_to, route_sumo)
         id_veh_sumo = self.get_id_sumo(id_veh)
         if traci.vehicle.isStopped(id_veh_sumo):
             traci.vehicle.resume(id_veh_sumo)
@@ -4819,7 +4819,7 @@ class PrtStrategy(StrategyMixin):
         # put 2 for persons with car access and who prefer cars
         preeval[persons.ids_mode_preferred[ids_person] == self.prtservice.id_prtmode] = 2
 
-        print '  PrtStrategy.preevaluate', len(np.flatnonzero(preeval))
+        print('  PrtStrategy.preevaluate', len(np.flatnonzero(preeval)))
         return preeval
 
     def plan(self, ids_person, logger=None):
@@ -4827,7 +4827,7 @@ class PrtStrategy(StrategyMixin):
         Generates a plan for these person according to this strategie.
         Overriden by specific strategy.
         """
-        print 'PrtStrategy.pan', len(ids_person)
+        print('PrtStrategy.pan', len(ids_person))
         #make_plans_private(self, ids_person = None, mode = 'passenger')
         # routing necessary?
         virtualpop = self.get_virtualpop()
@@ -4869,7 +4869,7 @@ class PrtStrategy(StrategyMixin):
             = virtualpop.get_activities_from_pattern(0, ids_person=ids_person)
 
         if len(ids_person_act) == 0:
-            print 'WARNING in TrasitStrategy.plan: no eligible persons found.'
+            print('WARNING in TrasitStrategy.plan: no eligible persons found.')
             return False
 
         # temporary maps from ids_person to other parameters
@@ -4888,7 +4888,7 @@ class PrtStrategy(StrategyMixin):
         map_ids_fac_from[ids_person_act] = activities.ids_facility[ids_act_from]
 
         n_plans = len(ids_person_act)
-        print 'TrasitStrategy.plan n_plans=', n_plans
+        print('TrasitStrategy.plan n_plans=', n_plans)
 
         # make initial activity stage
         ids_edge_from = facilities.ids_roadedge_closest[map_ids_fac_from[ids_person_act]]
@@ -4970,11 +4970,11 @@ class PrtStrategy(StrategyMixin):
                 if logger:
                     logger.progress(i/n_pers*100)
                 i += 1.0
-                print 79*'_'
-                print '  id_plan=%d, id_person=%d, ' % (id_plan, id_person)
+                print(79*'_')
+                print('  id_plan=%d, id_person=%d, ' % (id_plan, id_person))
 
                 if (dist_from_to < dist_walk_max) | (id_edge_from == -1) | (id_edge_to == -1) | (id_stop_from == id_stop_to):
-                    print '    go by foot because distance is too short ', dist_from_to, 'edges', id_edge_from, id_edge_to, 'stops', id_stop_from, id_stop_to
+                    print('    go by foot because distance is too short ', dist_from_to, 'edges', id_edge_from, id_edge_to, 'stops', id_stop_from, id_stop_to)
 
                     id_stage_walk1, time = walkstages.append_stage(
                         id_plan, time_from,
@@ -5041,7 +5041,7 @@ class PrtTransits(StageTypeMixin):
                  # **kwargs,
                  ):
 
-        print 'PrtTransits.__init__', ident, stages
+        print('PrtTransits.__init__', ident, stages)
         self.init_stagetable(ident,
                              stages, name=name,
                              info=info,
@@ -5073,10 +5073,10 @@ class PrtTransits(StageTypeMixin):
     def prepare_planning(self):
 
         prtservice = self.get_prtservice()
-        print 'prttransits.prepare_planning', prtservice.times_stop_to_stop
+        print('prttransits.prepare_planning', prtservice.times_stop_to_stop)
         if prtservice.times_stop_to_stop is None:
             prtservice.make_times_stop_to_stop()
-        print prtservice.times_stop_to_stop
+        print(prtservice.times_stop_to_stop)
 
     def append_stage(self, id_plan, time_start=-1.0,
                      duration=0.0,
@@ -5216,7 +5216,7 @@ class VehicleMan(am.ArrayObjman):
         return self.parent.parent.get_scenario()
 
     def prepare_sim(self, process):
-        print 'VehicleMan.prepare_sim'
+        print('VehicleMan.prepare_sim')
         net = self.get_scenario().net
         # station management
         # self.ids_stop_to_ids_edge_sumo = np.zeros(np.max(ids)+1,dtype = np.object)
@@ -5238,7 +5238,7 @@ class VehicleMan(am.ArrayObjman):
         self.ids_veh = self.get_vehicles().get_ids()
 
         if len(self.ids_veh) == 0:
-            print 'WARNING: no PRT vehicles, please add PRT vehicles.'
+            print('WARNING: no PRT vehicles, please add PRT vehicles.')
             return []
 
         n_veharray = np.max(self.ids_veh)+1
@@ -5293,8 +5293,8 @@ class VehicleMan(am.ArrayObjman):
         self.log_inflows_temp[:] = 0
 
     def process_step(self, process):
-        print 79*'M'
-        print 'VehicleMan.process_step'
+        print(79*'M')
+        print('VehicleMan.process_step')
 
         stops = self.get_stops()
         #vehicles = self.get_vehicles()
@@ -5339,7 +5339,7 @@ class VehicleMan(am.ArrayObjman):
         inds_valid = np.flatnonzero(vehicles.states[ids_veh_lead] == VEHICLESTATES['occupiedtrip'])
         if len(inds_valid) == 0:
             return False
-        print 'push_occupied_leadvehs ids_veh_lead', ids_veh_lead[inds_valid]
+        print('push_occupied_leadvehs ids_veh_lead', ids_veh_lead[inds_valid])
         times_stop_to_stop = self.parent.times_stop_to_stop
         ids_stop_current = self.ids_stop_current[ids_veh_lead[inds_valid]]
         ids_stop_target = self.ids_stop_target[ids_veh_lead[inds_valid]]
@@ -5365,7 +5365,7 @@ class VehicleMan(am.ArrayObjman):
                     durations_est,
                 ):
 
-            print '    check veh', id_veh_lead, state, 'id_stop_current', id_stop_current, 'id_stop_target', id_stop_target
+            print('    check veh', id_veh_lead, state, 'id_stop_current', id_stop_current, 'id_stop_target', id_stop_target)
 
             #VEHICLESTATES = {'init':0,'waiting':1,'boarding':2,'alighting':3,'emptytrip':4,'occupiedtrip':5,'forewarding':6}
             # if state == VEHICLESTATES['occupiedtrip']:
@@ -5398,7 +5398,7 @@ class VehicleMan(am.ArrayObjman):
         if len(inds_valid) == 0:
             return False
 
-        print 'push_empty_leadvehs ids_veh_lead', ids_veh_lead[inds_valid]
+        print('push_empty_leadvehs ids_veh_lead', ids_veh_lead[inds_valid])
         times_stop_to_stop = self.parent.times_stop_to_stop
         ids_stop_current = self.ids_stop_current[ids_veh_lead[inds_valid]]
 
@@ -5427,7 +5427,7 @@ class VehicleMan(am.ArrayObjman):
 
             durations_est = times_stop_to_stop[id_stop_current, ids_stop_target]
             ind_stop_current = np.flatnonzero(durations_est == 0)[0]
-            print '    check veh', id_veh_lead, 'id_stop_current', id_stop_current, 'ind_stop_current', ind_stop_current
+            print('    check veh', id_veh_lead, 'id_stop_current', id_stop_current, 'ind_stop_current', ind_stop_current)
             inds_time_min = np.array(np.clip(np.array(1.0*durations_est/self.time_update_flows.get_value(),
                                                       dtype=np.int32), 0, self.n_est_max-n_searchint), dtype=np.int32)
             inds_search = inds_search_base + inds_time_min.reshape(n_stop_target, 1)
@@ -5447,28 +5447,28 @@ class VehicleMan(am.ArrayObjman):
             costs[ind_stop_current, :] = -999999
             if 0:
                 for ind, id_stop in zip(range(n_stop_target), ids_stop_target):
-                    print 40*'.'
-                    print '  id_stop', id_stop
-                    print '     waittimes_tot', stops.waittimes_tot[id_stop]
-                    print '     numbers_person_wait', stops.numbers_person_wait[id_stop]
-                    print '     flow_person_est', flow_person_est[ind]
-                    print '     inflows_sched', self.inflows_sched[id_stop, inds_search[ind]]
-                    print '     delta flow', (flow_person_est[ind]-self.inflows_sched[id_stop, inds_search[ind]])
-                    print '     demandcomp', self.weight_demand.get_value() * stops.numbers_person_wait[id_stop]
-                    print '     flowcomp', self.weight_flow.get_value() * (flow_person_est[ind]-self.inflows_sched[id_stop, inds_search[ind]])
-                    print '     arrivaltime est', inds_search[ind]*self.time_update_flows.get_value()
-                    print '     flow_person_est', flow_person_est[ind]
+                    print(40*'.')
+                    print('  id_stop', id_stop)
+                    print('     waittimes_tot', stops.waittimes_tot[id_stop])
+                    print('     numbers_person_wait', stops.numbers_person_wait[id_stop])
+                    print('     flow_person_est', flow_person_est[ind])
+                    print('     inflows_sched', self.inflows_sched[id_stop, inds_search[ind]])
+                    print('     delta flow', (flow_person_est[ind]-self.inflows_sched[id_stop, inds_search[ind]]))
+                    print('     demandcomp', self.weight_demand.get_value() * stops.numbers_person_wait[id_stop])
+                    print('     flowcomp', self.weight_flow.get_value() * (flow_person_est[ind]-self.inflows_sched[id_stop, inds_search[ind]]))
+                    print('     arrivaltime est', inds_search[ind]*self.time_update_flows.get_value())
+                    print('     flow_person_est', flow_person_est[ind])
                     print
 
                     # print '    flow_person_est',flow_person_#est
-                    print '    timeweight', timeweight[ind]
-                    print '    durations_est', durations_est[ind]
-                    print '    inds_search_base', inds_search_base[ind]
+                    print('    timeweight', timeweight[ind])
+                    print('    durations_est', durations_est[ind])
+                    print('    inds_search_base', inds_search_base[ind])
                     # print '    inds_search unclipped\n',inds_search_base +np.array(1.0*durations_est/self.time_update_flows.get_value(),dtype=np.int32).reshape(n_stop_target,1)
-                    print '    inds_search clipped  \n', inds_search[ind]
-                    print '    inds_time_min', inds_time_min[ind]
+                    print('    inds_search clipped  \n', inds_search[ind])
+                    print('    inds_time_min', inds_time_min[ind])
                     # print '    ind_stop_current',ind_stop_current,durations_est[ind_stop_current]
-                    print '    costs=\n', costs[ind]
+                    print('    costs=\n', costs[ind])
             # constant_timeweight
 
             #
@@ -5478,9 +5478,9 @@ class VehicleMan(am.ArrayObjman):
             ind_time_delta = ind_target % n_searchint
             ind_time_arrive = inds_search[ind_stop_target, ind_time_delta]
             if 0:
-                print '    ind_target,n_searchint,ind_stop_target,ind_time_delta', ind_target, n_searchint, ind_target/n_searchint, ind_time_delta
-                print '    ind_delta_depart,c_min', costs[ind_stop_target, ind_time_delta]
-                print '    inds_time_min,ind_time_arrive', inds_time_min[ind_stop_target], ind_time_arrive
+                print('    ind_target,n_searchint,ind_stop_target,ind_time_delta', ind_target, n_searchint, ind_target/n_searchint, ind_time_delta)
+                print('    ind_delta_depart,c_min', costs[ind_stop_target, ind_time_delta])
+                print('    inds_time_min,ind_time_arrive', inds_time_min[ind_stop_target], ind_time_arrive)
 
             id_stop_target = ids_stop_target[ind_stop_target][0]
             time_depart = process.simtime + ind_time_arrive * \
@@ -5493,7 +5493,7 @@ class VehicleMan(am.ArrayObjman):
                 self.numbers_veh_arr[id_stop_target] += 1
                 self.inflows_sched[id_stop_target, ind_time_arrive] += 1
             else:
-                print 'WARNING in push_empty_leadvehs: no vehicle prt.%d in stop %d' % (id_veh_lead, id_stop_target)
+                print('WARNING in push_empty_leadvehs: no vehicle prt.%d in stop %d' % (id_veh_lead, id_stop_target))
         return is_started
 
     def pull_empty_leadvehs(self, ids_veh_lead, process):
@@ -5507,7 +5507,7 @@ class VehicleMan(am.ArrayObjman):
         #                                & (stops.numbers_person_wait[self.ids_stop_current[ids_veh_lead]] == 0))
         vehicles = self.get_vehicles()
         stops = self.get_stops()
-        print 'pull_empty_leadvehs', ids_veh_lead
+        print('pull_empty_leadvehs', ids_veh_lead)
         # print '  bordingstate',vehicles.states[ids_veh_lead] == VEHICLESTATES['boarding']
         # print '  nowaits stop',stops.numbers_person_wait[self.ids_stop_current[ids_veh_lead]] ==0
 
@@ -5544,7 +5544,7 @@ class VehicleMan(am.ArrayObjman):
         ids_stop_target = self.ids_stop[inds_valid]
         demands = demands[inds_valid]
 
-        print '  ids_stop_current', ids_stop_current
+        print('  ids_stop_current', ids_stop_current)
         # print '  ids_stop_target',ids_stop_target
         # print '  demands',demands
         # calculate cost matrix with id_stop_current in rows and id_stop_target
@@ -5561,7 +5561,7 @@ class VehicleMan(am.ArrayObjman):
         costs = timeweight * demands
         for id_stop_target, demand, number_veh, number_veh_arr\
                 in zip(ids_stop_target, demands, stops.numbers_veh[ids_stop_target], self.numbers_veh_arr[ids_stop_target]):
-            print '    id_stop_target', id_stop_target, 'dem', demand, 'n_veh', number_veh, 'n_veh_arr', number_veh_arr
+            print('    id_stop_target', id_stop_target, 'dem', demand, 'n_veh', number_veh, 'n_veh_arr', number_veh_arr)
 
         #costs = np.zeros(costs.size, np.float32)-demands
 
@@ -5591,7 +5591,7 @@ class VehicleMan(am.ArrayObjman):
                     durations_est,
                 ):
 
-            print '    check veh prt.%d' % (id_veh_lead), state, 'id_stop_current', id_stop_current, 'id_stop_target', id_stop_target
+            print('    check veh prt.%d' % (id_veh_lead), state, 'id_stop_current', id_stop_current, 'id_stop_target', id_stop_target)
 
             #VEHICLESTATES = {'init':0,'waiting':1,'boarding':2,'alighting':3,'emptytrip':4,'occupiedtrip':5,'forewarding':6}
             # if state == VEHICLESTATES['occupiedtrip']:
@@ -5764,7 +5764,7 @@ class PrtService(SimobjMixin, DemandobjM
 
         Method used to sort trips when exporting to route or trip xml file
         """
-        print 'PRT.get_writexmlinfo'
+        print('PRT.get_writexmlinfo')
 
         # time of first PRT vehicle(s) to be inserted
         virtualpop = self.get_scenario().demand.virtualpop
@@ -5855,14 +5855,14 @@ class PrtService(SimobjMixin, DemandobjM
     #    self.make_times_stop_to_stop()
 
     def prepare_sim(self, process):
-        print 'prepare_sim', self.ident
+        print('prepare_sim', self.ident)
         # print '  self.times_stop_to_stop',self.times_stop_to_stop
 
         if self.fstar is None:
             self.make_fstar()
 
         if self.times_stop_to_stop is None:
-            print '  times_stop_to_stop'
+            print('  times_stop_to_stop')
             self.make_times_stop_to_stop()
 
         updatedata = self.prtvehicles.prepare_sim(process)
@@ -5892,7 +5892,7 @@ class PrtService(SimobjMixin, DemandobjM
         return route, duration
 
     def make_times_stop_to_stop(self, fstar=None, times=None):
-        print 'make_times_stop_to_stop'
+        print('make_times_stop_to_stop')
         log = self.get_logger()
         if fstar is None:
             if self.fstar is None:
@@ -5918,7 +5918,7 @@ class PrtService(SimobjMixin, DemandobjM
         for id_edge, id_stop, id_ptstop in zip(ids_edge, ids_prtstop, ids_ptstop):
             # print '  Found PRT stop %d, PT stop %d with id_edge %d '%(id_stop,id_ptstop, id_edge)
             if not fstar.has_key(id_edge):
-                print 'WARNING in make_times_stop_to_stop: PRT stop %d, PT stop %d has no id_edge %d in fstar' % (id_stop, id_ptstop, id_edge)
+                print('WARNING in make_times_stop_to_stop: PRT stop %d, PT stop %d has no id_edge %d in fstar' % (id_stop, id_ptstop, id_edge))
                 is_incomplete_fstar = True
 
         # check if fstar is complete (all to edges are in keys)
@@ -5928,9 +5928,9 @@ class PrtService(SimobjMixin, DemandobjM
             if not ids_fromedge_set.issuperset(fstar[id_fromedge]):
                 is_incomplete_fstar = True
                 ids_miss = fstar[id_fromedge].difference(ids_fromedge_set)
-                print 'WARNING in make_times_stop_to_stop: incomplete fstar of id_fromedge = %d, %s' % (id_fromedge, ids_sumo[id_fromedge])
+                print('WARNING in make_times_stop_to_stop: incomplete fstar of id_fromedge = %d, %s' % (id_fromedge, ids_sumo[id_fromedge]))
                 for id_edge in ids_miss:
-                    print '  missing', id_edge, ids_sumo[id_edge]
+                    print('  missing', id_edge, ids_sumo[id_edge])
 
         if is_incomplete_fstar:
             return
@@ -5977,7 +5977,7 @@ class PrtService(SimobjMixin, DemandobjM
                         stop_to_stop[ids_edge_to_ids_prtstop[id_edge],
                                      ids_edge_to_ids_prtstop[id_edge_target]] = costs[id_edge_target]
                     else:
-                        print 'WARNING in make_times_stop_to_stop: unreacle station id_fromedge = %d, %s' % (id_edge_target, ids_sumo[id_edge_target])
+                        print('WARNING in make_times_stop_to_stop: unreacle station id_fromedge = %d, %s' % (id_edge_target, ids_sumo[id_edge_target]))
                         is_incomplete_fstar = True
 
                 # put back origin to targets (probably not the best way)
@@ -5992,7 +5992,7 @@ class PrtService(SimobjMixin, DemandobjM
 
         self.times_stop_to_stop = stop_to_stop
         self.ids_edge_to_ids_prtstop = ids_edge_to_ids_prtstop
-        print '  times_stop_to_stop=\n', self.times_stop_to_stop
+        print('  times_stop_to_stop=\n', self.times_stop_to_stop)
         return True
 
     def get_fstar(self):
@@ -6000,7 +6000,7 @@ class PrtService(SimobjMixin, DemandobjM
         Returns the forward star graph of the network as dictionary:
             fstar[id_fromedge] = set([id_toedge1, id_toedge2,...])
         """
-        print 'get_fstar'
+        print('get_fstar')
         net = self.get_scenario().net
         # prt mode
         id_mode = self.id_prtmode
@@ -6087,7 +6087,7 @@ class PrtService(SimobjMixin, DemandobjM
         return times
 
     def config_results(self, results):
-        print 'PrtService.config_results', results, id(results)
+        print('PrtService.config_results', results, id(results))
         # keep a link to results here because needed to
         # log data during simulation
         # this link should not be followed during save process
@@ -6164,7 +6164,7 @@ class Stopresults(am.ArrayObjman):
         # return self.ids_stop.get_linktab()
 
     def init_recording(self, n_timesteps, time_step):
-        print 'init_recording n_timesteps, time_step', n_timesteps, time_step, len(self.ids_stop.get_linktab().get_ids())
+        print('init_recording n_timesteps, time_step', n_timesteps, time_step, len(self.ids_stop.get_linktab().get_ids()))
         self.clear()
 
         self.time_step.set_value(time_step)
--- a/tools/contributed/sumopy/plugins/prt/results_mpl.py
+++ b/tools/contributed/sumopy/plugins/prt/results_mpl.py
@@ -46,7 +46,7 @@ class StopresultsPlotter(Process):
         self._init_common('stopresultsplotter', parent=results, name=name,
                           info=info, logger=logger)
 
-        print 'StopresultsPlotter.__init__', results, self.parent, len(self.get_stopresults())
+        print('StopresultsPlotter.__init__', results, self.parent, len(self.get_stopresults()))
         attrsman = self.get_attrsman()
 
         stops = self.get_stopresults().get_prtstops()
@@ -134,10 +134,10 @@ class StopresultsPlotter(Process):
 
     def show(self):
         stopresults = self.get_stopresults()
-        print 'show', stopresults
+        print('show', stopresults)
         # print '  dir(vehicleman)',dir(vehicleman)
 
-        print '  len(stopresults)', len(stopresults)
+        print('  len(stopresults)', len(stopresults))
         if len(stopresults) > 0:
             i_fig = 0
             plt.close("all")
@@ -169,7 +169,7 @@ class StopresultsPlotter(Process):
             plt.show()
 
     def plot_flow_stop(self, fig):
-        print 'plot_flow_stop'
+        print('plot_flow_stop')
         id_stop = self.id_stop_plot
         stopresults = self.get_stopresults()
         ax = fig.add_subplot(111)
@@ -227,7 +227,7 @@ class StopresultsPlotter(Process):
         ax.tick_params(axis='y', labelsize=int(0.8*self.size_labelfont))
 
     def plot_waiting_person_time(self, fig):
-        print 'plot_waiting_person_time'
+        print('plot_waiting_person_time')
         stopresults = self.get_stopresults()
         ax = fig.add_subplot(111)
 
@@ -254,7 +254,7 @@ class StopresultsPlotter(Process):
         ax.tick_params(axis='y', labelsize=int(0.8*self.size_labelfont))
 
     def plot_waiting_person_number_stop(self, fig):
-        print 'plot_waiting_person_number_stop'
+        print('plot_waiting_person_number_stop')
         stopresults = self.get_stopresults()
         #ax1 = fig.add_subplot(211)
         #ax2 = fig.add_subplot(212)
@@ -278,7 +278,7 @@ class StopresultsPlotter(Process):
         ax.tick_params(axis='y', labelsize=int(0.8*self.size_labelfont))
 
     def plot_waiting_person_number(self, fig):
-        print 'plot_waiting_person_number'
+        print('plot_waiting_person_number')
         stopresults = self.get_stopresults()
         #ax1 = fig.add_subplot(211)
         #ax2 = fig.add_subplot(212)
@@ -291,7 +291,7 @@ class StopresultsPlotter(Process):
         # works:ax.plot(time.reshape(n_steps,1),numbers_person_wait.reshape(n_steps,-1))
         i = 0
         for id_stop in stopresults.ids_stop.get_value():
-            print '  id_stop', id_stop
+            print('  id_stop', id_stop)
             ax.plot(time, stopresults.numbers_person_wait[id_stop],
                     COLORS[i], linewidth=self.width_line,
                     label='PRT Stop ID=%d' % id_stop)
@@ -305,7 +305,7 @@ class StopresultsPlotter(Process):
         ax.tick_params(axis='y', labelsize=int(0.8*self.size_labelfont))
 
     def plot_flows_compare(self, fig):
-        print 'plot_flows_compare'
+        print('plot_flows_compare')
         stopresults = self.get_stopresults()
         #time_update_flows = self.parent.vehicleman.time_update_flows.get_value()
         time_update_flows = 10
@@ -318,7 +318,7 @@ class StopresultsPlotter(Process):
         i = 0
         flowmatrix = np.zeros((10, 10), dtype=np.int32)
         for id_stop in stopresults.ids_stop.get_value():
-            print '    id_stop', id_stop
+            print('    id_stop', id_stop)
             # print '      sched',stopresults.inflows_veh_sched[id_stop]
             # print '      eff  ',stopresults.inflows_veh[id_stop]
             flowmatrix[np.array(time_update_flows*stopresults.inflows_veh_sched[id_stop], dtype=np.int32),
@@ -328,7 +328,7 @@ class StopresultsPlotter(Process):
             #        label = 'PRT Stop ID=%d (effective)'%id_stop)
 
             i += 1
-        print 'flowmatrix', flowmatrix
+        print('flowmatrix', flowmatrix)
         # ax.matshow(flowmatrix)
 
         cax = ax.matshow(flowmatrix, cmap=cmx.get_cmap('PuBu'))
@@ -341,7 +341,7 @@ class StopresultsPlotter(Process):
         ax.tick_params(axis='y', labelsize=int(0.8*self.size_labelfont))
 
     def plot_flows_compare_stop(self, fig):
-        print 'plot_flows_compare_stop'
+        print('plot_flows_compare_stop')
         stopresults = self.get_stopresults()
         id_stop = self.id_stop_plot
         #time_update_flows = self.parent.vehicleman.time_update_flows.get_value()
@@ -361,7 +361,7 @@ class StopresultsPlotter(Process):
 
         time = np.arange(-n_steps+1, n_steps, dtype=np.float32)*t_step
 
-        print '    len(flowcorr),n_steps', len(flowcorr), len(time), n_steps
+        print('    len(flowcorr),n_steps', len(flowcorr), len(time), n_steps)
 
         ax.plot(time, flowcorr,
                 COLORS[i], linewidth=self.width_line,
@@ -375,7 +375,7 @@ class StopresultsPlotter(Process):
         ax.tick_params(axis='y', labelsize=int(0.8*self.size_labelfont))
 
     def plot_flows(self, fig):
-        print 'plot_flows'
+        print('plot_flows')
         stopresults = self.get_stopresults()
         ax = fig.add_subplot(111)
 
@@ -411,7 +411,7 @@ class StopresultsPlotter(Process):
         #        ('inflows_person', {'name':'Person in-flows', 'unit':'1/s', 'dtype':np.float32, 'info':'Person flow into the stop over time.'}),
 
     def plot_waiting_person(self, fig):
-        print 'plot_waiting_person'
+        print('plot_waiting_person')
         stopresults = self.get_stopresults()
         ax1 = fig.add_subplot(211)
         ax2 = fig.add_subplot(212)
--- a/tools/contributed/sumopy/plugins/prt/wxgui.py
+++ b/tools/contributed/sumopy/plugins/prt/wxgui.py
@@ -34,7 +34,7 @@ try:
     import results_mpl as results_mpl
     is_mpl = True  # we have matplotlib support
 except:
-    print "WARNING: python matplotlib package not installed, no matplotlib plots."
+    print("WARNING: python matplotlib package not installed, no matplotlib plots.")
     is_mpl = False
 
 
@@ -336,7 +336,7 @@ class WxGui(ModuleGui):
         dependent on the availability of data. 
         """
         scenario = self.get_scenario()
-        print 'prtgui.refresh_widgets', self._simulation != scenario.simulation
+        print('prtgui.refresh_widgets', self._simulation != scenario.simulation)
 
         is_refresh = False
         if self._simulation != scenario.simulation:
@@ -499,7 +499,7 @@ class WxGui(ModuleGui):
         self._mainframe.browse_obj(self._prtservice.prtvehicles)
 
     def on_mpl_stopresults(self, event=None):
-        print 'on_mpl_stopresults', id(self._simulation.results)  # ,id(self._prtservice.get_results())
+        print('on_mpl_stopresults', id(self._simulation.results))  # ,id(self._prtservice.get_results())
         if self._prtservice is not None:
             if self._simulation is not None:
                 resultplotter = results_mpl.StopresultsPlotter(self._simulation.results,  # self._prtservice.get_results(),