@@ -16,8 +16,8 @@ param, graph = create_graph(param, w, h, type = "map")
1616# ----------------
1717# Draw populations
1818
19- param[:Zjn ] = ones (param[:J ], 1 ) .* 1e-3 # matrix of productivity (not 0 to avoid numerical glitches)
20- param[:Lj ] = ones (param[:J ]) .* 1e-3 # matrix of population
19+ param[:Zjn ] = ones (param[:J ], 1 ) .* 1e-6 # matrix of productivity (not 0 to avoid numerical glitches)
20+ param[:Lj ] = ones (param[:J ]) .* 1e-6 # matrix of population
2121
2222Ni = find_node (graph, ceil (w/ 2 ), ceil (h/ 2 )) # center
2323param[:Zjn ][Ni] = 1 # more productive node
@@ -29,15 +29,15 @@ for i in 1:ncities-1
2929 newdraw = false
3030 while newdraw == false
3131 j = round (Int, 1 + rand () * (param[:J ] - 1 ))
32- if param[:Lj ][j] <= 1e-3
32+ if param[:Lj ][j] <= 1e-6
3333 newdraw = true
3434 param[:Lj ][j] = 1
3535 end
3636 end
3737end
3838
3939param[:hj ] = param[:Hj ] ./ param[:Lj ]
40- param[:hj ][param[:Lj ] .== 1e-3 ] .= 1 # catch errors in places with infinite housing per capita
40+ param[:hj ][param[:Lj ] .== 1e-6 ] .= 1 # catch errors in places with infinite housing per capita
4141
4242
4343# --------------
@@ -68,6 +68,14 @@ geography = (z = z, obstacles = obstacles)
6868# to changes in elevation in building costs (symmetric up/down)
6969graph = apply_geography (graph, geography, alpha_up_i = 10 , alpha_down_i = 10 )
7070
71+ # Plot endowments
72+ plot_graph (graph, aspect_ratio = 3 / 4 ,
73+ geography = geography, obstacles = true ,
74+ mesh = true , mesh_transparency = 0.2 ,
75+ node_sizes = param[:Lj ], node_shades = param[:Zjn ],
76+ node_color = :seismic ,
77+ edge_min_thickness = 1 , edge_max_thickness = 4 )
78+
7179# =======================
7280# COMPUTE OPTIMAL NETWORK
7381# =======================
@@ -78,24 +86,22 @@ graph = apply_geography(graph, geography, alpha_up_i = 10, alpha_down_i = 10)
7886# PLOT RESULTS
7987# ============
8088
81- sizes = 2 .* results[:cj ] .* (param[:Lj ] .> 1e-3 ) / maximum (results[:cj ])
82- shades = results[:cj ] .* (param[:Lj ] .> 1e-3 ) / maximum (results[:cj ])
89+ sizes = 2 .* results[:cj ] .* (param[:Lj ] .> 1e-6 ) / maximum (results[:cj ])
90+ shades = results[:cj ] .* (param[:Lj ] .> 1e-6 ) / maximum (results[:cj ])
8391
84- plot_graph (graph, results[:Ijk ],
92+ plot_graph (graph, results[:Ijk ], aspect_ratio = 3 / 4 ,
8593 geography = geography, obstacles = true ,
8694 mesh = true , mesh_transparency = 0.2 ,
8795 node_sizes = sizes, node_shades = shades,
8896 edge_min_thickness = 1 , edge_max_thickness = 4 )
8997
9098
91- # sizes = param[:Lj] .+ 1
92- # shades = param[:Zjn]
93-
94- # plot_graph(graph, # results[:Ijk], edges = false,
95- # geography = geography, obstacles = true,
96- # mesh = true, mesh_transparency = 0.2,
97- # node_sizes = sizes, node_shades = shades,
98- # node_color = :seismic,
99- # edge_min_thickness = 1, edge_max_thickness = 4)
100-
101-
99+
100+ sizes = 2 .* results[:river ][:cj ] .* (param[:Lj ] .> 1e-6 ) / maximum (results[:river ][:cj ])
101+ shades = results[:river ][:cj ] .* (param[:Lj ] .> 1e-6 ) / maximum (results[:river ][:cj ])
102+
103+ plot_graph (graph, results[:river ][:Ijk ], aspect_ratio = 3 / 4 ,
104+ geography = geographies[:river ], obstacles = true ,
105+ mesh = true , mesh_transparency = 0.2 ,
106+ node_sizes = sizes, node_shades = shades,
107+ edge_min_thickness = 1 , edge_max_thickness = 4 )
0 commit comments