Single City Model
This page describes the how to use the single city model, what we call a Region
.
Parameter and Region
Setup
The first step is to obtain a Param
type, like so:
using LandUse
using NNlib, Flux
p = LandUse.Param()
p
LandUse Param:
γ : 0.3017057
ϵr : 5.0
ϵs : 2.0
η : 0.0
ν : 0.029633
cbar : 0.7368016
sbar : 0.2106496
θr : 1.0
θu : 1.0
α : 0.75
λ : 0.0
a : 2.2491673
L : 1.0
S : 1.0
T : 1840:10:2020
t : 1815
σ : 0.9999
K : 1
and then we create a Region
:
m = LandUse.Region(p)
typeof(m)
LandUse.Region
Running a model refers to computing the solution to the equation system defined in the jm
function via JuMP.jl at all periods:
LandUse.jm
— Functionsolve model at current Param
p
and starting at point x0
Keyword:
estimateθ
: whether the sequence of $\theta_u$ should be a choice variable or not. defaultfalse
.
We compute a starting value $x_0$, and then supply the period $t$ solution vector as starting value to the period $t+1$ problem. We obtain this model run via
x,M,p = LandUse.run(p) # solution vectors, Region in each period, Param
M
19-element Vector{LandUse.Region}:
Region: θu=01.000, θr=01.000, ϕ=0.0305, cityarea=0.0029, rel_cityarea=0.00, area=1.00, Lu=0.297, Lr=0.703, pop=1.000, pr=0.839
Region: θu=00.940, θr=01.097, ϕ=0.0365, cityarea=0.0042, rel_cityarea=0.00, area=1.00, Lu=0.379, Lr=0.671, pop=1.050, pr=0.671
Region: θu=00.962, θr=01.234, ϕ=0.0433, cityarea=0.0059, rel_cityarea=0.01, area=1.00, Lu=0.478, Lr=0.611, pop=1.089, pr=0.566
Region: θu=01.199, θr=01.330, ϕ=0.0476, cityarea=0.0071, rel_cityarea=0.01, area=1.00, Lu=0.525, Lr=0.537, pop=1.062, pr=0.635
Region: θu=01.284, θr=01.328, ϕ=0.0468, cityarea=0.0069, rel_cityarea=0.01, area=1.00, Lu=0.549, Lr=0.585, pop=1.134, pr=0.708
Region: θu=01.400, θr=01.426, ϕ=0.0509, cityarea=0.0081, rel_cityarea=0.01, area=1.00, Lu=0.607, Lr=0.551, pop=1.158, pr=0.697
Region: θu=01.580, θr=01.618, ϕ=0.0581, cityarea=0.0106, rel_cityarea=0.01, area=1.00, Lu=0.694, Lr=0.483, pop=1.177, pr=0.652
Region: θu=01.770, θr=01.653, ϕ=0.0598, cityarea=0.0112, rel_cityarea=0.01, area=1.00, Lu=0.719, Lr=0.481, pop=1.200, pr=0.721
Region: θu=01.876, θr=01.619, ϕ=0.0595, cityarea=0.0111, rel_cityarea=0.01, area=1.00, Lu=0.685, Lr=0.467, pop=1.151, pr=0.783
Region: θu=02.437, θr=02.036, ϕ=0.0736, cityarea=0.0170, rel_cityarea=0.02, area=1.00, Lu=0.834, Lr=0.380, pop=1.214, pr=0.743
Region: θu=02.937, θr=02.347, ϕ=0.0833, cityarea=0.0218, rel_cityarea=0.02, area=1.00, Lu=0.889, Lr=0.319, pop=1.208, pr=0.734
Region: θu=03.177, θr=02.731, ϕ=0.0914, cityarea=0.0262, rel_cityarea=0.03, area=1.00, Lu=0.952, Lr=0.274, pop=1.226, pr=0.642
Region: θu=04.607, θr=04.182, ϕ=0.1169, cityarea=0.0430, rel_cityarea=0.04, area=1.00, Lu=1.159, Lr=0.196, pop=1.355, pr=0.542
Region: θu=07.228, θr=07.251, ϕ=0.1512, cityarea=0.0718, rel_cityarea=0.08, area=1.00, Lu=1.377, Lr=0.132, pop=1.509, pr=0.437
Region: θu=09.586, θr=09.454, ϕ=0.1722, cityarea=0.0931, rel_cityarea=0.10, area=1.00, Lu=1.494, Lr=0.115, pop=1.609, pr=0.431
Region: θu=11.423, θr=14.875, ϕ=0.1928, cityarea=0.1167, rel_cityarea=0.13, area=1.00, Lu=1.607, Lr=0.089, pop=1.696, pr=0.303
Region: θu=13.133, θr=21.842, ϕ=0.2087, cityarea=0.1368, rel_cityarea=0.16, area=1.00, Lu=1.694, Lr=0.076, pop=1.770, pr=0.228
Region: θu=14.507, θr=24.127, ϕ=0.2173, cityarea=0.1483, rel_cityarea=0.17, area=1.00, Lu=1.810, Lr=0.078, pop=1.888, pr=0.230
Region: θu=16.025, θr=26.651, ϕ=0.2260, cityarea=0.1604, rel_cityarea=0.19, area=1.00, Lu=1.889, Lr=0.078, pop=1.967, pr=0.232
And you can just index the M
vector to look at a certain period in detail:
M[4]
Single Region:
pop : 1.0617217051298398
Lr : 0.5371196295702115
Lu : 0.5246020755596282
area : 1.0
θu : 1.1989433367508264
θr : 1.3296906559188277
ϕ : 0.04759400261942313
cityarea : 0.007116301389488562
rel_cityarea : 0.007167306099845785
Sr : 0.8772096995245554
Srh : 0.115673999085956
ρr : 0.1461571706451302
qr : 0.9783522082603613
wu0 : 1.1989433367508264
wr : 0.7161353105564563
r : 0.16721119245481
pr : 0.6352150235943144
xsr : 0.6259686572829377
U : 0.3141258037344255
Change Parameter Values
The constructor to the Param
type accepts a keyword par
which has to be dict. You can change the default values by using the appropriate key => value
pairs:
p2 = LandUse.Param(par = Dict(:α => 0.5))
p2.α
0.5