Skip to content

Commit a8052dd

Browse files
Renamed penalties
1 parent 19dc97d commit a8052dd

File tree

5 files changed

+75
-75
lines changed

5 files changed

+75
-75
lines changed

PARAMETERS.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ They are stored in file
3434
| droughts_rano_raraku | [[800, 1200], [1570, 1720]] | start and end years (A.D:) of droughts at Rano Raraku |
3535
| map_tree_pattern_condition | max_el: 450 | maximum elevation for trees in a cell |
3636
| | max_sl: 10 | maximum slope for trees in a cell |
37-
| | tree_decrease_lake_distance: 0 | decrease of tree density with area-weighted distance to freshwater lakes. (0 means uniform distribution, >0 clustered trees around the lakes) |
37+
| | tree_decrease_lake_distance: 0 | decrease of tree density with area-weighted distance to lakes. (0 means uniform distribution, >0 clustered trees around the lakes) |
3838

3939

4040
## Constant Parameters
@@ -79,13 +79,13 @@ increases with squared distance to a lake (divided by the lake area) | increases
7979

8080
Alpha
8181

82-
| Freshwater distance w | Geography g | Population Density pd | Availability of Trees tr | Availability of highly arable gardens cu |
82+
| Lake distance ld | Orography or | Population Density pd | Availability of Trees tr | Availability of highly arable gardens cu |
8383
|-----|-----|-----|-----|-----|
8484
| 0.2 | 0.2 | 0.2 | 0.2 | 0.2 |
8585

8686
#### Penalty thresholds for different location preferences and their evaluation variables
8787

88-
| w01 | w99 | el01 | el99 | sl01 | sl99 | pd01 | pd99 | tr01 | tr99 | cu01 | cu99 |
88+
| ld01 | ld99 | el01 | el99 | sl01 | sl99 | pd01 | pd99 | tr01 | tr99 | cu01 | cu99 |
8989
|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|
9090
| 2.8 (a) | 275.4 (b) | 0 | 300 | 0 | 7.5 | 0 | 300 | 0 | (c) | 0 | (d) |
9191

