diff --git a/.github/ISSUE_TEMPLATE/documentation.md b/.github/ISSUE_TEMPLATE/documentation.md index 2074049..a47336a 100644 --- a/.github/ISSUE_TEMPLATE/documentation.md +++ b/.github/ISSUE_TEMPLATE/documentation.md @@ -19,9 +19,10 @@ missing, unclear, or inconsistent with the actual code/data? --> - [ ] Add/update docstrings in `path/to/module.py` - [ ] Write or refine a documentation page in `docs/` - [ ] Update code examples in `examples/` to reflect current API behavior -- [ ] Update provenance notes in `benchmark/reference/README.md` or +- [ ] Update provenance notes in `benchmark/README.md` or `docs/validation.md` ### References & Context - + diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b4f395..2bb84e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,35 @@ All notable changes to `disslucc` are documented here. -## [0.3.0] -- unreleased +## [0.4.0] -- 2026-09-23 + +Reference results now come from +[LambdaGeo/terrame-docker](https://github.com/LambdaGeo/terrame-docker) v0.1.0, +and both allocations are validated year by year, iteration counts included. + +### Added +- `benchmark/goldens/`: year-by-year TerraME reference results (every cell, + every year, `_out` and `_pot`, iteration counts) for `lab01`, + `lab01_md1643`, `lab15` and `lab15_md10`, copied from terrame-docker v0.1.0 + (which has all 21 LuccME labs), and `tests/test_goldens_per_year.py`, which + checks iterations and every class year by year. +- `AllocationClueLike(cell_correction=True)`: `False` skips + `_correct_cell_change` and reproduces TerraME, whose `correctCellChange` + never runs (a `regionregionAloc` typo). The default is unchanged. +- `iterations_per_step` on `AllocationClueLike` and `AllocationDClueSLike`. + +### Changed +- `docs/validation.md`: the Lab1 MAE (0.0036) is explained by the cell + correction TerraME skips, not by the `maxDifference` tolerance; new + "Year by year" section. The numbers themselves are unchanged. + +### Removed +- `benchmark/reference/*.lua` and `benchmark/data/*.zip`, now kept in + terrame-docker (`benchmark/references/`). Tests and examples read the last + year of `benchmark/goldens/lab01_md1643` and `lab15_md10`, which hold the + same values. + +## [0.3.0] -- 2026-09-22 First version meant to be independently citable and reproducible without `disslucc-continuous` or `disslucc-discrete` cloned alongside diff --git a/CITATION.cff b/CITATION.cff index fd91e8b..8b8550a 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -11,8 +11,8 @@ authors: given-names: "Sérgio" orcid: "https://orcid.org/0000-0002-0232-4549" affiliation: "Universidade Federal do Maranhão (UFMA)" -version: 0.3.0 -date-released: "2026-09-22" +version: 0.4.0 +date-released: "2026-09-23" license: MIT repository-code: "https://github.com/LambdaGeo/disslucc" keywords: diff --git a/CLAUDE.md b/CLAUDE.md index 9a95028..fca2743 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -29,8 +29,7 @@ src/disslucc/ validation/ # continuous/discrete; potential + allocation are not executors/ # ModelExecutor (base.py, continuous.py, discrete.py) data/input/ # vendored real input data (shapefiles + demand CSVs) -benchmark/data/ # vendored TerraME *reference outputs* (expected results) -benchmark/reference/ # vendored original LuccME .lua *scripts* (provenance) + README.md +benchmark/goldens/ # TerraME reference results, year by year (copy from LambdaGeo/terrame-docker) examples/ # runnable scripts: synthetic, real data, via Executor tests/ # pytest -- validation (exact numbers) + discriminance (does the # benchmark actually constrain the implementation?) @@ -56,14 +55,18 @@ scripts, then three more `examples/*.py` files found later) -- grep for `/home/`, `/tmp/` before assuming a script is portable. **Data provenance is not "whatever GitHub script has a matching name."** -`terrame/luccme`'s public `tests/functional/lab01.lua` and `lab15.lua` -share calibrated coefficients and demand trajectories with the scripts -that actually generated this repo's reference data, but declare -different `maxDifference` values (5000 and 300, vs. the 1643 and 10 -actually used) and did **not** generate `benchmark/data/`'s zips. The -real generating scripts are vendored, unmodified, at -`benchmark/reference/` -- **read `benchmark/reference/README.md` before -citing or changing any `max_difference`/`maxDifference` value.** +The reference results live in `benchmark/goldens/`, a copy of the goldens +generated in [LambdaGeo/terrame-docker](https://github.com/LambdaGeo/terrame-docker) +v0.1.0, which keeps the generating scripts, the original TerraME outputs, the +generator and goldens for all 21 LuccME labs. This repository keeps only the +goldens its tests use (`lab01`, `lab15`: the LuccME package's labs; +`lab01_md1643`, `lab15_md10`); add one together with the component and test +that need it, never ahead of time. `lab01_md1643` and `lab15_md10` are the scenarios behind `docs/validation.md` +(same coefficients and demand as `lab01`/`lab15`, but `maxDifference` 1643 +and 10 instead of 5000 and 300). **Read terrame-docker's +`benchmark/references/README.md` before citing or changing any +`max_difference`/`maxDifference` value.** Never edit a golden by hand -- +regenerate it there and copy it (see `benchmark/README.md`). A empirical validation number that stops matching (e.g. MAE jumping from 0.0036 to above 0.01) is stronger evidence of a wrong parameter than a GitHub script that merely looks similar. @@ -78,10 +81,15 @@ PR/commit and say so explicitly -- don't let it drift silently. ```bash python -m venv venv && source venv/bin/activate pip install -e ".[examples,dev]" -pytest tests/ -v # expect: 14 passed, 2 xfailed +pytest tests/ -v # expect: 19 passed, 2 xfailed mypy src/disslucc # expect: clean ``` +`AllocationClueLike(cell_correction=True)` (the default) deliberately differs +from TerraME: LuccME's `correctCellChange` never runs (a `regionregionAloc` +typo). Tests that compare against the continuous goldens use +`cell_correction=False`; don't "fix" the default to make them pass. + The 2 `xfail`s in `tests/test_benchmark_discriminance_lab15.py` are intentional and documented (the Lab15 scenario is near-non-discriminative by design -- a trivial static ranking reproduces the same output). Don't @@ -90,7 +98,8 @@ dynamic-covariate scenario (see `docs/decisions.md`). Before changing a `max_difference`/convergence value, a demand table, or a regression coefficient anywhere in `src/`, `tests/_lab*_helpers.py`, or -`examples/`: check `benchmark/reference/` first. If the change isn't +`examples/`: check the golden's `manifest.json` and the scripts in +terrame-docker's `benchmark/references/` first. If the change isn't traceable to those `.lua` files, it's very likely wrong even if it looks locally reasonable. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 876258e..9ed07cb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -112,19 +112,21 @@ number change unexpectedly, treat it as a regression until proven otherwise. Two things make this package different from a typical model port, and both have their own conventions: -- **Vendored input/reference data** (`data/input/`, `benchmark/data/`) is - real data from `disslucc-continuous`/`disslucc-discrete`, not synthetic. - Don't regenerate or "clean up" these files without understanding - `docs/validation.md` first -- the numbers they produce are cited in - `dissmodel`'s JOSS paper. -- **Provenance scripts** (`benchmark/reference/*.lua`) are the actual - original LuccME "Model Configurator" scripts that generated the reference - data, kept unmodified. If you're unsure whether a script on - `terrame/luccme`'s GitHub is "the" source for a scenario here, check - `benchmark/reference/README.md` first -- coefficients/demand matching is - not sufficient evidence, since TerraME's own public test suite contains - look-alike scenarios with different convergence parameters that did not - generate this repository's data. +- **Vendored input data** (`data/input/`) is real data from + `disslucc-continuous`/`disslucc-discrete`, not synthetic. Don't regenerate + or "clean up" these files without understanding `docs/validation.md` first + -- the numbers they produce are cited in `dissmodel`'s JOSS paper. +- **Reference results** (`benchmark/goldens/`) are a copy of the goldens this + repository's tests use, generated in [LambdaGeo/terrame-docker](https://github.com/LambdaGeo/terrame-docker) + v0.1.0 (which has goldens for all 21 LuccME labs; copy one here only with + the component and test that use it), + which also keeps the original LuccME "Model Configurator" scripts, the + original TerraME outputs and the generator. Never edit a golden by hand: + regenerate it there and copy the folder (see `benchmark/README.md`). If + you're unsure which script is "the" source for a scenario, check + terrame-docker's `benchmark/references/README.md` -- coefficients/demand + matching is not sufficient evidence, since TerraME's own public test suite + contains look-alike scenarios with different convergence parameters. If your change affects a Lab1 or Lab15 validation number, update `docs/validation.md` in the same PR and say so explicitly in the PR diff --git a/README.md b/README.md index ad249d5..a485137 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,11 @@ the original TerraME reference on real data for both: Lab1 (continuous) within the official 0.01 MAE tolerance, Lab15 (discrete) at exact, 100% cell-by-cell agreement — see [`docs/validation.md`](docs/validation.md) for both results and what -each one does and doesn't prove. +each one does and doesn't prove. Both are also checked year by year, +iteration counts included, against the goldens of +[LambdaGeo/terrame-docker](https://github.com/LambdaGeo/terrame-docker) +(`benchmark/goldens/`), which cover the 21 labs of the LuccME package; this +repository keeps the ones its tests use. ## Migration status: becoming the single successor repository @@ -147,8 +151,7 @@ disslucc/ ├── examples/ # ready-made scripts, synthetic, real data, and via Executor ├── data/input/ # vendored Lab1 + Lab15 input shapefiles and demand CSVs ├── benchmark/ -│ ├── data/ # vendored TerraME reference outputs (Lab1, Lab15) -│ └── reference/ # vendored original LuccME .lua scripts (provenance) +│ └── goldens/ # TerraME reference results, year by year (from LambdaGeo/terrame-docker) ├── tests/ # pytest suite -- validation + discriminance, run by CI └── docs/ ``` diff --git a/benchmark/README.md b/benchmark/README.md new file mode 100644 index 0000000..d09b9d8 --- /dev/null +++ b/benchmark/README.md @@ -0,0 +1,52 @@ +# Goldens do TerraME/LuccME + +`goldens/` é uma cópia dos goldens gerados em +[LambdaGeo/terrame-docker](https://github.com/LambdaGeo/terrame-docker) +**v0.1.0** (`benchmark/goldens/`), com TerraME 2.0.1 + LuccME `6244dd4`. É contra eles que o +disslucc é validado, algoritmo por algoritmo. + +Scripts, saídas originais do TerraME e o gerador ficam **só** no terrame-docker; aqui +fica só o resultado, para os testes rodarem sem Docker. + +## O que há em `goldens//` + +| Arquivo | Conteúdo | +|---|---| +| `.csv.gz` | estado de cada célula ao fim de cada ano: `year,id,col,row`, `_out` e `_pot`, 12 casas decimais | +| `terrame.log` | saída do TerraME (demanda, área alocada, iterações por ano) | +| `manifest.json` | script de origem e SHA-256, versões, anos, colunas, iterações por ano (`iterations_per_year`) e a verificação cruzada | + +`col`/`row` alinham com `data/input/csAC.zip` (`col`, `row`) e `cs_moju.zip` (`col`, `lin`). + +## Quais são + +Só os goldens que os testes deste repositório usam. Os outros (os 21 labs do pacote +LuccME) ficam no terrame-docker e entram aqui quando o componente correspondente for +implementado, junto com o teste que os usa. + +| Golden | Componentes | Usado em | +|---|---|---| +| `lab01` | PreComputedValues + CLinearRegression + CClueLike (`maxDifference` 5000) | `test_goldens_per_year.py` | +| `lab01_md1643` | idem, `maxDifference` 1643: itera 8–26 vezes por ano | `test_goldens_per_year.py`, `test_validation_lab1.py`, discriminância | +| `lab15` | PreComputedValues + DLogisticRegression + DClueSLike (`maxDifference` 300) | `test_goldens_per_year.py` | +| `lab15_md10` | idem, `maxDifference` 10: itera 56–67 vezes por ano | `test_goldens_per_year.py`, `test_validation_lab15.py`, discriminância | + +O último ano de `lab01_md1643` e de `lab15_md10` é a antiga referência deste repositório +(`benchmark/data/*.zip`). + +## Antes de usar como prova + +- Nos labs do pacote a alocação aceita a primeira passada em todos os anos; só as + variantes `_md` testam o laço de convergência. +- Nos labs com `CClueLike`, o TerraME nunca executa `correctCellChange` (typo + `regionregionAloc`). O disslucc executa por padrão; compare com + `cell_correction=False`. Ver `docs/validation.md`. +- Compare com tolerância (1e-9 no arquivo; os testes usam MAE < 1e-6), nunca pelo + SHA-256: de uma geração para outra, algumas células mudam na 12ª casa decimal. + +## Adicionar ou atualizar + +Copie a pasta do golden de `benchmark/goldens//` do terrame-docker, na mesma versão +(`v0.1.0`), para `benchmark/goldens//` aqui, no mesmo commit do teste que passa a +usá-lo. Nunca edite um golden à mão; para regenerar, use `benchmark/generate.sh ` +no terrame-docker. diff --git a/benchmark/data/LUCCME_Lab1_2014.zip b/benchmark/data/LUCCME_Lab1_2014.zip deleted file mode 100644 index 79a6883..0000000 Binary files a/benchmark/data/LUCCME_Lab1_2014.zip and /dev/null differ diff --git a/benchmark/data/Lab15_2004.zip b/benchmark/data/Lab15_2004.zip deleted file mode 100644 index 0202577..0000000 Binary files a/benchmark/data/Lab15_2004.zip and /dev/null differ diff --git a/benchmark/goldens/lab01/lab01.csv.gz b/benchmark/goldens/lab01/lab01.csv.gz new file mode 100644 index 0000000..65a82d2 Binary files /dev/null and b/benchmark/goldens/lab01/lab01.csv.gz differ diff --git a/benchmark/goldens/lab01/manifest.json b/benchmark/goldens/lab01/manifest.json new file mode 100644 index 0000000..fa91aea --- /dev/null +++ b/benchmark/goldens/lab01/manifest.json @@ -0,0 +1,53 @@ +{ + "lab": "lab01", + "source": { + "script": "luccme/tests/functional/lab01.lua", + "sha256": "d8e16d718c3654b0d7f89d743413f3ee781d6fb05574231fb843af895c238dfa" + }, + "engine": { + "image": "terrame-luccme", + "terrame": "2.0.1", + "terralib": "5.5.1", + "luccme_commit": "6244dd461f94259efb6e1d2170d32fc7e28c033c" + }, + "generator": { + "script": "benchmark/harness.lua", + "sha256": "be7c575428c574da799f7f745da7766a05f6b878df08b12bcd0bab882e346581" + }, + "status": "ok", + "years": [ + 2008, + 2014 + ], + "n_cells": 6574, + "columns": [ + "f_out", + "d_out", + "outros_out", + "f_pot", + "d_pot", + "outros_pot" + ], + "file": { + "name": "lab01.csv.gz", + "rows": 46018, + "sha256": "c773f4b295c8c980898b320a460d29fedd1118260d1e7eacd7c7fc8cd51e59ed" + }, + "crosscheck_vs_original_output": { + "tolerance": 1e-09, + "max_abs_diff": { + "Lab01_2014.dbf:d_out": 5.000028169277471e-13 + }, + "note": "último ano do CSV comparado com os .dbf da pasta de saída: a saída do próprio script e, nas referências, a saída original do TerraME" + }, + "iterations_per_year": { + "2008": 0, + "2009": 0, + "2010": 0, + "2011": 0, + "2012": 0, + "2013": 0, + "2014": 0 + }, + "iterations_note": "contínuo: 'Number of iterations' do LuccME; discreto: maior n de 'Iteration -> n' (0 = aceito na 1ª passada)" +} diff --git a/benchmark/goldens/lab01/terrame.log b/benchmark/goldens/lab01/terrame.log new file mode 100644 index 0000000..cfe123d --- /dev/null +++ b/benchmark/goldens/lab01/terrame.log @@ -0,0 +1,90 @@ + +Verifying Model parameters +Verifying Demand parameters +Verifying Potential parameters +Verifying Allocation parameters + +Executing Demand component +Executing Potential component +Executing Allocation component + +Year: 2008 Step: 0 +f Area: 137878 Difference: 0 +d Area: 19982 Difference: 0 +outros Area: 6489 Difference: 0 + +Demand allocated correctly in 2008. Number of iterations: 0 Maximum error: 2.7950358344242e-05 +[harness] lab01: Lab01, anos 2008..2014, colunas f_out,d_out,outros_out,f_pot,d_pot,outros_pot + +Executing Demand component +Executing Potential component +Executing Allocation component + +Year: 2009 Step: 0 +f Area: 136483 Difference: -1139 +d Area: 20953 Difference: 714 +outros Area: 6489 Difference: 0 + +Demand allocated correctly in 2009. Number of iterations: 0 Maximum error: 1138.4125251856 + +Executing Demand component +Executing Potential component +Executing Allocation component + +Year: 2010 Step: 0 +f Area: 135609 Difference: -1757 +d Area: 21826 Difference: 1331 +outros Area: 6489 Difference: 0 + +Demand allocated correctly in 2010. Number of iterations: 0 Maximum error: 1756.4683416836 + +Executing Demand component +Executing Potential component +Executing Allocation component + +Year: 2011 Step: 0 +f Area: 134822 Difference: -2288 +d Area: 22612 Difference: 1862 +outros Area: 6489 Difference: 0 + +Demand allocated correctly in 2011. Number of iterations: 0 Maximum error: 2287.3741648977 + +Executing Demand component +Executing Potential component +Executing Allocation component + +Year: 2012 Step: 0 +f Area: 134114 Difference: -2711 +d Area: 23320 Difference: 2284 +outros Area: 6489 Difference: 0 + +Demand allocated correctly in 2012. Number of iterations: 0 Maximum error: 2710.5152184257 + +Executing Demand component +Executing Potential component +Executing Allocation component + +Year: 2013 Step: 0 +f Area: 133475 Difference: -3064 +d Area: 23956 Difference: 2635 +outros Area: 6489 Difference: 0 + +Demand allocated correctly in 2013. Number of iterations: 0 Maximum error: 3063.7042134609 + +Executing Demand component +Executing Potential component +Executing Allocation component + +Year: 2014 Step: 0 +f Area: 132899 Difference: -3354 +d Area: 24530 Difference: 2922 +outros Area: 6489 Difference: 0 + +Demand allocated correctly in 2014. Number of iterations: 0 Maximum error: 3353.6276049931 + +Saving Lab01_2014. +Elapsed time: 00:00:04 hh:mm:ss + +End of Simulation +[harness] lab01: 5 arquivos da saída original em /work/out/lab01 +[harness] lab01: CSV gravado em /work/out/lab01 diff --git a/benchmark/goldens/lab01_md1643/lab01_md1643.csv.gz b/benchmark/goldens/lab01_md1643/lab01_md1643.csv.gz new file mode 100644 index 0000000..2d25df9 Binary files /dev/null and b/benchmark/goldens/lab01_md1643/lab01_md1643.csv.gz differ diff --git a/benchmark/goldens/lab01_md1643/manifest.json b/benchmark/goldens/lab01_md1643/manifest.json new file mode 100644 index 0000000..d8d42db --- /dev/null +++ b/benchmark/goldens/lab01_md1643/manifest.json @@ -0,0 +1,60 @@ +{ + "lab": "lab01_md1643", + "source": [ + { + "script": "benchmark/references/lab01_md1643/lab1_main.lua", + "sha256": "48d3fa0891a01107ed7ed72d30f3dbd11cc98a33712126996376db1fdc3774bd" + }, + { + "script": "benchmark/references/lab01_md1643/lab1_submodel.lua", + "sha256": "f26699b3a9e63cc0c5119c52b9c32b9894b8f9ab5152fcef185755e9c51e041f" + } + ], + "engine": { + "image": "terrame-luccme", + "terrame": "2.0.1", + "terralib": "5.5.1", + "luccme_commit": "6244dd461f94259efb6e1d2170d32fc7e28c033c" + }, + "generator": { + "script": "benchmark/harness.lua", + "sha256": "be7c575428c574da799f7f745da7766a05f6b878df08b12bcd0bab882e346581" + }, + "status": "ok", + "years": [ + 2008, + 2014 + ], + "n_cells": 6574, + "columns": [ + "f_out", + "d_out", + "outros_out", + "f_pot", + "d_pot", + "outros_pot" + ], + "file": { + "name": "lab01_md1643.csv.gz", + "rows": 46018, + "sha256": "c0a46b524be5e482921c7fd10239168b3f472636dd762b18df34056793803c46" + }, + "crosscheck_vs_original_output": { + "tolerance": 1e-09, + "max_abs_diff": { + "Lab1_2014.dbf:d_out": 4.999993474807951e-13, + "original_Lab1_2014.dbf:d_out": 4.999993474807951e-13 + }, + "note": "último ano do CSV comparado com os .dbf da pasta de saída: a saída do próprio script e, nas referências, a saída original do TerraME" + }, + "iterations_per_year": { + "2008": 0, + "2009": 0, + "2010": 8, + "2011": 26, + "2012": 18, + "2013": 17, + "2014": 17 + }, + "iterations_note": "contínuo: 'Number of iterations' do LuccME; discreto: maior n de 'Iteration -> n' (0 = aceito na 1ª passada)" +} diff --git a/benchmark/goldens/lab01_md1643/terrame.log b/benchmark/goldens/lab01_md1643/terrame.log new file mode 100644 index 0000000..9e079eb --- /dev/null +++ b/benchmark/goldens/lab01_md1643/terrame.log @@ -0,0 +1,522 @@ + +Verifying Model parameters +Verifying Demand parameters +Verifying Potential parameters +Verifying Allocation parameters + +Executing Demand component +Executing Potential component +Executing Allocation component + +Year: 2008 Step: 0 +f Area: 137878 Difference: 0 +d Area: 19982 Difference: 0 +outros Area: 6489 Difference: 0 + +Demand allocated correctly in 2008. Number of iterations: 0 Maximum error: 2.7950358344242e-05 +[harness] lab01_md1643: Lab1, anos 2008..2014, colunas f_out,d_out,outros_out,f_pot,d_pot,outros_pot + +Executing Demand component +Executing Potential component +Executing Allocation component + +Year: 2009 Step: 0 +f Area: 136483 Difference: -1139 +d Area: 20953 Difference: 714 +outros Area: 6489 Difference: 0 + +Demand allocated correctly in 2009. Number of iterations: 0 Maximum error: 1138.4125251856 +Cell 1: f_pot=0.0295, d_pot=-0.0398 +Cell 2: f_pot=-0.0227, d_pot=0.0000 +Cell 3: f_pot=-0.0171, d_pot=0.0000 +Cell 4: f_pot=-0.0223, d_pot=0.0000 +Cell 5: f_pot=-0.0353, d_pot=0.0000 +Mean d_pot: 0.0052 + +Executing Demand component +Executing Potential component +Executing Allocation component + +Year: 2010 Step: 0 +f Area: 135609 Difference: -1757 +d Area: 21826 Difference: 1331 +outros Area: 6489 Difference: 0 + +Year: 2010 Step: 1 +f Area: 135626 Difference: -1740 +d Area: 21773 Difference: 1278 +outros Area: 6489 Difference: 0 + +Year: 2010 Step: 2 +f Area: 135642 Difference: -1724 +d Area: 21725 Difference: 1230 +outros Area: 6489 Difference: 0 + +Year: 2010 Step: 3 +f Area: 135658 Difference: -1708 +d Area: 21681 Difference: 1186 +outros Area: 6489 Difference: 0 + +Year: 2010 Step: 4 +f Area: 135674 Difference: -1693 +d Area: 21641 Difference: 1146 +outros Area: 6489 Difference: 0 + +Year: 2010 Step: 5 +f Area: 135689 Difference: -1678 +d Area: 21604 Difference: 1110 +outros Area: 6489 Difference: 0 + +Year: 2010 Step: 6 +f Area: 135704 Difference: -1663 +d Area: 21571 Difference: 1076 +outros Area: 6489 Difference: 0 + +Year: 2010 Step: 7 +f Area: 135718 Difference: -1648 +d Area: 21540 Difference: 1046 +outros Area: 6489 Difference: 0 + +Year: 2010 Step: 8 +f Area: 135732 Difference: -1634 +d Area: 21512 Difference: 1017 +outros Area: 6489 Difference: 0 + +Demand allocated correctly in 2010. Number of iterations: 8 Maximum error: 1633.341418966 + +Executing Demand component +Executing Potential component +Executing Allocation component + +Year: 2011 Step: 0 +f Area: 135106 Difference: -2005 +d Area: 22329 Difference: 1579 +outros Area: 6489 Difference: 0 + +Year: 2011 Step: 1 +f Area: 135124 Difference: -1986 +d Area: 22271 Difference: 1521 +outros Area: 6489 Difference: 0 + +Year: 2011 Step: 2 +f Area: 135142 Difference: -1969 +d Area: 22219 Difference: 1469 +outros Area: 6489 Difference: 0 + +Year: 2011 Step: 3 +f Area: 135159 Difference: -1951 +d Area: 22173 Difference: 1422 +outros Area: 6489 Difference: 0 + +Year: 2011 Step: 4 +f Area: 135176 Difference: -1934 +d Area: 22130 Difference: 1380 +outros Area: 6489 Difference: 0 + +Year: 2011 Step: 5 +f Area: 135192 Difference: -1918 +d Area: 22092 Difference: 1341 +outros Area: 6489 Difference: 0 + +Year: 2011 Step: 6 +f Area: 135209 Difference: -1902 +d Area: 22056 Difference: 1306 +outros Area: 6489 Difference: 0 + +Year: 2011 Step: 7 +f Area: 135224 Difference: -1886 +d Area: 22024 Difference: 1274 +outros Area: 6489 Difference: 0 + +Year: 2011 Step: 8 +f Area: 135240 Difference: -1870 +d Area: 21994 Difference: 1244 +outros Area: 6489 Difference: 0 + +Year: 2011 Step: 9 +f Area: 135255 Difference: -1855 +d Area: 21967 Difference: 1217 +outros Area: 6489 Difference: 0 + +Year: 2011 Step: 10 +f Area: 135270 Difference: -1841 +d Area: 21942 Difference: 1191 +outros Area: 6489 Difference: 0 + +Year: 2011 Step: 11 +f Area: 135284 Difference: -1826 +d Area: 21919 Difference: 1168 +outros Area: 6489 Difference: 0 + +Year: 2011 Step: 12 +f Area: 135298 Difference: -1812 +d Area: 21897 Difference: 1146 +outros Area: 6489 Difference: 0 + +Year: 2011 Step: 13 +f Area: 135312 Difference: -1798 +d Area: 21877 Difference: 1126 +outros Area: 6489 Difference: 0 + +Year: 2011 Step: 14 +f Area: 135326 Difference: -1784 +d Area: 21858 Difference: 1107 +outros Area: 6489 Difference: 0 + +Year: 2011 Step: 15 +f Area: 135339 Difference: -1771 +d Area: 21840 Difference: 1090 +outros Area: 6489 Difference: 0 + +Year: 2011 Step: 16 +f Area: 135352 Difference: -1758 +d Area: 21824 Difference: 1073 +outros Area: 6489 Difference: 0 + +Year: 2011 Step: 17 +f Area: 135365 Difference: -1745 +d Area: 21809 Difference: 1058 +outros Area: 6489 Difference: 0 + +Year: 2011 Step: 18 +f Area: 135377 Difference: -1733 +d Area: 21794 Difference: 1044 +outros Area: 6489 Difference: 0 + +Year: 2011 Step: 19 +f Area: 135390 Difference: -1721 +d Area: 21781 Difference: 1030 +outros Area: 6489 Difference: 0 + +Year: 2011 Step: 20 +f Area: 135402 Difference: -1709 +d Area: 21768 Difference: 1017 +outros Area: 6489 Difference: 0 + +Year: 2011 Step: 21 +f Area: 135414 Difference: -1697 +d Area: 21756 Difference: 1005 +outros Area: 6489 Difference: 0 + +Year: 2011 Step: 22 +f Area: 135425 Difference: -1685 +d Area: 21745 Difference: 994 +outros Area: 6489 Difference: 0 + +Year: 2011 Step: 23 +f Area: 135436 Difference: -1674 +d Area: 21734 Difference: 983 +outros Area: 6489 Difference: 0 + +Year: 2011 Step: 24 +f Area: 135448 Difference: -1663 +d Area: 21724 Difference: 973 +outros Area: 6489 Difference: 0 + +Year: 2011 Step: 25 +f Area: 135459 Difference: -1652 +d Area: 21714 Difference: 964 +outros Area: 6489 Difference: 0 + +Year: 2011 Step: 26 +f Area: 135469 Difference: -1641 +d Area: 21705 Difference: 955 +outros Area: 6489 Difference: 0 + +Demand allocated correctly in 2011. Number of iterations: 26 Maximum error: 1640.6006249464 + +Executing Demand component +Executing Potential component +Executing Allocation component + +Year: 2012 Step: 0 +f Area: 134931 Difference: -1893 +d Area: 22504 Difference: 1467 +outros Area: 6489 Difference: 0 + +Year: 2012 Step: 1 +f Area: 134948 Difference: -1877 +d Area: 22452 Difference: 1415 +outros Area: 6489 Difference: 0 + +Year: 2012 Step: 2 +f Area: 134965 Difference: -1860 +d Area: 22404 Difference: 1368 +outros Area: 6489 Difference: 0 + +Year: 2012 Step: 3 +f Area: 134981 Difference: -1844 +d Area: 22362 Difference: 1326 +outros Area: 6489 Difference: 0 + +Year: 2012 Step: 4 +f Area: 134997 Difference: -1828 +d Area: 22323 Difference: 1287 +outros Area: 6489 Difference: 0 + +Year: 2012 Step: 5 +f Area: 135012 Difference: -1813 +d Area: 22287 Difference: 1251 +outros Area: 6489 Difference: 0 + +Year: 2012 Step: 6 +f Area: 135027 Difference: -1797 +d Area: 22255 Difference: 1218 +outros Area: 6489 Difference: 0 + +Year: 2012 Step: 7 +f Area: 135042 Difference: -1783 +d Area: 22224 Difference: 1188 +outros Area: 6489 Difference: 0 + +Year: 2012 Step: 8 +f Area: 135057 Difference: -1768 +d Area: 22197 Difference: 1161 +outros Area: 6489 Difference: 0 + +Year: 2012 Step: 9 +f Area: 135071 Difference: -1754 +d Area: 22171 Difference: 1135 +outros Area: 6489 Difference: 0 + +Year: 2012 Step: 10 +f Area: 135085 Difference: -1740 +d Area: 22147 Difference: 1111 +outros Area: 6489 Difference: 0 + +Year: 2012 Step: 11 +f Area: 135098 Difference: -1726 +d Area: 22125 Difference: 1089 +outros Area: 6489 Difference: 0 + +Year: 2012 Step: 12 +f Area: 135112 Difference: -1713 +d Area: 22104 Difference: 1068 +outros Area: 6489 Difference: 0 + +Year: 2012 Step: 13 +f Area: 135125 Difference: -1700 +d Area: 22085 Difference: 1049 +outros Area: 6489 Difference: 0 + +Year: 2012 Step: 14 +f Area: 135137 Difference: -1687 +d Area: 22067 Difference: 1031 +outros Area: 6489 Difference: 0 + +Year: 2012 Step: 15 +f Area: 135150 Difference: -1675 +d Area: 22050 Difference: 1014 +outros Area: 6489 Difference: 0 + +Year: 2012 Step: 16 +f Area: 135162 Difference: -1662 +d Area: 22034 Difference: 998 +outros Area: 6489 Difference: 0 + +Year: 2012 Step: 17 +f Area: 135174 Difference: -1650 +d Area: 22019 Difference: 983 +outros Area: 6489 Difference: 0 + +Year: 2012 Step: 18 +f Area: 135186 Difference: -1639 +d Area: 22005 Difference: 969 +outros Area: 6489 Difference: 0 + +Demand allocated correctly in 2012. Number of iterations: 18 Maximum error: 1638.1073367472 + +Executing Demand component +Executing Potential component +Executing Allocation component + +Year: 2013 Step: 0 +f Area: 134661 Difference: -1878 +d Area: 22774 Difference: 1452 +outros Area: 6489 Difference: 0 + +Year: 2013 Step: 1 +f Area: 134677 Difference: -1862 +d Area: 22725 Difference: 1403 +outros Area: 6489 Difference: 0 + +Year: 2013 Step: 2 +f Area: 134693 Difference: -1846 +d Area: 22680 Difference: 1358 +outros Area: 6489 Difference: 0 + +Year: 2013 Step: 3 +f Area: 134709 Difference: -1830 +d Area: 22640 Difference: 1318 +outros Area: 6489 Difference: 0 + +Year: 2013 Step: 4 +f Area: 134724 Difference: -1815 +d Area: 22603 Difference: 1281 +outros Area: 6489 Difference: 0 + +Year: 2013 Step: 5 +f Area: 134739 Difference: -1800 +d Area: 22569 Difference: 1247 +outros Area: 6489 Difference: 0 + +Year: 2013 Step: 6 +f Area: 134754 Difference: -1785 +d Area: 22538 Difference: 1216 +outros Area: 6489 Difference: 0 + +Year: 2013 Step: 7 +f Area: 134768 Difference: -1771 +d Area: 22509 Difference: 1187 +outros Area: 6489 Difference: 0 + +Year: 2013 Step: 8 +f Area: 134783 Difference: -1757 +d Area: 22482 Difference: 1161 +outros Area: 6489 Difference: 0 + +Year: 2013 Step: 9 +f Area: 134796 Difference: -1743 +d Area: 22458 Difference: 1136 +outros Area: 6489 Difference: 0 + +Year: 2013 Step: 10 +f Area: 134810 Difference: -1729 +d Area: 22435 Difference: 1113 +outros Area: 6489 Difference: 0 + +Year: 2013 Step: 11 +f Area: 134823 Difference: -1716 +d Area: 22414 Difference: 1092 +outros Area: 6489 Difference: 0 + +Year: 2013 Step: 12 +f Area: 134836 Difference: -1703 +d Area: 22394 Difference: 1072 +outros Area: 6489 Difference: 0 + +Year: 2013 Step: 13 +f Area: 134849 Difference: -1690 +d Area: 22375 Difference: 1053 +outros Area: 6489 Difference: 0 + +Year: 2013 Step: 14 +f Area: 134861 Difference: -1678 +d Area: 22358 Difference: 1036 +outros Area: 6489 Difference: 0 + +Year: 2013 Step: 15 +f Area: 134873 Difference: -1666 +d Area: 22341 Difference: 1020 +outros Area: 6489 Difference: 0 + +Year: 2013 Step: 16 +f Area: 134885 Difference: -1654 +d Area: 22326 Difference: 1004 +outros Area: 6489 Difference: 0 + +Year: 2013 Step: 17 +f Area: 134897 Difference: -1642 +d Area: 22312 Difference: 990 +outros Area: 6489 Difference: 0 + +Demand allocated correctly in 2013. Number of iterations: 17 Maximum error: 1641.4798002601 + +Executing Demand component +Executing Potential component +Executing Allocation component + +Year: 2014 Step: 0 +f Area: 134385 Difference: -1869 +d Area: 23049 Difference: 1442 +outros Area: 6489 Difference: 0 + +Year: 2014 Step: 1 +f Area: 134401 Difference: -1853 +d Area: 23003 Difference: 1396 +outros Area: 6489 Difference: 0 + +Year: 2014 Step: 2 +f Area: 134416 Difference: -1837 +d Area: 22961 Difference: 1354 +outros Area: 6489 Difference: 0 + +Year: 2014 Step: 3 +f Area: 134432 Difference: -1822 +d Area: 22923 Difference: 1315 +outros Area: 6489 Difference: 0 + +Year: 2014 Step: 4 +f Area: 134447 Difference: -1807 +d Area: 22888 Difference: 1280 +outros Area: 6489 Difference: 0 + +Year: 2014 Step: 5 +f Area: 134461 Difference: -1792 +d Area: 22855 Difference: 1248 +outros Area: 6489 Difference: 0 + +Year: 2014 Step: 6 +f Area: 134475 Difference: -1778 +d Area: 22826 Difference: 1218 +outros Area: 6489 Difference: 0 + +Year: 2014 Step: 7 +f Area: 134489 Difference: -1764 +d Area: 22798 Difference: 1191 +outros Area: 6489 Difference: 0 + +Year: 2014 Step: 8 +f Area: 134503 Difference: -1750 +d Area: 22773 Difference: 1165 +outros Area: 6489 Difference: 0 + +Year: 2014 Step: 9 +f Area: 134517 Difference: -1737 +d Area: 22749 Difference: 1142 +outros Area: 6489 Difference: 0 + +Year: 2014 Step: 10 +f Area: 134530 Difference: -1724 +d Area: 22727 Difference: 1120 +outros Area: 6489 Difference: 0 + +Year: 2014 Step: 11 +f Area: 134543 Difference: -1711 +d Area: 22707 Difference: 1099 +outros Area: 6489 Difference: 0 + +Year: 2014 Step: 12 +f Area: 134555 Difference: -1698 +d Area: 22688 Difference: 1080 +outros Area: 6489 Difference: 0 + +Year: 2014 Step: 13 +f Area: 134568 Difference: -1686 +d Area: 22670 Difference: 1062 +outros Area: 6489 Difference: 0 + +Year: 2014 Step: 14 +f Area: 134580 Difference: -1674 +d Area: 22653 Difference: 1045 +outros Area: 6489 Difference: 0 + +Year: 2014 Step: 15 +f Area: 134592 Difference: -1662 +d Area: 22637 Difference: 1030 +outros Area: 6489 Difference: 0 + +Year: 2014 Step: 16 +f Area: 134603 Difference: -1650 +d Area: 22622 Difference: 1015 +outros Area: 6489 Difference: 0 + +Year: 2014 Step: 17 +f Area: 134615 Difference: -1639 +d Area: 22608 Difference: 1001 +outros Area: 6489 Difference: 0 + +Demand allocated correctly in 2014. Number of iterations: 17 Maximum error: 1638.220954259 + +Saving Lab1_2014. +[harness] lab01_md1643: CSV gravado em /work/out/lab01_md1643 diff --git a/benchmark/goldens/lab15/lab15.csv.gz b/benchmark/goldens/lab15/lab15.csv.gz new file mode 100644 index 0000000..de7f4fd Binary files /dev/null and b/benchmark/goldens/lab15/lab15.csv.gz differ diff --git a/benchmark/goldens/lab15/manifest.json b/benchmark/goldens/lab15/manifest.json new file mode 100644 index 0000000..4d7c79c --- /dev/null +++ b/benchmark/goldens/lab15/manifest.json @@ -0,0 +1,52 @@ +{ + "lab": "lab15", + "source": { + "script": "luccme/tests/functional/lab15.lua", + "sha256": "bc9faf3a26aafa42c0075f114c0def46a1320e1f89ab52b7886b27ca72075bf7" + }, + "engine": { + "image": "terrame-luccme", + "terrame": "2.0.1", + "terralib": "5.5.1", + "luccme_commit": "6244dd461f94259efb6e1d2170d32fc7e28c033c" + }, + "generator": { + "script": "benchmark/harness.lua", + "sha256": "be7c575428c574da799f7f745da7766a05f6b878df08b12bcd0bab882e346581" + }, + "status": "ok", + "years": [ + 1999, + 2004 + ], + "n_cells": 5914, + "columns": [ + "f_out", + "d_out", + "o_out", + "f_pot", + "d_pot", + "o_pot" + ], + "file": { + "name": "lab15.csv.gz", + "rows": 35484, + "sha256": "00c400fe3b1cd15883ee02e7ba2f195becfc4e3d95ddb4dc28dfeeef86108ad9" + }, + "crosscheck_vs_original_output": { + "tolerance": 1e-09, + "max_abs_diff": { + "Lab15_2004.dbf:d_out": 0.0 + }, + "note": "último ano do CSV comparado com os .dbf da pasta de saída: a saída do próprio script e, nas referências, a saída original do TerraME" + }, + "iterations_per_year": { + "1999": 0, + "2000": 0, + "2001": 0, + "2002": 0, + "2003": 0, + "2004": 0 + }, + "iterations_note": "contínuo: 'Number of iterations' do LuccME; discreto: maior n de 'Iteration -> n' (0 = aceito na 1ª passada)" +} diff --git a/benchmark/goldens/lab15/terrame.log b/benchmark/goldens/lab15/terrame.log new file mode 100644 index 0000000..7687750 --- /dev/null +++ b/benchmark/goldens/lab15/terrame.log @@ -0,0 +1,139 @@ + +Verifying Model parameters +Verifying Demand parameters +Verifying Potential parameters +Verifying Allocation parameters + +Executing Demand component +Executing Potential component +Executing Allocation component + +Time: 1999 +------------------------------------------------------------------------------- +Cell Area 1 +Num of cells 5914 +Max diff area 300 +Initial area for land use : f -> 5706 +Initial area for land use : d -> 205 +Initial area for land use : o -> 3 +------------------------------------------------------------------------------- + +Year: 1999 Iteration -> 0 +f -> 5706 demand -> 5706 difference -> 0 +d -> 205 demand -> 205 difference -> 0 +o -> 3 demand -> 3 difference -> 0 + +Demand allocated correctly in this time: 1999 +[harness] lab15: Lab15, anos 1999..2004, colunas f_out,d_out,o_out,f_pot,d_pot,o_pot + +Executing Demand component +Executing Potential component +Executing Allocation component + +Time: 2000 +------------------------------------------------------------------------------- +Cell Area 1 +Num of cells 5914 +Max diff area 300 +Initial area for land use : f -> 5706 +Initial area for land use : d -> 205 +Initial area for land use : o -> 3 +------------------------------------------------------------------------------- + +Year: 2000 Iteration -> 0 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Demand allocated correctly in this time: 2000 + +Executing Demand component +Executing Potential component +Executing Allocation component + +Time: 2001 +------------------------------------------------------------------------------- +Cell Area 1 +Num of cells 5914 +Max diff area 300 +Initial area for land use : f -> 5706 +Initial area for land use : d -> 205 +Initial area for land use : o -> 3 +------------------------------------------------------------------------------- + +Year: 2001 Iteration -> 0 +f -> 5706 demand -> 5611 difference -> -95 +d -> 205 demand -> 300 difference -> 95 +o -> 3 demand -> 3 difference -> 0 + +Demand allocated correctly in this time: 2001 + +Executing Demand component +Executing Potential component +Executing Allocation component + +Time: 2002 +------------------------------------------------------------------------------- +Cell Area 1 +Num of cells 5914 +Max diff area 300 +Initial area for land use : f -> 5706 +Initial area for land use : d -> 205 +Initial area for land use : o -> 3 +------------------------------------------------------------------------------- + +Year: 2002 Iteration -> 0 +f -> 5706 demand -> 5563 difference -> -143 +d -> 205 demand -> 348 difference -> 143 +o -> 3 demand -> 3 difference -> 0 + +Demand allocated correctly in this time: 2002 + +Executing Demand component +Executing Potential component +Executing Allocation component + +Time: 2003 +------------------------------------------------------------------------------- +Cell Area 1 +Num of cells 5914 +Max diff area 300 +Initial area for land use : f -> 5706 +Initial area for land use : d -> 205 +Initial area for land use : o -> 3 +------------------------------------------------------------------------------- + +Year: 2003 Iteration -> 0 +f -> 5706 demand -> 5516 difference -> -190 +d -> 205 demand -> 395 difference -> 190 +o -> 3 demand -> 3 difference -> 0 + +Demand allocated correctly in this time: 2003 + +Executing Demand component +Executing Potential component +Executing Allocation component + +Time: 2004 +------------------------------------------------------------------------------- +Cell Area 1 +Num of cells 5914 +Max diff area 300 +Initial area for land use : f -> 5706 +Initial area for land use : d -> 205 +Initial area for land use : o -> 3 +------------------------------------------------------------------------------- + +Year: 2004 Iteration -> 0 +f -> 5706 demand -> 5468 difference -> -238 +d -> 205 demand -> 443 difference -> 238 +o -> 3 demand -> 3 difference -> 0 + +Demand allocated correctly in this time: 2004 + +Saving Lab15_2004. +Elapsed time: 00:00:03 hh:mm:ss + +End of Simulation +[harness] lab15: 5 arquivos da saída original em /work/out/lab15 +[harness] lab15: CSV gravado em /work/out/lab15 diff --git a/benchmark/goldens/lab15_md10/lab15_md10.csv.gz b/benchmark/goldens/lab15_md10/lab15_md10.csv.gz new file mode 100644 index 0000000..858686e Binary files /dev/null and b/benchmark/goldens/lab15_md10/lab15_md10.csv.gz differ diff --git a/benchmark/goldens/lab15_md10/manifest.json b/benchmark/goldens/lab15_md10/manifest.json new file mode 100644 index 0000000..ed4b4ef --- /dev/null +++ b/benchmark/goldens/lab15_md10/manifest.json @@ -0,0 +1,59 @@ +{ + "lab": "lab15_md10", + "source": [ + { + "script": "benchmark/references/lab15_md10/lab6_main.lua", + "sha256": "12b1174b8f2f71938eeb7e9aa328bc72ead02e3d3c096535f18a07a6837e1584" + }, + { + "script": "benchmark/references/lab15_md10/lab6_submodel.lua", + "sha256": "bf107bee8178039285989e736e22b9bfe068cf85d3ddb0a5c6c23579e417c9c6" + } + ], + "engine": { + "image": "terrame-luccme", + "terrame": "2.0.1", + "terralib": "5.5.1", + "luccme_commit": "6244dd461f94259efb6e1d2170d32fc7e28c033c" + }, + "generator": { + "script": "benchmark/harness.lua", + "sha256": "be7c575428c574da799f7f745da7766a05f6b878df08b12bcd0bab882e346581" + }, + "status": "ok", + "years": [ + 1999, + 2004 + ], + "n_cells": 5914, + "columns": [ + "f_out", + "d_out", + "o_out", + "f_pot", + "d_pot", + "o_pot" + ], + "file": { + "name": "lab15_md10.csv.gz", + "rows": 35484, + "sha256": "aa1ee24ee75953c066e3713072aa4c2a4fac7fe7ee1b1f5d8bd0bafb202bebcc" + }, + "crosscheck_vs_original_output": { + "tolerance": 1e-09, + "max_abs_diff": { + "Lab6_2004.dbf:d_out": 0.0, + "original_Lab15_2004.dbf:d_out": 0.0 + }, + "note": "último ano do CSV comparado com os .dbf da pasta de saída: a saída do próprio script e, nas referências, a saída original do TerraME" + }, + "iterations_per_year": { + "1999": 0, + "2000": 67, + "2001": 56, + "2002": 56, + "2003": 61, + "2004": 61 + }, + "iterations_note": "contínuo: 'Number of iterations' do LuccME; discreto: maior n de 'Iteration -> n' (0 = aceito na 1ª passada)" +} diff --git a/benchmark/goldens/lab15_md10/terrame.log b/benchmark/goldens/lab15_md10/terrame.log new file mode 100644 index 0000000..3f79c0e --- /dev/null +++ b/benchmark/goldens/lab15_md10/terrame.log @@ -0,0 +1,1643 @@ + +Verifying Model parameters +Verifying Demand parameters +Verifying Potential parameters +Verifying Allocation parameters + +Executing Demand component +Executing Potential component +Executing Allocation component + +Time: 1999 +------------------------------------------------------------------------------- +Cell Area 1 +Num of cells 5914 +Max diff area 10 +Initial area for land use : f -> 5706 +Initial area for land use : d -> 205 +Initial area for land use : o -> 3 +------------------------------------------------------------------------------- + +Year: 1999 Iteration -> 0 +f -> 5706 demand -> 5706 difference -> 0 +d -> 205 demand -> 205 difference -> 0 +o -> 3 demand -> 3 difference -> 0 + +Demand allocated correctly in this time: 1999 +[harness] lab15_md10: Lab6, anos 1999..2004, colunas f_out,d_out,o_out,f_pot,d_pot,o_pot + +Executing Demand component +Executing Potential component +Executing Allocation component + +Time: 2000 +------------------------------------------------------------------------------- +Cell Area 1 +Num of cells 5914 +Max diff area 10 +Initial area for land use : f -> 5706 +Initial area for land use : d -> 205 +Initial area for land use : o -> 3 +------------------------------------------------------------------------------- + +Year: 2000 Iteration -> 0 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 1 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 2 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 3 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 4 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 5 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 6 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 7 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 8 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 9 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 10 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 11 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 12 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 13 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 14 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 15 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 16 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 17 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 18 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 19 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 20 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 21 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 22 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 23 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 24 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 25 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 26 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 27 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 28 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 29 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 30 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 31 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 32 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 33 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 34 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 35 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 36 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 37 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 38 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 39 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 40 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 41 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 42 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 43 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 44 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 45 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 46 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 47 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 48 +f -> 5706 demand -> 5658 difference -> -48 +d -> 205 demand -> 253 difference -> 48 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 49 +f -> 5705 demand -> 5658 difference -> -47 +d -> 206 demand -> 253 difference -> 47 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 50 +f -> 5705 demand -> 5658 difference -> -47 +d -> 206 demand -> 253 difference -> 47 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 51 +f -> 5704 demand -> 5658 difference -> -46 +d -> 207 demand -> 253 difference -> 46 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 52 +f -> 5702 demand -> 5658 difference -> -44 +d -> 209 demand -> 253 difference -> 44 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 53 +f -> 5701 demand -> 5658 difference -> -43 +d -> 210 demand -> 253 difference -> 43 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 54 +f -> 5700 demand -> 5658 difference -> -42 +d -> 211 demand -> 253 difference -> 42 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 55 +f -> 5697 demand -> 5658 difference -> -39 +d -> 214 demand -> 253 difference -> 39 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 56 +f -> 5694 demand -> 5658 difference -> -36 +d -> 217 demand -> 253 difference -> 36 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 57 +f -> 5689 demand -> 5658 difference -> -31 +d -> 222 demand -> 253 difference -> 31 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 58 +f -> 5687 demand -> 5658 difference -> -29 +d -> 224 demand -> 253 difference -> 29 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 59 +f -> 5686 demand -> 5658 difference -> -28 +d -> 225 demand -> 253 difference -> 28 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 60 +f -> 5685 demand -> 5658 difference -> -27 +d -> 226 demand -> 253 difference -> 27 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 61 +f -> 5681 demand -> 5658 difference -> -23 +d -> 230 demand -> 253 difference -> 23 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 62 +f -> 5680 demand -> 5658 difference -> -22 +d -> 231 demand -> 253 difference -> 22 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 63 +f -> 5676 demand -> 5658 difference -> -18 +d -> 235 demand -> 253 difference -> 18 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 64 +f -> 5672 demand -> 5658 difference -> -14 +d -> 239 demand -> 253 difference -> 14 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 65 +f -> 5669 demand -> 5658 difference -> -11 +d -> 242 demand -> 253 difference -> 11 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 66 +f -> 5669 demand -> 5658 difference -> -11 +d -> 242 demand -> 253 difference -> 11 +o -> 3 demand -> 3 difference -> 0 + +Year: 2000 Iteration -> 67 +f -> 5667 demand -> 5658 difference -> -9 +d -> 244 demand -> 253 difference -> 9 +o -> 3 demand -> 3 difference -> 0 + +Demand allocated correctly in this time: 2000 + +Executing Demand component +Executing Potential component +Executing Allocation component + +Time: 2001 +------------------------------------------------------------------------------- +Cell Area 1 +Num of cells 5914 +Max diff area 10 +Initial area for land use : f -> 5667 +Initial area for land use : d -> 244 +Initial area for land use : o -> 3 +------------------------------------------------------------------------------- + +Year: 2001 Iteration -> 0 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 1 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 2 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 3 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 4 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 5 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 6 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 7 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 8 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 9 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 10 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 11 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 12 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 13 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 14 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 15 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 16 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 17 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 18 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 19 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 20 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 21 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 22 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 23 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 24 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 25 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 26 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 27 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 28 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 29 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 30 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 31 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 32 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 33 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 34 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 35 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 36 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 37 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 38 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 39 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 40 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 41 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 42 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 43 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 44 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 45 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 46 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 47 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 48 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 49 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 50 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 51 +f -> 5667 demand -> 5611 difference -> -56 +d -> 244 demand -> 300 difference -> 56 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 52 +f -> 5666 demand -> 5611 difference -> -55 +d -> 245 demand -> 300 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 53 +f -> 5651 demand -> 5611 difference -> -40 +d -> 260 demand -> 300 difference -> 40 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 54 +f -> 5632 demand -> 5611 difference -> -21 +d -> 279 demand -> 300 difference -> 21 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 55 +f -> 5623 demand -> 5611 difference -> -12 +d -> 288 demand -> 300 difference -> 12 +o -> 3 demand -> 3 difference -> 0 + +Year: 2001 Iteration -> 56 +f -> 5620 demand -> 5611 difference -> -9 +d -> 291 demand -> 300 difference -> 9 +o -> 3 demand -> 3 difference -> 0 + +Demand allocated correctly in this time: 2001 + +Executing Demand component +Executing Potential component +Executing Allocation component + +Time: 2002 +------------------------------------------------------------------------------- +Cell Area 1 +Num of cells 5914 +Max diff area 10 +Initial area for land use : f -> 5620 +Initial area for land use : d -> 291 +Initial area for land use : o -> 3 +------------------------------------------------------------------------------- + +Year: 2002 Iteration -> 0 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 1 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 2 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 3 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 4 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 5 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 6 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 7 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 8 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 9 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 10 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 11 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 12 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 13 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 14 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 15 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 16 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 17 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 18 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 19 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 20 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 21 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 22 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 23 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 24 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 25 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 26 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 27 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 28 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 29 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 30 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 31 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 32 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 33 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 34 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 35 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 36 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 37 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 38 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 39 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 40 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 41 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 42 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 43 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 44 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 45 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 46 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 47 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 48 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 49 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 50 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 51 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 52 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 53 +f -> 5620 demand -> 5563 difference -> -57 +d -> 291 demand -> 348 difference -> 57 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 54 +f -> 5609 demand -> 5563 difference -> -46 +d -> 302 demand -> 348 difference -> 46 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 55 +f -> 5586 demand -> 5563 difference -> -23 +d -> 325 demand -> 348 difference -> 23 +o -> 3 demand -> 3 difference -> 0 + +Year: 2002 Iteration -> 56 +f -> 5570 demand -> 5563 difference -> -7 +d -> 341 demand -> 348 difference -> 7 +o -> 3 demand -> 3 difference -> 0 + +Demand allocated correctly in this time: 2002 + +Executing Demand component +Executing Potential component +Executing Allocation component + +Time: 2003 +------------------------------------------------------------------------------- +Cell Area 1 +Num of cells 5914 +Max diff area 10 +Initial area for land use : f -> 5570 +Initial area for land use : d -> 341 +Initial area for land use : o -> 3 +------------------------------------------------------------------------------- + +Year: 2003 Iteration -> 0 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 1 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 2 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 3 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 4 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 5 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 6 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 7 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 8 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 9 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 10 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 11 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 12 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 13 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 14 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 15 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 16 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 17 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 18 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 19 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 20 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 21 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 22 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 23 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 24 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 25 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 26 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 27 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 28 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 29 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 30 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 31 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 32 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 33 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 34 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 35 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 36 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 37 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 38 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 39 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 40 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 41 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 42 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 43 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 44 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 45 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 46 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 47 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 48 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 49 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 50 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 51 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 52 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 53 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 54 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 55 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 56 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 57 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 58 +f -> 5570 demand -> 5516 difference -> -54 +d -> 341 demand -> 395 difference -> 54 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 59 +f -> 5547 demand -> 5516 difference -> -31 +d -> 364 demand -> 395 difference -> 31 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 60 +f -> 5529 demand -> 5516 difference -> -13 +d -> 382 demand -> 395 difference -> 13 +o -> 3 demand -> 3 difference -> 0 + +Year: 2003 Iteration -> 61 +f -> 5523 demand -> 5516 difference -> -7 +d -> 388 demand -> 395 difference -> 7 +o -> 3 demand -> 3 difference -> 0 + +Demand allocated correctly in this time: 2003 + +Executing Demand component +Executing Potential component +Executing Allocation component + +Time: 2004 +------------------------------------------------------------------------------- +Cell Area 1 +Num of cells 5914 +Max diff area 10 +Initial area for land use : f -> 5523 +Initial area for land use : d -> 388 +Initial area for land use : o -> 3 +------------------------------------------------------------------------------- + +Year: 2004 Iteration -> 0 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 1 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 2 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 3 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 4 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 5 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 6 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 7 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 8 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 9 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 10 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 11 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 12 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 13 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 14 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 15 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 16 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 17 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 18 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 19 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 20 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 21 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 22 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 23 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 24 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 25 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 26 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 27 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 28 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 29 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 30 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 31 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 32 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 33 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 34 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 35 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 36 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 37 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 38 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 39 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 40 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 41 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 42 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 43 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 44 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 45 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 46 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 47 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 48 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 49 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 50 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 51 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 52 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 53 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 54 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 55 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 56 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 57 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 58 +f -> 5523 demand -> 5468 difference -> -55 +d -> 388 demand -> 443 difference -> 55 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 59 +f -> 5511 demand -> 5468 difference -> -43 +d -> 400 demand -> 443 difference -> 43 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 60 +f -> 5479 demand -> 5468 difference -> -11 +d -> 432 demand -> 443 difference -> 11 +o -> 3 demand -> 3 difference -> 0 + +Year: 2004 Iteration -> 61 +f -> 5469 demand -> 5468 difference -> -1 +d -> 442 demand -> 443 difference -> 1 +o -> 3 demand -> 3 difference -> 0 + +Demand allocated correctly in this time: 2004 + +Saving Lab6_2004. +Elapsed time: 00:00:11 hh:mm:ss + +End of Simulation +[harness] lab15_md10: CSV gravado em /work/out/lab15_md10 diff --git a/benchmark/reference/README.md b/benchmark/reference/README.md deleted file mode 100644 index b3bc3cd..0000000 --- a/benchmark/reference/README.md +++ /dev/null @@ -1,52 +0,0 @@ -# Reference LuccME scripts (provenance) - -These four `.lua` files are the actual "LuccMe Model Configurator" output -scripts that generated the TerraME reference data vendored under -`benchmark/data/` (`LUCCME_Lab1_2014.zip`, `Lab15_2004.zip`). They are kept -here **unmodified** (content is byte-identical to the originals) so the -provenance of every validation number in this repository can be traced and -re-run independently of this project. - -## File naming vs. internal model naming - -The filenames here use this project's convention (`Lab1`, `Lab15`), but the -**internal model names inside the scripts are not "Lab15"** for the discrete -case: - -| File in this folder | Internal `LuccMEModel.name` | `outputTheme` | Generates | -|---|---|---|---| -| `lab1_main.lua` + `lab1_submodel.lua` | `"Lab1"` | `"Lab1_"` | `Lab1_2014.shp` → `benchmark/data/LUCCME_Lab1_2014.zip` | -| `lab15_main.lua` + `lab15_submodel.lua` | `"Lab6"` | `"Lab6_"` | `Lab6_2004.shp` → `benchmark/data/Lab15_2004.zip` | - -`lab15_main.lua`/`lab15_submodel.lua` are the *original* `lab6_main.lua`/ -`lab6_submodel.lua` files (generated 2017-05-11, "Compatible with LuccME -3.0"), renamed here to match the `Lab15` label used throughout `disslucc` -(tests, docs, `benchmark/data/Lab15_2004.zip`). Nothing inside the files was -edited — the model still calls itself `Lab6`, uses `outputTheme = "Lab6_"`, -and produced a shapefile originally named `Lab6_2004.*` (renamed to -`Lab15_2004.*` inside the zip only for internal consistency in this repo). - -## These are *not* the same scripts as `terrame/luccme` on GitHub - -The public [`terrame/luccme`](https://github.com/terrame/luccme) repository's -own automated test suite (`tests/functional/`) contains scripts that share -identical calibrated regression coefficients and demand trajectories with the -ones here, and even similar names — but they are separate scripts, with a -different convergence parameter, and **did not generate the reference data -vendored in this repository**: - -| Scenario | Script actually used here | `maxDifference` here | Look-alike on GitHub | `maxDifference` there | -|---|---|---|---|---| -| Lab1 (continuous) | `lab1_submodel.lua` | 1643 | `tests/functional/lab01.lua` | 5000 | -| Lab15 (discrete) | `lab15_submodel.lua` (= `lab6_submodel.lua`) | 10 | `tests/functional/lab15.lua` | 300 | - -Everywhere in `disslucc`'s code and tests, the `max_difference` defaults -(1643 for the continuous CLUE-like allocation, 10 for the discrete -CLUE-S-like allocation) match the scripts in **this** folder, not the -GitHub look-alikes. Citing the GitHub scripts as the source of these -reference numbers would be inaccurate. - -Source: local project files provided by the repository maintainer, -confirmed against `benchmark/data/*.zip` (matching coefficients, demand, -and — for Lab15 — the reference shapefile's original internal name -`Lab6_2004.*`). diff --git a/benchmark/reference/lab15_main.lua b/benchmark/reference/lab15_main.lua deleted file mode 100644 index d6bd727..0000000 --- a/benchmark/reference/lab15_main.lua +++ /dev/null @@ -1,124 +0,0 @@ --------------------------------------------------------------- --- This file contains a LUCCME APPLICATION MODEL definition -- --- Compatible with LuccME 3.0 -- --- Generated with LuccMe Model Configurator -- --- 11/05/2017 at 16:32:03 -- --------------------------------------------------------------- - --------------------------------------------------------------- --- Creating Terraview Project -- --------------------------------------------------------------- - -import("gis") - -local projFile = File("t3mp.tview") -if(projFile:exists()) then - projFile:delete() -end - -proj = Project { - file = "t3mp.tview", - clean = true -} - -l1 = Layer{ - project = proj, - name = "layer", - file = "../data/cs_moju/cs_moju.shp" -} - --------------------------------------------------------------- --- LuccME Model -- --------------------------------------------------------------- - -import("luccme") - -dofile("lab6_submodel.lua") - - --------------------------------------------------------------- --- LuccME APPLICATION MODEL DEFINITION -- --------------------------------------------------------------- -Lab6 = LuccMEModel -{ - name = "Lab6", - - ----------------------------------------------------- - -- Temporal dimension definition -- - ----------------------------------------------------- - startTime = 1999, - endTime = 2004, - - ----------------------------------------------------- - -- Spatial dimension definition -- - ----------------------------------------------------- - cs = CellularSpace - { - project = "t3mp.tview", - layer = "layer", - cellArea = 1, - }, - - ----------------------------------------------------- - -- Land use variables definition -- - ----------------------------------------------------- - landUseTypes = - { - "f", "d", "o" - }, - - landUseNoData = "o", - - ----------------------------------------------------- - -- Behaviour dimension definition: -- - -- DEMAND, POTENTIAL AND ALLOCATION COMPONENTS -- - ----------------------------------------------------- - demand = D1, - potential = P1, - allocation = A1, - - save = - { - outputTheme = "Lab6_", - mode = "multiple", - saveYears = {2004}, - saveAttrs = - { - "d_out", - }, - - }, - - isCoupled = false -} -- END LuccME application model definition - ------------------------------------------------------ --- ENVIROMMENT DEFINITION -- ------------------------------------------------------ -timer = Timer -{ - Event - { - start = Lab6.startTime, - action = function(event) - Lab6:run(event) - end - } -} - -env_Lab6 = Environment{} -env_Lab6:add(timer) - ------------------------------------------------------ --- ENVIROMMENT EXECUTION -- ------------------------------------------------------ -if Lab6.isCoupled == false then - tsave = databaseSave(Lab6) - env_Lab6:add(tsave) - env_Lab6:run(Lab6.endTime) - saveSingleTheme (Lab6, true) - projFile = File("t3mp.tview") - if(projFile:exists()) then - projFile:delete() - end -end diff --git a/benchmark/reference/lab15_submodel.lua b/benchmark/reference/lab15_submodel.lua deleted file mode 100644 index f4a4dc5..0000000 --- a/benchmark/reference/lab15_submodel.lua +++ /dev/null @@ -1,98 +0,0 @@ --------------------------------------------------------------- --- This file contains the COMPONENTS definition -- --- Compatible with LuccME 3.0 -- --- Generated with LuccMe Model Configurator -- --- 11/05/2017 at 16:32:03 -- --------------------------------------------------------------- - ------------------------------------------------------ --- Demand -- ------------------------------------------------------ -D1 = DemandPreComputedValues -{ - annualDemand = - { - -- "f", "d", "o" - {5706, 205, 3}, -- 1999 - {5658, 253, 3}, -- 2000 - {5611, 300, 3}, -- 2001 - {5563, 348, 3}, -- 2002 - {5516, 395, 3}, -- 2003 - {5468, 443, 3} -- 2004 - } -} - ------------------------------------------------------ --- Potential -- ------------------------------------------------------ -P1 = PotentialDLogisticRegression -{ - potentialData = - { - -- Region 1 - { - -- f - { - const = -2.34187976925989, - elasticity = 0.0, - - betas = - { - media_decl = -0.0272710076327129, - dist_area_ = 4.30977432375496, - dist_br = 3.10319957497883, - dist_curua = 0.445414024051873, - dist_rios_ = 47.3556329553235, - dist_estra = 38.4966894254506 - } - }, - - -- d - { - const = -0.100351497277102, - elasticity = 0.6, - - betas = - { - media_decl = 0.0581358851690861, - dist_area_ = -0.974998890251365, - dist_br = -2.51650696123426, - dist_curua = -1.26742746441679, - dist_rios_ = -40.3646901047482, - dist_estra = -23.0841140199094 - } - }, - - -- o - { - const = 0.01, - elasticity = 0.5, - - betas = - { - - } - } - } - } -} - ------------------------------------------------------ --- Allocation -- ------------------------------------------------------ -A1 = AllocationDClueSLike -{ - maxIteration = 1000, - factorIteration = 0.0001, - maxDifference = 10, - transitionMatrix = - { - --Region 1 - { - {1, 1, 0}, - {0, 1, 0}, - {0, 0, 1} - } - } -} - diff --git a/benchmark/reference/lab1_main.lua b/benchmark/reference/lab1_main.lua deleted file mode 100644 index 618cc57..0000000 --- a/benchmark/reference/lab1_main.lua +++ /dev/null @@ -1,160 +0,0 @@ --------------------------------------------------------------- --- This file contains a LUCCME APPLICATION MODEL definition -- --- Compatible with LuccME 3.1 -- --- Generated with LuccMe Model Configurator -- --- 25/09/2017 at 11:57:26 -- --------------------------------------------------------------- - --------------------------------------------------------------- --- Creating Terraview Project -- --------------------------------------------------------------- - -import("gis") - -local projFile = File("t3mp.tview") -if(projFile:exists()) then - projFile:delete() -end - -proj = Project { - file = "t3mp.tview", - clean = true -} - -l1 = Layer{ - project = proj, - name = "csAC", - file = "../data/cs_ac/csAC.shp" -} - --------------------------------------------------------------- --- LuccME Model -- --------------------------------------------------------------- - -import("luccme") - -dofile("lab1_submodel.lua") - - --------------------------------------------------------------- --- LuccME APPLICATION MODEL DEFINITION -- --------------------------------------------------------------- -Lab1 = LuccMEModel -{ - name = "Lab1", - - ----------------------------------------------------- - -- Temporal dimension definition -- - ----------------------------------------------------- - startTime = 2008, - endTime = 2014, - - ----------------------------------------------------- - -- Spatial dimension definition -- - ----------------------------------------------------- - cs = CellularSpace - { - project = proj, - layer = "csAC", - xy = { "col", "row" }, - cellArea = 25, - }, - - - ----------------------------------------------------- - -- Land use variables definition -- - ----------------------------------------------------- - landUseTypes = - { - "f", "d", "outros" - }, - - landUseNoData = "outros", - - ----------------------------------------------------- - -- Behaviour dimension definition: -- - -- DEMAND, POTENTIAL AND ALLOCATION COMPONENTS -- - ----------------------------------------------------- - demand = D1, - potential = P1, - allocation = A1, - - save = - { - outputTheme = "Lab1_", - mode = "multiple", - saveYears = {2014}, - saveAttrs = - { - "d_out", - }, - - }, - - isCoupled = false -} -- END LuccME application model definition - ------------------------------------------------------ --- ENVIROMMENT DEFINITION -- ------------------------------------------------------ -timer = Timer -{ - Event - { - start = Lab1.startTime, - action = function(event) - Lab1:run(event) - - end - }, - - Event - { - start = Lab1.startTime, - action = function(event) - -- Após computePotential, adicione: -if (event:getTime() == 2009) then - local count = 0 - local sum_pot = 0 - for k, cell in pairs(Lab1.cs.cells) do - if count < 5 then - print(string.format("Cell %d: f_pot=%.4f, d_pot=%.4f", k, cell['f_pot'], cell['d_pot'])) - count = count + 1 - end - sum_pot = sum_pot + cell['d_pot'] - end - print(string.format("Mean d_pot: %.4f", sum_pot / #Lab1.cs.cells)) -end - - end - }, - - Event{ - start = Lab1.startTime, - action = Map{ - target = Lab1.cs, - select = "f", - min = 0.0, - max = 1.0, - grouping = 'equalsteps', - slices = 5, - color = "Greens" - }} -} - -env_Lab1 = Environment{} -env_Lab1:add(timer) - ------------------------------------------------------ --- ENVIROMMENT EXECUTION -- ------------------------------------------------------ -if Lab1.isCoupled == false then - tsave = databaseSave(Lab1) - env_Lab1:add(tsave) - env_Lab1:run(Lab1.endTime) - --saveSingleTheme(Lab1, true) - projFile = File("t3mp.tview") - if(projFile:exists()) then - projFile:delete() - end -end diff --git a/benchmark/reference/lab1_submodel.lua b/benchmark/reference/lab1_submodel.lua deleted file mode 100644 index a8eb994..0000000 --- a/benchmark/reference/lab1_submodel.lua +++ /dev/null @@ -1,100 +0,0 @@ --------------------------------------------------------------- --- This file contains the COMPONENTS definition -- --- Compatible with LuccME 3.1 -- --- Generated with LuccMe Model Configurator -- --- 25/09/2017 at 11:57:26 -- --------------------------------------------------------------- - ------------------------------------------------------ --- Demand -- ------------------------------------------------------ -D1 = DemandPreComputedValues -{ - annualDemand = - { - -- "f", "d", "outros" - {137878.1691, 19982.62882, 6489.202049}, -- 2008 - {137622.2199, 20238.57805, 6489.202049}, -- 2009 - {137366.2707, 20494.52729, 6489.202049}, -- 2010 - {137110.3214, 20750.47652, 6489.202049}, -- 2011 - {136824.6853, 21036.11265, 6489.202049}, -- 2012 - {136539.0492, 21321.74879, 6489.202049}, -- 2013 - {136253.4130, 21607.38493, 6489.202049} -- 2014 - } -} - ------------------------------------------------------ --- Potential -- ------------------------------------------------------ -P1 = PotentialCLinearRegression -{ - potentialData = - { - -- Region 1 - { - -- f - { - isLog = false, - const = 0.7392, - - betas = - { - assentamen = -0.2193, - uc_us = 0.1754, - uc_pi = 0.09708, - ti = 0.1207, - dist_riobr = 0.0000002388, - fertilidad = -0.1313 - } - }, - - -- d - { - isLog = false, - const = 0.267, - - betas = - { - rodovias = -0.0000009922, - assentamen = 0.2294, - uc_us = -0.09867, - dist_riobr = -0.0000003216, - fertilidad = 0.1281 - } - }, - - -- outros - { - isLog = false, - const = 0, - - betas = - { - - } - } - } - } -} - ------------------------------------------------------ --- Allocation -- ------------------------------------------------------ -A1 = AllocationCClueLike -{ - maxDifference = 1643, - maxIteration = 1000, - initialElasticity = 0.1, - minElasticity = 0.001, - maxElasticity = 1.5, - complementarLU = "f", - allocationData = - { - -- Region 1 - { - {static = -1, minValue = 0, maxValue = 1, minChange = 0, maxChange = 1, changeLimiarValue = 1, maxChangeAboveLimiar = 0}, -- f - {static = -1, minValue = 0, maxValue = 1, minChange = 0, maxChange = 1, changeLimiarValue = 1, maxChangeAboveLimiar = 0}, -- d - {static = 1, minValue = 0, maxValue = 1, minChange = 0, maxChange = 1, changeLimiarValue = 1, maxChangeAboveLimiar = 0}, -- outros - } - } -} diff --git a/docs/api.md b/docs/api.md index 8b454df..d2e9b06 100644 --- a/docs/api.md +++ b/docs/api.md @@ -140,9 +140,21 @@ AllocationClueLike( min_elasticity: float = 0.001, max_elasticity: float = 1.5, allocation_data: list[AllocationSpec] | None = None, # min/max per class, in land_use_types order + cell_correction: bool = True, # False reproduces TerraME (see below) ) ``` +> `cell_correction=True` (default) runs `_correct_cell_change`, which brings +> each cell's classes back to a total of 1. LuccME meant to do the same, but its +> `correctCellChange` never runs (the guard reads `cell.regionregionAloc`, a typo, +> in `AllocationCClueLike.lua`). So the default is the intended algorithm and +> differs from TerraME; `cell_correction=False` reproduces TerraME year by year +> (`tests/test_goldens_per_year.py`). +> +> After a run, `iterations_per_step` lists the convergence-loop iterations of +> each step, same meaning as LuccME's "Number of iterations" (0 = first +> allocation accepted). + > `max_difference` has to be calibrated to the scenario's scale -- the > default (1643) is the value used in the real Lab1 (~900k ha). In a > synthetic scenario with 900 cells, using the default never triggers @@ -176,6 +188,10 @@ AllocationDClueSLike( Optional `tau_` arrays in the backend act as per-cell/class attraction/repulsion; if absent, `tau=0` (default behavior). +After a run, `iterations_per_step` lists the convergence-loop iterations of +each step (the largest `n` in LuccME's `Iteration -> n` log; 0 = first pass +accepted). It matches TerraME in every year of `lab15_md10` (0, 67, 56, 56, 61, 61). + --- ## Validation diff --git a/docs/decisions.md b/docs/decisions.md index a340730..d78a75a 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -981,3 +981,40 @@ the dead `no_data` code in `allocation/clue.py`, now also fixed in the one document a student would read *before* the source, making it more likely to mislead, not less. Corrected the parameter comment in `api.md` to describe the actual behavior. + +## Reference data moved to LambdaGeo/terrame-docker; year-by-year goldens; `cell_correction` + +**Where the references live.** `benchmark/reference/*.lua` and +`benchmark/data/*.zip` left this repository. The scripts (unchanged, byte for +byte, under their original names `lab1_*`/`lab6_*`) and the original TerraME +outputs now live in [LambdaGeo/terrame-docker](https://github.com/LambdaGeo/terrame-docker) +(`benchmark/references/`), next to the Docker image (TerraME 2.0.1 + LuccME +6244dd4) and the generator that produces year-by-year goldens. Here, +`benchmark/goldens/` keeps only the generated results, so tests run without +Docker. The two former zips are the last year of `lab01_md1643` and +`lab15_md10` (max difference 5e-13 and 0); every validation number in +`docs/validation.md` is unchanged (Lab1 MAE 0.0035832335619404 vs +0.0035832335619406 before). + +terrame-docker (v0.1.0) has goldens for all 21 functional labs of the LuccME +package, with the package's numbering; this repository keeps only the four its +tests use and adds others together with the component and test that need them +(not every LuccME algorithm will be ported). In the package +labs the allocation is accepted at the first pass every year (0 iterations), +so only `lab01_md1643`/`lab15_md10` exercise the convergence loop. + +**Discrete: convergence confirmed.** Year by year, `AllocationDClueSLike` +matches TerraME's iteration count (0, 67, 56, 56, 61, 61) and `d_out`/`d_pot` +exactly. This is the check the Lab15 discriminance warning asked for. + +**Continuous: the Lab1 MAE has one cause, and it is a TerraME bug.** The drift +starts in 2009, a year with 0 iterations on both sides and identical `d_pot`. +LuccME's `correctCellChange` never runs: its guard reads +`if (cell.regionregionAloc == rNumber)` (`AllocationCClueLike.lua:503`, a typo +for `regionAloc`), always false (`CClueLikeSaturation` spells it correctly). +Decision: keep the intended algorithm. `AllocationClueLike` gains +`cell_correction: bool = True`; `False` skips `_correct_cell_change` and +reproduces TerraME year by year, iteration counts included (0, 0, 8, 26, 18, +17, 17; MAE < 1e-7). The tests against the continuous goldens use `False`; +`test_lab1_default_cell_correction_deviates_from_terrame` pins the default's +deviation. Both allocations also record `iterations_per_step`. diff --git a/docs/validation.md b/docs/validation.md index fc40da0..c7c7367 100644 --- a/docs/validation.md +++ b/docs/validation.md @@ -8,8 +8,12 @@ TerraME/LuccME reference -- not just "runs without error". Real data: `data/input/csAC.zip` (shapefile, 6,574 cells) + `data/input/examples_demand_lab1.csv`, both originally from `disslucc-continuous`. Real calibrated regression coefficients (not -synthetic). Reference: `benchmark/data/LUCCME_Lab1_2014.zip` -(`disslucc-continuous`). +synthetic). Reference: the last year (2014) of the golden +`benchmark/goldens/lab01_md1643` -- the same values as the former +`benchmark/data/LUCCME_Lab1_2014.zip` from `disslucc-continuous` (max +difference 5e-13), now kept together with its generating scripts in +[LambdaGeo/terrame-docker](https://github.com/LambdaGeo/terrame-docker) +(`benchmark/references/lab01_md1643/`). Method: raster grid built via direct `row`/`col` mapping (each shapefile polygon already knows its position in the original grid -- @@ -37,11 +41,20 @@ Reproduce: `examples/run_lab1_validation.py`. Provenance: the original LuccME scripts that generated this reference (`Lab1`, `maxDifference=1643`) are vendored at -`benchmark/reference/lab1_main.lua` + `lab1_submodel.lua`. These are +terrame-docker's `benchmark/references/lab01_md1643/` (`lab1_main.lua` + +`lab1_submodel.lua`, with the original TerraME output zip). These are **not** the same scripts as `terrame/luccme`'s public `tests/functional/lab01.lua`, which shares this scenario's coefficients and demand but declares a different `maxDifference` (5000) and did not -generate this data -- see `benchmark/reference/README.md`. +generate this data -- see `benchmark/references/README.md` there. + +**Where this MAE comes from.** All of it is one deliberate deviation: +LuccME's `correctCellChange` never runs (its guard reads +`cell.regionregionAloc`, a typo, in `AllocationCClueLike.lua`), while +disslucc runs the correction by default (`cell_correction=True`, the +intended algorithm). With `cell_correction=False`, disslucc matches TerraME +in every year and every iteration count (MAE < 1e-7, float32 noise) -- see +"Year by year" below. ## Lab15 (discrete) — deforestation, Moju region @@ -49,7 +62,10 @@ Real data: `data/input/cs_moju.zip` (shapefile, 5,914 cells), originally from `disslucc-discrete`. Real logistic regression coefficients, real transition matrix (irreversible deforestation: forest can become deforested, deforested doesn't go back to forest). Reference: -`benchmark/data/Lab15_2004.zip` (`disslucc-discrete`). +the last year (2004) of the golden `benchmark/goldens/lab15_md10` -- the +same values as the former `benchmark/data/Lab15_2004.zip` from +`disslucc-discrete` (identical), now kept with its generating scripts in +terrame-docker (`benchmark/references/lab15_md10/`). ``` Pontius & Millones -- disslucc vs TerraME, class 'd': @@ -73,13 +89,14 @@ Provenance: despite the "Lab15" label used throughout this project (inherited from `disslucc-discrete`), the script that actually generated this reference is named `Lab6` internally (`outputTheme = "Lab6_"`, `maxDifference=10`), vendored unmodified at -`benchmark/reference/lab15_main.lua` + `lab15_submodel.lua` (renamed -from the originals' `lab6_main.lua`/`lab6_submodel.lua` to match this -project's "Lab15" naming). This is **not** the same script as +terrame-docker's `benchmark/references/lab15_md10/` under their original +names `lab6_main.lua` + `lab6_submodel.lua` (this project used to keep +them as `lab15_main.lua`/`lab15_submodel.lua`, to match its "Lab15" +naming). This is **not** the same script as `terrame/luccme`'s public `tests/functional/lab15.lua`, which shares this scenario's coefficients and demand but declares a different `maxDifference` (300) and did not generate this data -- see -`benchmark/reference/README.md` for the full trace. +`benchmark/references/README.md` in terrame-docker for the full trace. ### Discriminance warning (inherited, not my own achievement) @@ -94,16 +111,44 @@ coefficients were transcribed correctly** (the deterministic part, easy to verify) -- **it is not proof that the allocation algorithm** (CLUE-S with iteration/convergence via `factor_iteration`) **is faithful** in scenarios where competition between classes really -matters. Proving that would require comparing the iteration count per -step against the TerraME log (`disslucc-discrete` documents 61-67 -iterations per step) -- not done here. +matters. Proving that requires comparing the iteration count per step +against the TerraME log -- done now, year by year, in the next section. + +## Year by year, with iteration counts + +`benchmark/goldens/` holds a copy of the goldens generated in +[LambdaGeo/terrame-docker](https://github.com/LambdaGeo/terrame-docker): +for every cell and every simulated year, `_out` and `_pot`, plus +TerraME's convergence-loop iteration count per year. terrame-docker has 23 +(the 21 functional labs of the LuccME package and the two scenarios above); +this repository keeps the four its tests use (`lab01`, `lab01_md1643`, +`lab15`, `lab15_md10`), and adds the others as their components are +implemented. +`tests/test_goldens_per_year.py` checks the iteration count per year +(exact) and every class per year (MAE < 1e-6): + +| Golden | `maxDifference` | TerraME iterations per year | disslucc | +|---|---|---|---| +| `lab15_md10` (discrete) | 10 | 0, 67, 56, 56, 61, 61 | same; `d_out`/`d_pot` identical every year | +| `lab15` (package) | 300 | 0 every year | same; identical every year | +| `lab01_md1643` (continuous) | 1643 | 0, 0, 8, 26, 18, 17, 17 | same with `cell_correction=False` (MAE < 1e-7 every year) | +| `lab01` (package) | 5000 | 0 every year | same with `cell_correction=False` | + +With the default `cell_correction=True`, `lab01_md1643` gives 0, 0, 0, 14, +17, 16, 16 iterations and drifts from 2009 on (MAE 0.003583 in 2014, the +number in the Lab1 section above). + +This closes the gap left by the Lab15 discriminance warning: the final map +alone could not tell a correct CLUE-S from a static ranking, but the +iteration counts can, and they match in every year. ## Summary | Scenario | Type | MAE | Match | What it proves | |---|---|---|---|---| -| Lab1 | continuous | 0.0036 | -- | full model (Demand+Potential+Allocation), within the official tolerance | -| Lab15 | discrete | 0.0 | 100% | correct regression coefficients; **does not** confirm CLUE-S convergence under real competition | +| Lab1 | continuous | 0.0036 | -- | full model (Demand+Potential+Allocation), within the official tolerance; the whole MAE is the cell correction that TerraME skips | +| Lab15 | discrete | 0.0 | 100% | correct regression coefficients | +| Lab1, Lab15 year by year | both | < 1e-7 | iterations exact | CLUE-S convergence confirmed; CLUE identical to TerraME with `cell_correction=False` | ## What these numbers DON'T prove: engineering validation ≠ scientific validation diff --git a/examples/run_lab15_validation.py b/examples/run_lab15_validation.py index 8eb0fd3..70d3d8a 100644 --- a/examples/run_lab15_validation.py +++ b/examples/run_lab15_validation.py @@ -33,10 +33,12 @@ from disslucc.validation.pontius import confusion_metrics, pontius_millones ROOT = Path(__file__).resolve().parent.parent -# Both zips are read directly -- GDAL opens a single-layer shapefile zip +# The input zip is read directly -- GDAL opens a single-layer shapefile zip # without manual extraction, same as the tests in disslucc-discrete do. CS_MOJU_ZIP = ROOT / "data" / "input" / "cs_moju.zip" -TERRAME_ZIP = ROOT / "benchmark" / "data" / "Lab15_2004.zip" +# TerraME reference: golden lab15_md10, last year = 2004 (generated with +# LambdaGeo/terrame-docker; formerly benchmark/data/Lab15_2004.zip). +GOLDEN_CSV = ROOT / "benchmark" / "goldens" / "lab15_md10" / "lab15_md10.csv.gz" LAND_USE_TYPES = ["f", "d", "o"] N_STEPS = 6 @@ -114,7 +116,8 @@ def build_backend_by_rowcol(gdf: gpd.GeoDataFrame) -> tuple[RasterBackend, np.nd # ── 3. compare cell by cell against the real TerraME reference ─────────────── -terrame = gpd.read_file(TERRAME_ZIP) +golden = pd.read_csv(GOLDEN_CSV) +terrame = golden[golden["year"] == golden["year"].max()].rename(columns={"row": "lin"}) ours_df = pd.DataFrame({ "lin": rows, "col": cols, "d_ours": backend.get("d")[rows, cols], diff --git a/examples/run_lab1_validation.py b/examples/run_lab1_validation.py index 3741c0d..401990b 100644 --- a/examples/run_lab1_validation.py +++ b/examples/run_lab1_validation.py @@ -1,7 +1,8 @@ """ Real validation: runs disslucc (ours, raster-only) over the real Lab1 scenario and compares cell by cell against the TerraME reference -(benchmark/data/LUCCME_Lab1_2014.zip from disslucc-continuous), using +(benchmark/goldens/lab01_md1643, last year = 2014, generated with +LambdaGeo/terrame-docker; formerly benchmark/data/LUCCME_Lab1_2014.zip), using the continuous Pontius & Millones decomposition (disslucc.validation.pontius). @@ -16,13 +17,11 @@ """ from __future__ import annotations -import os -import tempfile -import zipfile from pathlib import Path import geopandas as gpd import numpy as np +import pandas as pd from dissmodel.core import Environment from dissmodel.geo.raster.backend import RasterBackend @@ -37,7 +36,7 @@ ROOT = Path(__file__).resolve().parent.parent CSAC_ZIP = ROOT / "data" / "input" / "csAC.zip" -TERRAME_ZIP = ROOT / "benchmark" / "data" / "LUCCME_Lab1_2014.zip" +GOLDEN_CSV = ROOT / "benchmark" / "goldens" / "lab01_md1643" / "lab01_md1643.csv.gz" DEMAND_CSV = ROOT / "data" / "input" / "examples_demand_lab1.csv" LAND_USE_TYPES = ["f", "d", "outros"] @@ -67,17 +66,10 @@ def build_backend_by_rowcol(gdf: gpd.GeoDataFrame) -> tuple[RasterBackend, np.nd return backend, rows, cols -def load_terrame_reference(zip_path: Path) -> gpd.GeoDataFrame: - with zipfile.ZipFile(zip_path) as z, z.open("Lab1_2014.dbf") as f: - data = f.read() - with tempfile.NamedTemporaryFile(suffix=".dbf", delete=False) as tmp: - tmp.write(data) - tmp_path = tmp.name - try: - gdf = gpd.read_file(tmp_path) - finally: - os.unlink(tmp_path) - return gdf +def load_terrame_reference(golden_csv: Path) -> pd.DataFrame: + """TerraME's final year (row, col, d_out) from the golden.""" + golden = pd.read_csv(golden_csv) + return golden[golden["year"] == golden["year"].max()] # ── 1. real data + grid aligned by row/col ──────────────────────────────────── @@ -128,7 +120,7 @@ def load_terrame_reference(zip_path: Path) -> gpd.GeoDataFrame: # ── 3. compare cell by cell against the real TerraME reference ─────────────── -terrame = load_terrame_reference(TERRAME_ZIP) +terrame = load_terrame_reference(GOLDEN_CSV) terrame_row = terrame["row"].astype(int).values terrame_col = terrame["col"].astype(int).values terrame_d = terrame["d_out"].astype(float).values @@ -137,7 +129,6 @@ def load_terrame_reference(zip_path: Path) -> gpd.GeoDataFrame: # align by (row,col) -- csAC and the TerraME reference may not be in # the same row order, so join by key, not by position -import pandas as pd ours_df = pd.DataFrame({"row": rows, "col": cols, "d_ours": our_d}).set_index(["row", "col"]) terrame_df = pd.DataFrame({"row": terrame_row, "col": terrame_col, "d_terrame": terrame_d}).set_index(["row", "col"]) diff --git a/pyproject.toml b/pyproject.toml index 98c084f..12a8b95 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "disslucc" -version = "0.3.0" +version = "0.4.0" description = "Land Use and Cover Change (LUCC) modeling — continuous and discrete allocation — on top of dissmodel." readme = "README.md" authors = [{ name = "Sergio Souza Costa", email = "sergio@ufma.br" }] diff --git a/src/disslucc/components/allocation/clue.py b/src/disslucc/components/allocation/clue.py index ca7b772..47a9612 100644 --- a/src/disslucc/components/allocation/clue.py +++ b/src/disslucc/components/allocation/clue.py @@ -13,6 +13,14 @@ (not via a Potential method) -- that's how main does it; the indirection through PotentialProtocol.get_potential() was only on decoupling. + +Deviation from TerraME: LuccME's correctCellChange never runs. Its guard +is `if (cell.regionregionAloc == rNumber)` (AllocationCClueLike.lua:503, +a typo for `regionAloc`), which is always false. `_correct_cell_change` +implements what that step was meant to do and runs by default +(`cell_correction=True`). With `cell_correction=False` this component +reproduces TerraME year by year, iteration counts included +(tests/test_goldens_per_year.py). """ from __future__ import annotations @@ -48,6 +56,7 @@ def setup( min_elasticity: float = 0.001, max_elasticity: float = 1.5, allocation_data: list[AllocationSpec] | None = None, + cell_correction: bool = True, ) -> None: super().setup(backend) self.demand = demand @@ -61,6 +70,11 @@ def setup( self.initial_elasticity = initial_elasticity self.min_elasticity = min_elasticity self.max_elasticity = max_elasticity + # False reproduces TerraME, where correctCellChange never runs (see module docstring). + self.cell_correction = cell_correction + # Iterations of the convergence loop at each step, same meaning as + # LuccME's "Number of iterations" (0 = first allocation accepted). + self.iterations_per_step: list[int] = [] default = AllocationSpec() self.allocation_data = ( @@ -85,10 +99,12 @@ def execute(self) -> None: while True: if step != 0: self._compute_change(elasticity) - self._correct_cell_change() + if self.cell_correction: + self._correct_cell_change() max_diff = self._compare_to_demand(step, elasticity) if max_diff <= max_adjust: + self.iterations_per_step.append(n_iter) break n_iter += 1 diff --git a/src/disslucc/components/allocation/clue_s.py b/src/disslucc/components/allocation/clue_s.py index 03dc785..f64cda9 100644 --- a/src/disslucc/components/allocation/clue_s.py +++ b/src/disslucc/components/allocation/clue_s.py @@ -58,6 +58,9 @@ def setup( self.max_iteration = max_iteration self.factor_iteration = factor_iteration self.region_attr = region_attr + # Iterations of the convergence loop at each step, same meaning as + # the largest n in LuccME's "Iteration -> n" log (0 = first pass accepted). + self.iterations_per_step: list[int] = [] # (n_regions, n_lu, n_lu) -- O(1) access in the inner loop self._tm = np.array(transition_matrix, dtype=np.int8) @@ -121,6 +124,7 @@ def execute(self) -> None: max_diff = max(abs(v) for v in diff.values()) if max_diff <= self.max_difference: + self.iterations_per_step.append(n_iter) break if n_iter >= self.max_iteration: raise RuntimeError( diff --git a/tests/_golden_helpers.py b/tests/_golden_helpers.py new file mode 100644 index 0000000..bbf7d02 --- /dev/null +++ b/tests/_golden_helpers.py @@ -0,0 +1,79 @@ +""" +tests/_golden_helpers.py +-------------------------- +Per-year comparison against the LuccME goldens in benchmark/goldens/ +(generated with LambdaGeo/terrame-docker; see benchmark/README.md). + +A golden holds, for every cell and every simulated year, `_out` and +`_pot`, plus the TerraME iteration count per year in manifest.json. +`YearRecorder` snapshots the same arrays from the disslucc backend at the end +of each step, so both sides can be compared year by year. +""" +from __future__ import annotations + +import json +from pathlib import Path + +import numpy as np +import pandas as pd +from dissmodel.core import Model + +ROOT = Path(__file__).resolve().parent.parent +GOLDENS = ROOT / "benchmark" / "goldens" + + +def golden_available(name: str) -> bool: + return (GOLDENS / name / f"{name}.csv.gz").exists() + + +def load_golden(name: str) -> tuple[pd.DataFrame, dict]: + """Golden table (year, id, col, row, _out, _pot) and its manifest.""" + df = pd.read_csv(GOLDENS / name / f"{name}.csv.gz") + manifest = json.loads((GOLDENS / name / "manifest.json").read_text()) + return df, manifest + + +def golden_iterations(manifest: dict) -> list[int]: + """TerraME iterations per year, in year order.""" + it = manifest["iterations_per_year"] + return [it[y] for y in sorted(it)] + + +class YearRecorder(Model): + """Snapshots `` and `_pot` at every step. Create it AFTER the + allocation component so it runs after it in each step.""" + + def setup(self, backend, rows: np.ndarray, cols: np.ndarray, land_use_types: list[str]) -> None: + self.backend = backend + self.rows, self.cols = rows, cols + self.land_use_types = land_use_types + self.snapshots: list[dict[str, np.ndarray]] = [] + + def execute(self) -> None: + snap = {} + for lu in self.land_use_types: + snap[f"{lu}_out"] = np.asarray(self.backend.get(lu), dtype=np.float64)[self.rows, self.cols].copy() + if f"{lu}_pot" in self.backend.arrays: + snap[f"{lu}_pot"] = np.asarray( + self.backend.get(f"{lu}_pot"), dtype=np.float64)[self.rows, self.cols].copy() + self.snapshots.append(snap) + + +def per_year_frame(recorder: YearRecorder, years: list[int]) -> pd.DataFrame: + """Recorder snapshots as a long table keyed by (year, row, col).""" + frames = [] + for year, snap in zip(years, recorder.snapshots): + f = pd.DataFrame(snap) + f["year"], f["row"], f["col"] = year, recorder.rows, recorder.cols + frames.append(f) + return pd.concat(frames).set_index(["year", "row", "col"]).sort_index() + + +def per_year_mae(ours: pd.DataFrame, golden: pd.DataFrame, column: str) -> dict[int, float]: + """MAE of `column` per year, cells aligned by (row, col).""" + ref = golden.set_index(["year", "row", "col"])[column] + joined = ours[[column]].join(ref.rename("ref"), how="inner") + return { + int(year): float(np.abs(g[column] - g["ref"]).mean()) + for year, g in joined.groupby(level="year") + } diff --git a/tests/_lab15_helpers.py b/tests/_lab15_helpers.py index fa3ea78..8a3894d 100644 --- a/tests/_lab15_helpers.py +++ b/tests/_lab15_helpers.py @@ -12,6 +12,7 @@ import geopandas as gpd import numpy as np +import pandas as pd from dissmodel.core import Environment from dissmodel.geo.raster.backend import RasterBackend @@ -25,7 +26,10 @@ ROOT = Path(__file__).resolve().parent.parent CS_MOJU_ZIP = ROOT / "data" / "input" / "cs_moju.zip" -TERRAME_ZIP = ROOT / "benchmark" / "data" / "Lab15_2004.zip" +# TerraME reference: golden lab15_md10 (benchmark/goldens/, generated in +# LambdaGeo/terrame-docker). Its last year is the former +# benchmark/data/Lab15_2004.zip (identical). +GOLDEN_CSV = ROOT / "benchmark" / "goldens" / "lab15_md10" / "lab15_md10.csv.gz" LAND_USE_TYPES = ["f", "d", "o"] N_STEPS = 6 @@ -52,7 +56,7 @@ TRANSITION_MATRIX = [[[1, 1, 0], [0, 1, 0], [0, 0, 1]]] # irreversible deforestation -data_available = CS_MOJU_ZIP.exists() and TERRAME_ZIP.exists() +data_available = CS_MOJU_ZIP.exists() and GOLDEN_CSV.exists() def build_backend_by_rowcol(gdf: gpd.GeoDataFrame) -> tuple[RasterBackend, np.ndarray, np.ndarray]: @@ -78,8 +82,14 @@ def load_gdf_input() -> gpd.GeoDataFrame: return gpd.read_file(CS_MOJU_ZIP) -def load_gdf_terrame() -> gpd.GeoDataFrame: - return gpd.read_file(TERRAME_ZIP) +def load_gdf_terrame() -> pd.DataFrame: + """TerraME's final year (2004) as a table (lin, col, d_out), in the same + row order as the input shapefile. The golden calls `lin` `row`.""" + golden = pd.read_csv(GOLDEN_CSV) + final = golden[golden["year"] == golden["year"].max()][["row", "col", "d_out"]] + final = final.rename(columns={"row": "lin"}) + cells = load_gdf_input()[["lin", "col"]].astype(int) + return cells.merge(final, on=["lin", "col"], how="left", validate="one_to_one") def run_lab15_raster( @@ -111,8 +121,6 @@ def run_lab15_raster( def metrics_vs_terrame(backend: RasterBackend, rows: np.ndarray, cols: np.ndarray) -> dict: """Pontius & Millones decomposition plus confusion metrics for class 'd', aligned against the real TerraME reference.""" - import pandas as pd - terrame = load_gdf_terrame() ours_df = pd.DataFrame({ "lin": rows, "col": cols, "d_ours": backend.get("d")[rows, cols], diff --git a/tests/_lab1_helpers.py b/tests/_lab1_helpers.py index ce5ad1f..9c7abb3 100644 --- a/tests/_lab1_helpers.py +++ b/tests/_lab1_helpers.py @@ -8,9 +8,6 @@ """ from __future__ import annotations -import os -import tempfile -import zipfile from pathlib import Path import geopandas as gpd @@ -30,7 +27,10 @@ ROOT = Path(__file__).resolve().parent.parent CSAC_ZIP = ROOT / "data" / "input" / "csAC.zip" -TERRAME_ZIP = ROOT / "benchmark" / "data" / "LUCCME_Lab1_2014.zip" +# TerraME reference: golden lab01_md1643 (benchmark/goldens/, generated in +# LambdaGeo/terrame-docker). Its last year is the former +# benchmark/data/LUCCME_Lab1_2014.zip (max difference 5e-13). +GOLDEN_CSV = ROOT / "benchmark" / "goldens" / "lab01_md1643" / "lab01_md1643.csv.gz" DEMAND_CSV = ROOT / "data" / "input" / "examples_demand_lab1.csv" LAND_USE_TYPES = ["f", "d", "outros"] @@ -63,7 +63,7 @@ AllocationSpec(static=1, min_value=0, max_value=1, min_change=0, max_change=1), ] -data_available = CSAC_ZIP.exists() and TERRAME_ZIP.exists() and DEMAND_CSV.exists() +data_available = CSAC_ZIP.exists() and GOLDEN_CSV.exists() and DEMAND_CSV.exists() def build_backend_by_rowcol(gdf: gpd.GeoDataFrame) -> tuple[RasterBackend, np.ndarray, np.ndarray]: @@ -87,17 +87,13 @@ def build_backend_by_rowcol(gdf: gpd.GeoDataFrame) -> tuple[RasterBackend, np.nd return backend, rows, cols -def load_terrame_reference(zip_path: Path = TERRAME_ZIP) -> gpd.GeoDataFrame: - with zipfile.ZipFile(zip_path) as z, z.open("Lab1_2014.dbf") as f: - data = f.read() - with tempfile.NamedTemporaryFile(suffix=".dbf", delete=False) as tmp: - tmp.write(data) - tmp_path = tmp.name - try: - gdf = gpd.read_file(tmp_path) - finally: - os.unlink(tmp_path) - return gdf +def load_terrame_reference(golden_csv: Path = GOLDEN_CSV) -> pd.DataFrame: + """TerraME's final year (2014) as a table (row, col, d_out), in the same + row order as the input shapefile.""" + golden = pd.read_csv(golden_csv) + final = golden[golden["year"] == golden["year"].max()][["row", "col", "d_out"]] + cells = gpd.read_file(CSAC_ZIP)[["row", "col"]].astype(int) + return cells.merge(final, on=["row", "col"], how="left", validate="one_to_one") def full_metrics(pred: np.ndarray, ref: np.ndarray, tolerance: float = TOLERANCE) -> dict: diff --git a/tests/test_goldens_per_year.py b/tests/test_goldens_per_year.py new file mode 100644 index 0000000..e8a0761 --- /dev/null +++ b/tests/test_goldens_per_year.py @@ -0,0 +1,151 @@ +""" +tests/test_goldens_per_year.py +-------------------------------- +Year-by-year comparison against the LuccME goldens in benchmark/goldens/ +(TerraME 2.0.1 + LuccME 6244dd4, generated with LambdaGeo/terrame-docker). + +For each scenario, every simulated year is checked, not only the last one: + * the convergence-loop iteration count per year must equal TerraME's + (an integer that is very sensitive to the loop: elasticity/iter_vec updates); + * `_out` and `_pot` of every class must match (MAE per year < 1e-6; + what remains is float32 noise, ~1e-8). + +Scenarios: the package labs (lab01: maxDifference 5000, lab15: 300), whose +allocation is accepted at the first pass every year, and the variants +lab01_md1643 / lab15_md10 (terrame-docker's benchmark/references/), which iterate +8-26 and 56-67 times per year and so exercise the convergence loop. + +Continuous (CClueLike): LuccME's correctCellChange never runs. Its guard is +`if (cell.regionregionAloc == rNumber)` (AllocationCClueLike.lua:503, a typo for +regionAloc), which is always false. disslucc runs the correction by default +(`cell_correction=True`, the intended algorithm); with `cell_correction=False` it +reproduces TerraME in every year and every iteration count, which is what the +comparison tests below use. +""" +from __future__ import annotations + +import _lab1_helpers as L1 +import _lab15_helpers as L15 +import geopandas as gpd +import pytest +from _golden_helpers import ( + YearRecorder, + golden_available, + golden_iterations, + load_golden, + per_year_frame, + per_year_mae, +) +from dissmodel.core import Environment + +from disslucc import ( + AllocationClueLike, + AllocationDClueSLike, + DemandPreComputedValues, + PotentialDLogisticRegression, + PotentialLinearRegression, +) +from disslucc.components.demand import load_demand_csv + +MAE_TOL = 1e-6 + + +def run_lab1(max_difference: float, cell_correction: bool): + gdf = gpd.read_file(L1.CSAC_ZIP) + backend, rows, cols = L1.build_backend_by_rowcol(gdf) + annual_demand = load_demand_csv(L1.DEMAND_CSV.read_text(), L1.LAND_USE_TYPES) + env = Environment(end_time=L1.N_STEPS - 1) + + demand = DemandPreComputedValues(annual_demand=annual_demand, land_use_types=L1.LAND_USE_TYPES) + potential = PotentialLinearRegression( + backend=backend, demand=demand, land_use_types=L1.LAND_USE_TYPES, + land_use_no_data="outros", potential_data=L1.DEFAULT_POTENTIAL_DATA, + ) + allocation = AllocationClueLike( + backend=backend, demand=demand, potential=potential, + land_use_types=L1.LAND_USE_TYPES, + static={"f": -1, "d": -1, "outros": 1}, + complementar_lu="f", cell_area=L1.CELL_AREA, + allocation_data=L1.DEFAULT_ALLOCATION_DATA, + max_difference=max_difference, + cell_correction=cell_correction, + ) + recorder = YearRecorder(backend=backend, rows=rows, cols=cols, land_use_types=L1.LAND_USE_TYPES) + env.run() + return allocation, per_year_frame(recorder, list(range(2008, 2015))) + + +def run_lab15(max_difference: float): + gdf = L15.load_gdf_input() + backend, rows, cols = L15.build_backend_by_rowcol(gdf) + env = Environment(end_time=len(L15.ANNUAL_DEMAND) - 1) + + demand = DemandPreComputedValues(annual_demand=L15.ANNUAL_DEMAND, land_use_types=L15.LAND_USE_TYPES) + PotentialDLogisticRegression( + backend=backend, potential_data=L15.DEFAULT_POTENTIAL_DATA, land_use_types=L15.LAND_USE_TYPES, + ) + allocation = AllocationDClueSLike( + backend=backend, demand=demand, land_use_types=L15.LAND_USE_TYPES, + transition_matrix=L15.TRANSITION_MATRIX, cell_area=L15.CELL_AREA, + max_difference=max_difference, max_iteration=1000, factor_iteration=0.0001, + ) + recorder = YearRecorder(backend=backend, rows=rows, cols=cols, land_use_types=L15.LAND_USE_TYPES) + env.run() + return allocation, per_year_frame(recorder, list(range(1999, 2005))) + + +def assert_matches_golden(name: str, allocation, ours) -> None: + golden, manifest = load_golden(name) + + assert allocation.iterations_per_step == golden_iterations(manifest), ( + f"{name}: iterations per year differ from TerraME -- " + f"disslucc {allocation.iterations_per_step}, TerraME {golden_iterations(manifest)}" + ) + for column in ours.columns: + mae = per_year_mae(ours, golden, column) + worst_year = max(mae, key=lambda y: mae[y]) + assert mae[worst_year] < MAE_TOL, ( + f"{name}: {column} diverges from TerraME, first in " + f"{min(y for y, v in mae.items() if v >= MAE_TOL)} (MAE per year: {mae})" + ) + + +# ── discrete (CLUE-S-like) ──────────────────────────────────────────────────── + +@pytest.mark.skipif(not L15.data_available, reason="Lab15 input data not found") +@pytest.mark.parametrize("name, max_difference", [("lab15", 300.0), ("lab15_md10", 10.0)]) +def test_lab15_matches_terrame_every_year(name: str, max_difference: float) -> None: + if not golden_available(name): + pytest.skip(f"golden {name} not found") + allocation, ours = run_lab15(max_difference) + assert_matches_golden(name, allocation, ours) + + +# ── continuous (CLUE-like) ──────────────────────────────────────────────────── + +@pytest.mark.skipif(not L1.data_available, reason="Lab1 input data not found") +@pytest.mark.parametrize("name, max_difference", [("lab01", 5000.0), ("lab01_md1643", 1643.0)]) +def test_lab1_matches_terrame_every_year_without_cell_correction(name: str, max_difference: float) -> None: + if not golden_available(name): + pytest.skip(f"golden {name} not found") + allocation, ours = run_lab1(max_difference, cell_correction=False) + assert_matches_golden(name, allocation, ours) + + +@pytest.mark.skipif(not L1.data_available, reason="Lab1 input data not found") +def test_lab1_default_cell_correction_deviates_from_terrame() -> None: + """Characterisation, not a requirement: the default (`cell_correction=True`, + the intended algorithm) deliberately differs from TerraME, which never runs + correctCellChange. Pins the size of that deviation so a change to the + correction step, or to the default, does not go unnoticed. The final-year + numbers are the ones in docs/validation.md (MAE 0.003583).""" + if not golden_available("lab01_md1643"): + pytest.skip("golden lab01_md1643 not found") + allocation, ours = run_lab1(1643.0, cell_correction=True) + golden, _ = load_golden("lab01_md1643") + + assert allocation.iterations_per_step == [0, 0, 0, 14, 17, 16, 16] + mae = per_year_mae(ours, golden, "d_out") + assert mae[2008] == pytest.approx(0.0, abs=MAE_TOL) + assert mae[2009] > MAE_TOL # the correction acts from the first year with change + assert mae[2014] == pytest.approx(0.003583, abs=5e-7)