agents.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ def calc_penalty(self, triangle_inds):
279279
280280
Idea and Assumptions
281281
====================
282-
- Agents prefer a certain geography (low altitude and low slope), proximity to freshwater lakes
282+
- Agents prefer a certain orography (low altitude and low slope), proximity to lakes
283283
(weighted by the area), low population density, as well as large numbers of trees within r_t distance
284284
and high availability of arable (in particular, well-suited) potential gardens within r_c distance.
285285
- The penalties, P_{cat}(c), depend logistically on correlated, underlying geographic condition variables
@@ -292,31 +292,31 @@ def calc_penalty(self, triangle_inds):
292292
$$ P_{tot}(c) = sum_{cat} alpha_{cat}^{i} * P_{cat}(c) $$
293293
- The relative weights for cultivation, alpha_cult, and tree, alpha_tree, in the equation above vary for
294294
each agent as we additionally scale them with their current tree preference (and then re-normalise).
295-
-The other weights (for geography, freshwater proximity, and population density) remain const for all
295+
-The other weights (for orography, lake distance, and population density) remain const for all
296296
agents.
297297
298298
More detailed calculation
299299
=========================
300300
The total penalty for a cell is calculated as
301301
$$ P_{tot}^{i}(c) = sum {cat} alpha_{cat}^{i} * P_{cat} $$
302302
where cat represents the categories used for the elevation of a cell:
303-
- "w" for area weighted proximity for freshwater,
304-
- "g" for geography (including elevation and slope)
303+
- "ld" for area weighted distance to lakes,
304+
- "or" for orography (including elevation and slope)
305305
- "pd" for population density,
306306
- "tr" for tree availability,
307307
- "cu" for availability of well-suited and total gardens,
308308
The weights alpha are explained in the following:
309-
- alpha_w, alpha_pd and alpha_g are constant weights
309+
- alpha_ld, alpha_pd and alpha_or are constant weights
310310
- alpha_tr and alpha_cu are multiplied by the agent's tree preference and then normalised such that sum of
311311
all alpha_cat is 1
312312
The penalties P_cat(c) is assigned for a certain category given the value of the evaluation criteria in the
313313
specific cell $c$:
314314
- The penalty grows logistically with $x$
315315
$$ P_{cat}(c) = \frac{1}{1+exp[-k_x * (x(c) - x_{0.5})]} $$
316316
- Here x(c) is the value of an evaluation criteria for cell c in the specific category cat:
317-
- for "g":
318-
P_g= 0.5 * (P_{el} + P_{sl}) with x(c)=el(c) and x(c) = sl(c)
319-
- for "w":
317+
- for "or":
318+
P_or= 0.5 * (P_{el} + P_{sl}) with x(c)=el(c) and x(c) = sl(c)
319+
- for "ld":
320320
x(c) = min_{lake} [ d_{lake}^2 / A_{lake} ],
321321
where d_{lake} ist the distance and A_{lake} is the area of lakes Raraku, Kau, Aroi
322322
- for "pd":
@@ -359,7 +359,7 @@ def calc_penalty(self, triangle_inds):
359359
p_tot : array of floats between 0 and 1
360360
the weighted sum of all penalty(-ies) for the corresponding cells
361361
p_cat : list of arrays of floats between 0 and 1
362-
the penalty(-ies) for the corresponding cells in each category (w, g, tr, f, pd)
362+
the penalty(-ies) for the corresponding cells in each category (ld, or, tr, f, pd)
363363
"""
364364
if self.m.gamma == 0:
365365
# Do not need to calculate the penalties, because they are not taken into account
@@ -372,8 +372,8 @@ def calc_penalty(self, triangle_inds):
372372

373373
# == Calculate each categories penalty ==
374374

375-
# === Map/Geography Penalty ===
376-
p_g = self.m.map.penalty_g[triangle_inds]
375+
# === Map/Orography Penalty ===
376+
p_or = self.m.map.penalty_or[triangle_inds]
377377

378378
# === Tree Penalty ===
379379
tr = np.dot(self.m.map.trees_map, circ_inds_trees_arr)
@@ -385,8 +385,8 @@ def calc_penalty(self, triangle_inds):
385385
(np.sum(circ_inds_cultivation_arr, axis=0) * self.m.map.triangle_area_m2 * 1e-6)
386386
p_pd = self.m.P_cat(pd, "pd")
387387

388-
# === Freshwater Penalty ===
389-
p_w = self.m.map.penalty_w[triangle_inds]
388+
# === Lake distance Penalty ===
389+
p_ld = self.m.map.penalty_ld[triangle_inds]
390390

391391
# === Agriculture Penalty ===
392392
# for poorly and well suited cells
@@ -411,13 +411,13 @@ def calc_penalty(self, triangle_inds):
411411
alpha_cu = self.m.alpha["cu"] * (1 - self.t_pref) / eta
412412

413413
# linear combination of all weighted penalties for all cells of triangle_inds
414-
p_tot = (self.m.alpha["w"] * p_w +
414+
p_tot = (self.m.alpha["ld"] * p_ld +
415415
alpha_tr * p_tr +
416416
self.m.alpha["pd"] * p_pd +
417417
alpha_cu * p_cu +
418-
self.m.alpha["g"] * p_g
418+
self.m.alpha["or"] * p_or
419419
)
420-
p_cat = [p_w, p_g, p_tr, p_cu, p_pd]
420+
p_cat = [p_ld, p_or, p_tr, p_cu, p_pd]
421421
return p_tot, p_cat
422422

423423
def move(self, within_inds):
@@ -437,8 +437,8 @@ def move(self, within_inds):
437437
Instead it is a process e.g. limited by uncertainty and lack of knowledge and thus based on heuristics rather
438438
than computation.
439439
The probabilities depend on a penalty evaluation described in detail in process calc_penalty.
440-
In a nutshell, we assume that agents prefer a certain geography (low altitude and low slope), proximity to
441-
freshwater lakes, low population density, as well as large numbers of trees and high availability of arable
440+
In a nutshell, we assume that agents prefer a certain orography (low altitude and low slope), proximity to
441+
lakes, low population density, as well as large numbers of trees and high availability of arable
442442
(in particular, well-suited) potential gardens in the local surrounding.
443443
Note that these preferences, are not related to the agent survival or its resource harvest.
444444
For each of these categories (cat) the agent defines a categorical penalty, P_{cat}(c), and evaluates all cells
@@ -471,7 +471,7 @@ def move(self, within_inds):
471471
self.arability_cultivated_gardens = np.array([])
472472

473473
# === Penalty Evaluation ===
474-
# local penalties could be used for plotting, see below: _ = [p_w, p_g, p_tr, p_cu, p_pd]
474+
# local penalties could be used for plotting, see below: _ = [p_ld, p_or, p_tr, p_cu, p_pd]
475475
p_tot, _ = self.calc_penalty(within_inds)
476476

477477
# === Probabilities ===

0 commit comments

Comments
 (0)