From b99affc29f4664c4b9e717ee8f76b8f2777a34b7 Mon Sep 17 00:00:00 2001 From: florianh Date: Mon, 4 Nov 2024 06:15:13 +0100 Subject: [PATCH 01/31] Tol_Feas_Min = 3.e-13 --- modules/80_optimization/lp_nlp_apr17/solve.gms | 1 + modules/80_optimization/nlp_apr17/solve.gms | 1 + modules/80_optimization/nlp_par/solve.gms | 1 + 3 files changed, 3 insertions(+) diff --git a/modules/80_optimization/lp_nlp_apr17/solve.gms b/modules/80_optimization/lp_nlp_apr17/solve.gms index c3250b566..bca87a9b3 100644 --- a/modules/80_optimization/lp_nlp_apr17/solve.gms +++ b/modules/80_optimization/lp_nlp_apr17/solve.gms @@ -36,6 +36,7 @@ $endif $onecho > conopt4.opt Lim_Variable = 1.e25 +Tol_Feas_Min = 3.e-13 $offecho $onecho > conopt4.op2 diff --git a/modules/80_optimization/nlp_apr17/solve.gms b/modules/80_optimization/nlp_apr17/solve.gms index 7dc3b1198..ce482ee04 100644 --- a/modules/80_optimization/nlp_apr17/solve.gms +++ b/modules/80_optimization/nlp_apr17/solve.gms @@ -20,6 +20,7 @@ magpie.holdfixed = 1 ; $onecho > conopt4.opt Lim_Variable = 1.e25 +Tol_Feas_Min = 3.e-13 $offecho $onecho > conopt4.op2 diff --git a/modules/80_optimization/nlp_par/solve.gms b/modules/80_optimization/nlp_par/solve.gms index 60d888a72..d63421378 100644 --- a/modules/80_optimization/nlp_par/solve.gms +++ b/modules/80_optimization/nlp_par/solve.gms @@ -23,6 +23,7 @@ magpie.savepoint = 0; $onecho > conopt4.opt Lim_Variable = 1.e25 +Tol_Feas_Min = 3.e-13 $offecho $onecho > conopt4.op2 From b86f689f565e91a2e3655afe5fa2b1983cd7b703 Mon Sep 17 00:00:00 2001 From: florianh Date: Mon, 4 Nov 2024 06:18:46 +0100 Subject: [PATCH 02/31] update --- scripts/projects/fsec.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/projects/fsec.R b/scripts/projects/fsec.R index f7f3302ba..78dd0490e 100644 --- a/scripts/projects/fsec.R +++ b/scripts/projects/fsec.R @@ -226,7 +226,7 @@ fsecScenario <- function(scenario) { "rds_report") cfg$force_download <- TRUE cfg$gms$s80_optfile <- 0 - cfg$gms$s80_maxiter <- 100 + cfg$gms$s80_maxiter <- 30 return(cfg) } From 141a0bcf7e962aeb66e57ae67b3d76838a746007 Mon Sep 17 00:00:00 2001 From: florianh Date: Mon, 4 Nov 2024 09:39:08 +0100 Subject: [PATCH 03/31] test --- modules/38_factor_costs/sticky_feb18/scaling.gms | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/38_factor_costs/sticky_feb18/scaling.gms b/modules/38_factor_costs/sticky_feb18/scaling.gms index 77d624808..27fd45cc5 100644 --- a/modules/38_factor_costs/sticky_feb18/scaling.gms +++ b/modules/38_factor_costs/sticky_feb18/scaling.gms @@ -7,3 +7,4 @@ vm_cost_prod_crop.scale(i,factors) = 10e5; v38_investment_immobile.scale(j,kcr) = 10e3; +v38_capital_need.scale(j,kcr,mobil38) = 10e3; From 509595dd5b2bd8473c41d80bd154c966d20c0ded Mon Sep 17 00:00:00 2001 From: florianh Date: Mon, 4 Nov 2024 10:29:06 +0100 Subject: [PATCH 04/31] update --- modules/10_land/landmatrix_dec18/scaling.gms | 4 ++-- modules/20_processing/substitution_may21/scaling.gms | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/10_land/landmatrix_dec18/scaling.gms b/modules/10_land/landmatrix_dec18/scaling.gms index 3db083736..7698c27b8 100644 --- a/modules/10_land/landmatrix_dec18/scaling.gms +++ b/modules/10_land/landmatrix_dec18/scaling.gms @@ -6,5 +6,5 @@ *** | Contact: magpie@pik-potsdam.de vm_landdiff.scale = 10e3; -v10_balance_positive.scale(j) = 10e-10; -v10_balance_negative.scale(j) = 10e-10; +v10_balance_positive.scale(j) = 10e-9; +v10_balance_negative.scale(j) = 10e-9; diff --git a/modules/20_processing/substitution_may21/scaling.gms b/modules/20_processing/substitution_may21/scaling.gms index db58c9ae6..e6a6e99a3 100644 --- a/modules/20_processing/substitution_may21/scaling.gms +++ b/modules/20_processing/substitution_may21/scaling.gms @@ -5,6 +5,6 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -vm_secondary_overproduction.scale(i,kall,kpr) = 10e-3; +vm_secondary_overproduction.scale(i,kall,kpr) = 10e-4; vm_cost_processing.scale(i) = 10e5; vm_processing_substitution_cost.scale(i) = 10e4; From 8897503400004fc0f2e50a089d2f56f596e23fb7 Mon Sep 17 00:00:00 2001 From: florianh Date: Mon, 4 Nov 2024 22:48:43 +0100 Subject: [PATCH 05/31] update --- modules/44_biodiversity/bii_target_apr24/equations.gms | 4 ++-- modules/44_biodiversity/bii_target_apr24/preloop.gms | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/44_biodiversity/bii_target_apr24/equations.gms b/modules/44_biodiversity/bii_target_apr24/equations.gms index b7fdc1ea1..3e084c12a 100644 --- a/modules/44_biodiversity/bii_target_apr24/equations.gms +++ b/modules/44_biodiversity/bii_target_apr24/equations.gms @@ -11,14 +11,14 @@ *' Biodiversity stock weighted by range-rarity restoration prioritization layer (`f44_rr_layer`) *' The regional layer is needed for compatibility with the high resolution parallel optimization output script (scripts/output/extra/highres.R) - q44_bii(i2,biome44)$(sum(cell(i2,j2), f44_biome(j2,biome44)) > 0) .. v44_bii(i2,biome44) + q44_bii(i2,biome44)$(sum(cell(i2,j2), f44_biome(j2,biome44)*f44_rr_layer(j2)) > 1e-6) .. v44_bii(i2,biome44) =e= (sum((cell(i2,j2),potnatveg,landcover44), vm_bv(j2,landcover44,potnatveg) * f44_rr_layer(j2) * f44_biome(j2,biome44)) / sum((cell(i2,j2),land), pcm_land(j2,land) * f44_rr_layer(j2) * f44_biome(j2,biome44))); *' For each of the 71 biomes, the BII has to meet a minium level based on `s44_bii_lower_bound`. *' `v44_bii_missing` is a technical variable to maintain feasibility in case `v44_bii` cannot be increased. - q44_bii_target(i2,biome44)$(sum(cell(i2,j2), f44_biome(j2,biome44)) > 0) .. + q44_bii_target(i2,biome44)$(sum(cell(i2,j2), f44_biome(j2,biome44)*f44_rr_layer(j2)) > 1e-6) .. v44_bii(i2,biome44) + v44_bii_missing(i2,biome44) =g= sum(ct, p44_bii_lower_bound(ct,i2,biome44)); *' Costs accrue only for `v44_bii_missing`. In the best case costs should be zero or close to zero. diff --git a/modules/44_biodiversity/bii_target_apr24/preloop.gms b/modules/44_biodiversity/bii_target_apr24/preloop.gms index 2c6494fe7..5cd24279d 100644 --- a/modules/44_biodiversity/bii_target_apr24/preloop.gms +++ b/modules/44_biodiversity/bii_target_apr24/preloop.gms @@ -7,8 +7,8 @@ v44_bii.l(i,biome44) = 0.75; -v44_bii.fx(i,biome44)$(sum(cell(i,j), f44_biome(j,biome44)) = 0) = 0; -v44_bii_missing.fx(i,biome44)$(sum(cell(i,j), f44_biome(j,biome44)) = 0) = 0; +v44_bii.fx(i,biome44)$(sum(cell(i,j), f44_biome(j,biome44)*f44_rr_layer(j2)) <= 1e-6) = 0; +v44_bii_missing.fx(i,biome44)$(sum(cell(i,j), f44_biome(j,biome44)*f44_rr_layer(j2)) <= 1e-6) = 0; p44_bii_lower_bound(t,i,biome44) = 0; vm_bv.l(j,landcover44,potnatveg) = 0; From f8348d7d39a6313460eeb4f51daa4d5f264c75c7 Mon Sep 17 00:00:00 2001 From: florianh Date: Mon, 4 Nov 2024 22:59:16 +0100 Subject: [PATCH 06/31] bugfix --- modules/44_biodiversity/bii_target_apr24/preloop.gms | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/44_biodiversity/bii_target_apr24/preloop.gms b/modules/44_biodiversity/bii_target_apr24/preloop.gms index 5cd24279d..589c41bec 100644 --- a/modules/44_biodiversity/bii_target_apr24/preloop.gms +++ b/modules/44_biodiversity/bii_target_apr24/preloop.gms @@ -7,8 +7,8 @@ v44_bii.l(i,biome44) = 0.75; -v44_bii.fx(i,biome44)$(sum(cell(i,j), f44_biome(j,biome44)*f44_rr_layer(j2)) <= 1e-6) = 0; -v44_bii_missing.fx(i,biome44)$(sum(cell(i,j), f44_biome(j,biome44)*f44_rr_layer(j2)) <= 1e-6) = 0; +v44_bii.fx(i,biome44)$(sum(cell(i,j), f44_biome(j,biome44)*f44_rr_layer(j)) <= 1e-6) = 0; +v44_bii_missing.fx(i,biome44)$(sum(cell(i,j), f44_biome(j,biome44)*f44_rr_layer(j)) <= 1e-6) = 0; p44_bii_lower_bound(t,i,biome44) = 0; vm_bv.l(j,landcover44,potnatveg) = 0; From 47a8258eea81559195903e3d7eec859d64d8ad68 Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 5 Nov 2024 06:43:50 +0100 Subject: [PATCH 07/31] bugfix --- modules/44_biodiversity/bii_target_apr24/presolve.gms | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/44_biodiversity/bii_target_apr24/presolve.gms b/modules/44_biodiversity/bii_target_apr24/presolve.gms index 0a45321b2..de40ebb61 100644 --- a/modules/44_biodiversity/bii_target_apr24/presolve.gms +++ b/modules/44_biodiversity/bii_target_apr24/presolve.gms @@ -23,7 +23,7 @@ else ); p44_bii_lower_bound(t2,i,biome44)$(p44_bii_lower_bound(t2,i,biome44) >= 1) = 1; p44_bii_lower_bound(t2,i,biome44)$(m_year(t2) < s44_start_year) = 0; - p44_bii_lower_bound(t2,i,biome44)$(sum(cell(i,j), f44_biome(j,biome44)) = 0) = 0; + p44_bii_lower_bound(t2,i,biome44)$(sum(cell(i,j), f44_biome(j,biome44)**f44_rr_layer(j2)) <= 1e-6) = 0; * The lower bound of `v44_bii` is set to `p44_bii_lower_bound` to avoid a reduction of BII in combination with `v44_bii_missing`. v44_bii.lo(i,biome44) = p44_bii_lower_bound(t,i,biome44); display p44_bii_lower_bound; From 65ccea5df82ea6366ea1f5fcf9bc13d636b659d3 Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 5 Nov 2024 06:51:09 +0100 Subject: [PATCH 08/31] bugfix --- modules/44_biodiversity/bii_target_apr24/presolve.gms | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/44_biodiversity/bii_target_apr24/presolve.gms b/modules/44_biodiversity/bii_target_apr24/presolve.gms index de40ebb61..4af7a228c 100644 --- a/modules/44_biodiversity/bii_target_apr24/presolve.gms +++ b/modules/44_biodiversity/bii_target_apr24/presolve.gms @@ -23,7 +23,7 @@ else ); p44_bii_lower_bound(t2,i,biome44)$(p44_bii_lower_bound(t2,i,biome44) >= 1) = 1; p44_bii_lower_bound(t2,i,biome44)$(m_year(t2) < s44_start_year) = 0; - p44_bii_lower_bound(t2,i,biome44)$(sum(cell(i,j), f44_biome(j,biome44)**f44_rr_layer(j2)) <= 1e-6) = 0; + p44_bii_lower_bound(t2,i,biome44)$(sum(cell(i,j), f44_biome(j,biome44)**f44_rr_layer(j)) <= 1e-6) = 0; * The lower bound of `v44_bii` is set to `p44_bii_lower_bound` to avoid a reduction of BII in combination with `v44_bii_missing`. v44_bii.lo(i,biome44) = p44_bii_lower_bound(t,i,biome44); display p44_bii_lower_bound; From 9a1e2b9872b80234226aef0970675d6e5d5b2b11 Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 5 Nov 2024 07:58:27 +0100 Subject: [PATCH 09/31] test --- modules/80_optimization/nlp_apr17/solve.gms | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/80_optimization/nlp_apr17/solve.gms b/modules/80_optimization/nlp_apr17/solve.gms index ce482ee04..d95a53e8b 100644 --- a/modules/80_optimization/nlp_apr17/solve.gms +++ b/modules/80_optimization/nlp_apr17/solve.gms @@ -21,6 +21,7 @@ magpie.holdfixed = 1 ; $onecho > conopt4.opt Lim_Variable = 1.e25 Tol_Feas_Min = 3.e-13 +Tol_Feas_Max = 1.e-3 $offecho $onecho > conopt4.op2 From 43f1357a658eefbde29188dc27a283116d14bf27 Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 5 Nov 2024 09:47:06 +0100 Subject: [PATCH 10/31] test --- modules/80_optimization/nlp_apr17/solve.gms | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/80_optimization/nlp_apr17/solve.gms b/modules/80_optimization/nlp_apr17/solve.gms index d95a53e8b..be5dad485 100644 --- a/modules/80_optimization/nlp_apr17/solve.gms +++ b/modules/80_optimization/nlp_apr17/solve.gms @@ -21,7 +21,7 @@ magpie.holdfixed = 1 ; $onecho > conopt4.opt Lim_Variable = 1.e25 Tol_Feas_Min = 3.e-13 -Tol_Feas_Max = 1.e-3 +Tol_Feas_Max = 1.e-10 $offecho $onecho > conopt4.op2 From 1e439cdd223569062c9d05c9a7553848c91a0ecb Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 5 Nov 2024 11:05:42 +0100 Subject: [PATCH 11/31] update --- modules/44_biodiversity/bii_target/equations.gms | 3 ++- modules/44_biodiversity/bii_target/presolve.gms | 2 +- modules/44_biodiversity/bii_target_apr24/equations.gms | 7 ++++--- modules/44_biodiversity/bii_target_apr24/preloop.gms | 4 ++-- modules/44_biodiversity/bii_target_apr24/presolve.gms | 2 +- modules/80_optimization/lp_nlp_apr17/solve.gms | 2 +- modules/80_optimization/nlp_apr17/solve.gms | 3 +-- modules/80_optimization/nlp_par/solve.gms | 2 +- 8 files changed, 13 insertions(+), 12 deletions(-) diff --git a/modules/44_biodiversity/bii_target/equations.gms b/modules/44_biodiversity/bii_target/equations.gms index cc753571e..eb730f0a9 100644 --- a/modules/44_biodiversity/bii_target/equations.gms +++ b/modules/44_biodiversity/bii_target/equations.gms @@ -10,7 +10,8 @@ *' The Biodiversity Intactness Index (BII) is calculated at the level of 71 biomes. *' The regional layer is needed for compatibility with the high resolution parallel optimization output script (scripts/output/extra/highres.R) - q44_bii(i2,biome44)$(sum(cell(i2,j2), f44_biome(j2,biome44)) > 1e-10) .. v44_bii(i2,biome44) * sum((cell(i2,j2),land), pcm_land(j2,land) * f44_biome(j2,biome44)) + q44_bii(i2,biome44)$(sum(cell(i2,j2), f44_biome(j2,biome44)) > 1e-10) .. + v44_bii(i2,biome44) * sum((cell(i2,j2),land), pcm_land(j2,land) * f44_biome(j2,biome44)) =e= sum((cell(i2,j2),potnatveg,landcover44), vm_bv(j2,landcover44,potnatveg) * f44_biome(j2,biome44)); diff --git a/modules/44_biodiversity/bii_target/presolve.gms b/modules/44_biodiversity/bii_target/presolve.gms index de414061e..88dc5aba9 100644 --- a/modules/44_biodiversity/bii_target/presolve.gms +++ b/modules/44_biodiversity/bii_target/presolve.gms @@ -23,7 +23,7 @@ else ); p44_bii_lower_bound(t2,i,biome44)$(p44_bii_lower_bound(t2,i,biome44) >= 1) = 1; p44_bii_lower_bound(t2,i,biome44)$(m_year(t2) < s44_start_year) = 0; - p44_bii_lower_bound(t2,i,biome44)$(sum(cell(i,j), f44_biome(j,biome44)) = 0) = 0; + p44_bii_lower_bound(t2,i,biome44)$(sum(cell(i,j), f44_biome(j,biome44)) <= 1e-10) = 0; * The lower bound of `v44_bii` is set to `p44_bii_lower_bound` to avoid a reduction of BII in combination with `v44_bii_missing`. v44_bii.lo(i,biome44) = p44_bii_lower_bound(t,i,biome44); display p44_bii_lower_bound; diff --git a/modules/44_biodiversity/bii_target_apr24/equations.gms b/modules/44_biodiversity/bii_target_apr24/equations.gms index 3e084c12a..e0584c0b9 100644 --- a/modules/44_biodiversity/bii_target_apr24/equations.gms +++ b/modules/44_biodiversity/bii_target_apr24/equations.gms @@ -11,14 +11,15 @@ *' Biodiversity stock weighted by range-rarity restoration prioritization layer (`f44_rr_layer`) *' The regional layer is needed for compatibility with the high resolution parallel optimization output script (scripts/output/extra/highres.R) - q44_bii(i2,biome44)$(sum(cell(i2,j2), f44_biome(j2,biome44)*f44_rr_layer(j2)) > 1e-6) .. v44_bii(i2,biome44) + q44_bii(i2,biome44)$(sum(cell(i2,j2), f44_biome(j2,biome44)*f44_rr_layer(j2)) > 1e-10) .. + v44_bii(i2,biome44) * sum((cell(i2,j2),land), pcm_land(j2,land) * f44_rr_layer(j2) * f44_biome(j2,biome44)) =e= - (sum((cell(i2,j2),potnatveg,landcover44), vm_bv(j2,landcover44,potnatveg) * f44_rr_layer(j2) * f44_biome(j2,biome44)) / sum((cell(i2,j2),land), pcm_land(j2,land) * f44_rr_layer(j2) * f44_biome(j2,biome44))); + sum((cell(i2,j2),potnatveg,landcover44), vm_bv(j2,landcover44,potnatveg) * f44_rr_layer(j2) * f44_biome(j2,biome44)); *' For each of the 71 biomes, the BII has to meet a minium level based on `s44_bii_lower_bound`. *' `v44_bii_missing` is a technical variable to maintain feasibility in case `v44_bii` cannot be increased. - q44_bii_target(i2,biome44)$(sum(cell(i2,j2), f44_biome(j2,biome44)*f44_rr_layer(j2)) > 1e-6) .. + q44_bii_target(i2,biome44)$(sum(cell(i2,j2), f44_biome(j2,biome44)*f44_rr_layer(j2)) > 1e-10) .. v44_bii(i2,biome44) + v44_bii_missing(i2,biome44) =g= sum(ct, p44_bii_lower_bound(ct,i2,biome44)); *' Costs accrue only for `v44_bii_missing`. In the best case costs should be zero or close to zero. diff --git a/modules/44_biodiversity/bii_target_apr24/preloop.gms b/modules/44_biodiversity/bii_target_apr24/preloop.gms index 589c41bec..717263d63 100644 --- a/modules/44_biodiversity/bii_target_apr24/preloop.gms +++ b/modules/44_biodiversity/bii_target_apr24/preloop.gms @@ -7,8 +7,8 @@ v44_bii.l(i,biome44) = 0.75; -v44_bii.fx(i,biome44)$(sum(cell(i,j), f44_biome(j,biome44)*f44_rr_layer(j)) <= 1e-6) = 0; -v44_bii_missing.fx(i,biome44)$(sum(cell(i,j), f44_biome(j,biome44)*f44_rr_layer(j)) <= 1e-6) = 0; +v44_bii.fx(i,biome44)$(sum(cell(i,j), f44_biome(j,biome44)*f44_rr_layer(j)) <= 1e-10) = 0; +v44_bii_missing.fx(i,biome44)$(sum(cell(i,j), f44_biome(j,biome44)*f44_rr_layer(j)) <= 1e-10) = 0; p44_bii_lower_bound(t,i,biome44) = 0; vm_bv.l(j,landcover44,potnatveg) = 0; diff --git a/modules/44_biodiversity/bii_target_apr24/presolve.gms b/modules/44_biodiversity/bii_target_apr24/presolve.gms index 4af7a228c..487b68041 100644 --- a/modules/44_biodiversity/bii_target_apr24/presolve.gms +++ b/modules/44_biodiversity/bii_target_apr24/presolve.gms @@ -23,7 +23,7 @@ else ); p44_bii_lower_bound(t2,i,biome44)$(p44_bii_lower_bound(t2,i,biome44) >= 1) = 1; p44_bii_lower_bound(t2,i,biome44)$(m_year(t2) < s44_start_year) = 0; - p44_bii_lower_bound(t2,i,biome44)$(sum(cell(i,j), f44_biome(j,biome44)**f44_rr_layer(j)) <= 1e-6) = 0; + p44_bii_lower_bound(t2,i,biome44)$(sum(cell(i,j), f44_biome(j,biome44)**f44_rr_layer(j)) <= 1e-10) = 0; * The lower bound of `v44_bii` is set to `p44_bii_lower_bound` to avoid a reduction of BII in combination with `v44_bii_missing`. v44_bii.lo(i,biome44) = p44_bii_lower_bound(t,i,biome44); display p44_bii_lower_bound; diff --git a/modules/80_optimization/lp_nlp_apr17/solve.gms b/modules/80_optimization/lp_nlp_apr17/solve.gms index bca87a9b3..e492dd9a3 100644 --- a/modules/80_optimization/lp_nlp_apr17/solve.gms +++ b/modules/80_optimization/lp_nlp_apr17/solve.gms @@ -36,7 +36,7 @@ $endif $onecho > conopt4.opt Lim_Variable = 1.e25 -Tol_Feas_Min = 3.e-13 +Tol_Bound = 1.e-10 $offecho $onecho > conopt4.op2 diff --git a/modules/80_optimization/nlp_apr17/solve.gms b/modules/80_optimization/nlp_apr17/solve.gms index be5dad485..62dd0aee3 100644 --- a/modules/80_optimization/nlp_apr17/solve.gms +++ b/modules/80_optimization/nlp_apr17/solve.gms @@ -20,8 +20,7 @@ magpie.holdfixed = 1 ; $onecho > conopt4.opt Lim_Variable = 1.e25 -Tol_Feas_Min = 3.e-13 -Tol_Feas_Max = 1.e-10 +Tol_Bound = 1.e-10 $offecho $onecho > conopt4.op2 diff --git a/modules/80_optimization/nlp_par/solve.gms b/modules/80_optimization/nlp_par/solve.gms index d63421378..a3151692f 100644 --- a/modules/80_optimization/nlp_par/solve.gms +++ b/modules/80_optimization/nlp_par/solve.gms @@ -23,7 +23,7 @@ magpie.savepoint = 0; $onecho > conopt4.opt Lim_Variable = 1.e25 -Tol_Feas_Min = 3.e-13 +Tol_Bound = 1.e-10 $offecho $onecho > conopt4.op2 From a07bd31f5fca23a4e10b2f82defa1912c5529a36 Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 5 Nov 2024 11:23:42 +0100 Subject: [PATCH 12/31] update --- modules/80_optimization/lp_nlp_apr17/solve.gms | 2 ++ modules/80_optimization/nlp_apr17/solve.gms | 2 ++ modules/80_optimization/nlp_par/solve.gms | 2 ++ 3 files changed, 6 insertions(+) diff --git a/modules/80_optimization/lp_nlp_apr17/solve.gms b/modules/80_optimization/lp_nlp_apr17/solve.gms index e492dd9a3..f84f03fc1 100644 --- a/modules/80_optimization/lp_nlp_apr17/solve.gms +++ b/modules/80_optimization/lp_nlp_apr17/solve.gms @@ -37,6 +37,8 @@ $endif $onecho > conopt4.opt Lim_Variable = 1.e25 Tol_Bound = 1.e-10 +Tol_Opt_Infeas = 1.e-10 +Tol_Optimality = 1.e-10 $offecho $onecho > conopt4.op2 diff --git a/modules/80_optimization/nlp_apr17/solve.gms b/modules/80_optimization/nlp_apr17/solve.gms index 62dd0aee3..6956fe7f9 100644 --- a/modules/80_optimization/nlp_apr17/solve.gms +++ b/modules/80_optimization/nlp_apr17/solve.gms @@ -21,6 +21,8 @@ magpie.holdfixed = 1 ; $onecho > conopt4.opt Lim_Variable = 1.e25 Tol_Bound = 1.e-10 +Tol_Opt_Infeas = 1.e-10 +Tol_Optimality = 1.e-10 $offecho $onecho > conopt4.op2 diff --git a/modules/80_optimization/nlp_par/solve.gms b/modules/80_optimization/nlp_par/solve.gms index a3151692f..3aae97264 100644 --- a/modules/80_optimization/nlp_par/solve.gms +++ b/modules/80_optimization/nlp_par/solve.gms @@ -24,6 +24,8 @@ magpie.savepoint = 0; $onecho > conopt4.opt Lim_Variable = 1.e25 Tol_Bound = 1.e-10 +Tol_Opt_Infeas = 1.e-10 +Tol_Optimality = 1.e-10 $offecho $onecho > conopt4.op2 From 1fac4e5d559bea1b50c3934b6626634d396e079c Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 5 Nov 2024 12:11:36 +0100 Subject: [PATCH 13/31] test --- modules/10_land/landmatrix_dec18/equations.gms | 3 +-- modules/10_land/landmatrix_dec18/preloop.gms | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/10_land/landmatrix_dec18/equations.gms b/modules/10_land/landmatrix_dec18/equations.gms index e086f12cf..719eaa91a 100644 --- a/modules/10_land/landmatrix_dec18/equations.gms +++ b/modules/10_land/landmatrix_dec18/equations.gms @@ -17,8 +17,7 @@ *' `v10_balance_negative`should deviate from zero only in exceptional cases. q10_transition_matrix(j2) .. - sum((land_from,land_to), vm_lu_transitions(j2,land_from,land_to)) - + v10_balance_positive(j2) - v10_balance_negative(j2) =e= + sum((land_from,land_to), vm_lu_transitions(j2,land_from,land_to)) =e= sum(land, pcm_land(j2,land)); q10_transition_to(j2,land_to) .. diff --git a/modules/10_land/landmatrix_dec18/preloop.gms b/modules/10_land/landmatrix_dec18/preloop.gms index 3a209b115..798cbba3b 100644 --- a/modules/10_land/landmatrix_dec18/preloop.gms +++ b/modules/10_land/landmatrix_dec18/preloop.gms @@ -4,3 +4,6 @@ *** | AGPL-3.0, you are granted additional permissions described in the *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de + +v10_balance_positive.fx(j) = 0; +v10_balance_negative.fx(j) = 0; From 6a8a23f29cb995f58d61b03b907128dd6f3eb2a6 Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 5 Nov 2024 13:24:20 +0100 Subject: [PATCH 14/31] bugfix --- modules/10_land/landmatrix_dec18/equations.gms | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/10_land/landmatrix_dec18/equations.gms b/modules/10_land/landmatrix_dec18/equations.gms index 719eaa91a..328b92b5e 100644 --- a/modules/10_land/landmatrix_dec18/equations.gms +++ b/modules/10_land/landmatrix_dec18/equations.gms @@ -18,7 +18,7 @@ q10_transition_matrix(j2) .. sum((land_from,land_to), vm_lu_transitions(j2,land_from,land_to)) =e= - sum(land, pcm_land(j2,land)); + sum(land, vm_land(j2,land)); q10_transition_to(j2,land_to) .. sum(land_from, vm_lu_transitions(j2,land_from,land_to)) =e= @@ -26,7 +26,7 @@ q10_transition_from(j2,land_from) .. sum(land_to, vm_lu_transitions(j2,land_from,land_to)) =e= - pcm_land(j2,land_from); + vm_land.l(j2,land_from); *' The following two equations calculate land expansion and land contraction based *' on the above land transition matrix. From 492c783625c6dd9824a4cc3cc43523651dde4981 Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 5 Nov 2024 13:49:51 +0100 Subject: [PATCH 15/31] update --- modules/10_land/landmatrix_dec18/declarations.gms | 4 ++-- modules/10_land/landmatrix_dec18/equations.gms | 4 ++-- modules/10_land/landmatrix_dec18/preloop.gms | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/10_land/landmatrix_dec18/declarations.gms b/modules/10_land/landmatrix_dec18/declarations.gms index 172ec3792..be999bbc3 100644 --- a/modules/10_land/landmatrix_dec18/declarations.gms +++ b/modules/10_land/landmatrix_dec18/declarations.gms @@ -21,8 +21,8 @@ positive variables vm_landreduction(j,land) Land reduction (mio. ha) vm_cost_land_transition(j) Costs for lu transitions (mio. USD17MER per yr) vm_lu_transitions(j,land_from,land_to) Land transitions between time steps (mio. ha) - v10_balance_positive(j) Balance variable for land transitions (mio. ha) - v10_balance_negative(j) Balance variable for land transitions (mio. ha) + v10_balance_positive(j,land_from) Balance variable for land transitions (mio. ha) + v10_balance_negative(j,land_from) Balance variable for land transitions (mio. ha) ; equations diff --git a/modules/10_land/landmatrix_dec18/equations.gms b/modules/10_land/landmatrix_dec18/equations.gms index 328b92b5e..55ee82325 100644 --- a/modules/10_land/landmatrix_dec18/equations.gms +++ b/modules/10_land/landmatrix_dec18/equations.gms @@ -26,7 +26,7 @@ q10_transition_from(j2,land_from) .. sum(land_to, vm_lu_transitions(j2,land_from,land_to)) =e= - vm_land.l(j2,land_from); + vm_land.l(j2,land_from) + v10_balance_positive(j2,land_from) - v10_balance_negative(j2,land_from); *' The following two equations calculate land expansion and land contraction based *' on the above land transition matrix. @@ -46,7 +46,7 @@ q10_cost(j2) .. vm_cost_land_transition(j2) =e= sum(land, vm_landexpansion(j2,land) + vm_landreduction(j2,land)) * 1 - + (v10_balance_positive(j2) + v10_balance_negative(j2)) * s10_cost_balance; + + sum(land_from, v10_balance_positive(j2,land_from) + v10_balance_negative(j2,land_from)) * s10_cost_balance; *' The gross changes in land are calculated based on land expansion, land *' contraction and land changes from within the modules [35_natveg] diff --git a/modules/10_land/landmatrix_dec18/preloop.gms b/modules/10_land/landmatrix_dec18/preloop.gms index 798cbba3b..3523a193e 100644 --- a/modules/10_land/landmatrix_dec18/preloop.gms +++ b/modules/10_land/landmatrix_dec18/preloop.gms @@ -5,5 +5,5 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -v10_balance_positive.fx(j) = 0; -v10_balance_negative.fx(j) = 0; +*v10_balance_positive.fx(j) = 0; +*v10_balance_negative.fx(j) = 0; From 99e089085894988721fcf9d6970ece84963a0fcd Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 5 Nov 2024 13:53:18 +0100 Subject: [PATCH 16/31] fix --- modules/10_land/landmatrix_dec18/scaling.gms | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/10_land/landmatrix_dec18/scaling.gms b/modules/10_land/landmatrix_dec18/scaling.gms index 7698c27b8..72e83b61f 100644 --- a/modules/10_land/landmatrix_dec18/scaling.gms +++ b/modules/10_land/landmatrix_dec18/scaling.gms @@ -6,5 +6,5 @@ *** | Contact: magpie@pik-potsdam.de vm_landdiff.scale = 10e3; -v10_balance_positive.scale(j) = 10e-9; -v10_balance_negative.scale(j) = 10e-9; +*v10_balance_positive.scale(j) = 10e-9; +*v10_balance_negative.scale(j) = 10e-9; From d905f25616014b90109fa02f70b213264b6000b8 Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 5 Nov 2024 14:34:07 +0100 Subject: [PATCH 17/31] update --- .../10_land/landmatrix_dec18/declarations.gms | 4 ++-- modules/10_land/landmatrix_dec18/postsolve.gms | 16 ++++++++-------- .../sticky_labor/declarations.gms | 2 +- .../bii_target_apr24/equations.gms | 4 ++-- .../44_biodiversity/bii_target_apr24/preloop.gms | 4 ++-- .../bii_target_apr24/presolve.gms | 2 +- .../bii_target_apr24/realization.gms | 1 + .../44_biodiversity/bii_target_apr24/scaling.gms | 9 +++++++++ 8 files changed, 26 insertions(+), 16 deletions(-) create mode 100644 modules/44_biodiversity/bii_target_apr24/scaling.gms diff --git a/modules/10_land/landmatrix_dec18/declarations.gms b/modules/10_land/landmatrix_dec18/declarations.gms index be999bbc3..2b7346ff7 100644 --- a/modules/10_land/landmatrix_dec18/declarations.gms +++ b/modules/10_land/landmatrix_dec18/declarations.gms @@ -43,8 +43,8 @@ parameters ov_landreduction(t,j,land,type) Land reduction (mio. ha) ov_cost_land_transition(t,j,type) Costs for lu transitions (mio. USD17MER per yr) ov_lu_transitions(t,j,land_from,land_to,type) Land transitions between time steps (mio. ha) - ov10_balance_positive(t,j,type) Balance variable for land transitions (mio. ha) - ov10_balance_negative(t,j,type) Balance variable for land transitions (mio. ha) + ov10_balance_positive(t,j,land_from,type) Balance variable for land transitions (mio. ha) + ov10_balance_negative(t,j,land_from,type) Balance variable for land transitions (mio. ha) oq10_transition_matrix(t,j,type) Land transition constraint cell area (mio. ha) oq10_transition_to(t,j,land_to,type) Land transition constraint to (mio. ha) oq10_transition_from(t,j,land_from,type) Land transition constraint from (mio. ha) diff --git a/modules/10_land/landmatrix_dec18/postsolve.gms b/modules/10_land/landmatrix_dec18/postsolve.gms index b7e9c5277..75565d91f 100644 --- a/modules/10_land/landmatrix_dec18/postsolve.gms +++ b/modules/10_land/landmatrix_dec18/postsolve.gms @@ -15,8 +15,8 @@ pcm_land(j,land) = vm_land.l(j,land); ov_landreduction(t,j,land,"marginal") = vm_landreduction.m(j,land); ov_cost_land_transition(t,j,"marginal") = vm_cost_land_transition.m(j); ov_lu_transitions(t,j,land_from,land_to,"marginal") = vm_lu_transitions.m(j,land_from,land_to); - ov10_balance_positive(t,j,"marginal") = v10_balance_positive.m(j); - ov10_balance_negative(t,j,"marginal") = v10_balance_negative.m(j); + ov10_balance_positive(t,j,land_from,"marginal") = v10_balance_positive.m(j,land_from); + ov10_balance_negative(t,j,land_from,"marginal") = v10_balance_negative.m(j,land_from); oq10_transition_matrix(t,j,"marginal") = q10_transition_matrix.m(j); oq10_transition_to(t,j,land_to,"marginal") = q10_transition_to.m(j,land_to); oq10_transition_from(t,j,land_from,"marginal") = q10_transition_from.m(j,land_from); @@ -30,8 +30,8 @@ pcm_land(j,land) = vm_land.l(j,land); ov_landreduction(t,j,land,"level") = vm_landreduction.l(j,land); ov_cost_land_transition(t,j,"level") = vm_cost_land_transition.l(j); ov_lu_transitions(t,j,land_from,land_to,"level") = vm_lu_transitions.l(j,land_from,land_to); - ov10_balance_positive(t,j,"level") = v10_balance_positive.l(j); - ov10_balance_negative(t,j,"level") = v10_balance_negative.l(j); + ov10_balance_positive(t,j,land_from,"level") = v10_balance_positive.l(j,land_from); + ov10_balance_negative(t,j,land_from,"level") = v10_balance_negative.l(j,land_from); oq10_transition_matrix(t,j,"level") = q10_transition_matrix.l(j); oq10_transition_to(t,j,land_to,"level") = q10_transition_to.l(j,land_to); oq10_transition_from(t,j,land_from,"level") = q10_transition_from.l(j,land_from); @@ -45,8 +45,8 @@ pcm_land(j,land) = vm_land.l(j,land); ov_landreduction(t,j,land,"upper") = vm_landreduction.up(j,land); ov_cost_land_transition(t,j,"upper") = vm_cost_land_transition.up(j); ov_lu_transitions(t,j,land_from,land_to,"upper") = vm_lu_transitions.up(j,land_from,land_to); - ov10_balance_positive(t,j,"upper") = v10_balance_positive.up(j); - ov10_balance_negative(t,j,"upper") = v10_balance_negative.up(j); + ov10_balance_positive(t,j,land_from,"upper") = v10_balance_positive.up(j,land_from); + ov10_balance_negative(t,j,land_from,"upper") = v10_balance_negative.up(j,land_from); oq10_transition_matrix(t,j,"upper") = q10_transition_matrix.up(j); oq10_transition_to(t,j,land_to,"upper") = q10_transition_to.up(j,land_to); oq10_transition_from(t,j,land_from,"upper") = q10_transition_from.up(j,land_from); @@ -60,8 +60,8 @@ pcm_land(j,land) = vm_land.l(j,land); ov_landreduction(t,j,land,"lower") = vm_landreduction.lo(j,land); ov_cost_land_transition(t,j,"lower") = vm_cost_land_transition.lo(j); ov_lu_transitions(t,j,land_from,land_to,"lower") = vm_lu_transitions.lo(j,land_from,land_to); - ov10_balance_positive(t,j,"lower") = v10_balance_positive.lo(j); - ov10_balance_negative(t,j,"lower") = v10_balance_negative.lo(j); + ov10_balance_positive(t,j,land_from,"lower") = v10_balance_positive.lo(j,land_from); + ov10_balance_negative(t,j,land_from,"lower") = v10_balance_negative.lo(j,land_from); oq10_transition_matrix(t,j,"lower") = q10_transition_matrix.lo(j); oq10_transition_to(t,j,land_to,"lower") = q10_transition_to.lo(j,land_to); oq10_transition_from(t,j,land_from,"lower") = q10_transition_from.lo(j,land_from); diff --git a/modules/38_factor_costs/sticky_labor/declarations.gms b/modules/38_factor_costs/sticky_labor/declarations.gms index 3d926064b..708e08fe8 100644 --- a/modules/38_factor_costs/sticky_labor/declarations.gms +++ b/modules/38_factor_costs/sticky_labor/declarations.gms @@ -54,7 +54,7 @@ parameters ov38_investment_mobile(t,j,type) Investment costs in mobile farm capital (mio USD17MER per yr) ov38_laborhours_need(t,j,kcr,type) Labor required per unit of output (hours per ton DM) ov38_capital_need(t,j,kcr,mobil38,type) Captial required per unit of output (USD17MER per ton DM) - ov38_relax_CES_lp(t,j,kcr,type) Variable to make CES function feasible in linearized model (1) + ov38_relax_CES_lp(t,j,kcr,type) Variable to make CES function feasible in linearized model (1) oq38_cost_prod_labor(t,i,type) Regional labor input costs for crop production (mio USD17MER) oq38_cost_prod_capital(t,i,type) Regional capital input costs for crop production (mio USD17MER) oq38_investment_immobile(t,j,kcr,type) Cellular immobile investments into farm capital (mio USD17MER) diff --git a/modules/44_biodiversity/bii_target_apr24/equations.gms b/modules/44_biodiversity/bii_target_apr24/equations.gms index e0584c0b9..13604ddc0 100644 --- a/modules/44_biodiversity/bii_target_apr24/equations.gms +++ b/modules/44_biodiversity/bii_target_apr24/equations.gms @@ -11,7 +11,7 @@ *' Biodiversity stock weighted by range-rarity restoration prioritization layer (`f44_rr_layer`) *' The regional layer is needed for compatibility with the high resolution parallel optimization output script (scripts/output/extra/highres.R) - q44_bii(i2,biome44)$(sum(cell(i2,j2), f44_biome(j2,biome44)*f44_rr_layer(j2)) > 1e-10) .. + q44_bii(i2,biome44)$(sum(cell(i2,j2), f44_biome(j2,biome44)*f44_rr_layer(j2)) > 1e-6) .. v44_bii(i2,biome44) * sum((cell(i2,j2),land), pcm_land(j2,land) * f44_rr_layer(j2) * f44_biome(j2,biome44)) =e= sum((cell(i2,j2),potnatveg,landcover44), vm_bv(j2,landcover44,potnatveg) * f44_rr_layer(j2) * f44_biome(j2,biome44)); @@ -19,7 +19,7 @@ *' For each of the 71 biomes, the BII has to meet a minium level based on `s44_bii_lower_bound`. *' `v44_bii_missing` is a technical variable to maintain feasibility in case `v44_bii` cannot be increased. - q44_bii_target(i2,biome44)$(sum(cell(i2,j2), f44_biome(j2,biome44)*f44_rr_layer(j2)) > 1e-10) .. + q44_bii_target(i2,biome44)$(sum(cell(i2,j2), f44_biome(j2,biome44)*f44_rr_layer(j2)) > 1e-6) .. v44_bii(i2,biome44) + v44_bii_missing(i2,biome44) =g= sum(ct, p44_bii_lower_bound(ct,i2,biome44)); *' Costs accrue only for `v44_bii_missing`. In the best case costs should be zero or close to zero. diff --git a/modules/44_biodiversity/bii_target_apr24/preloop.gms b/modules/44_biodiversity/bii_target_apr24/preloop.gms index 717263d63..589c41bec 100644 --- a/modules/44_biodiversity/bii_target_apr24/preloop.gms +++ b/modules/44_biodiversity/bii_target_apr24/preloop.gms @@ -7,8 +7,8 @@ v44_bii.l(i,biome44) = 0.75; -v44_bii.fx(i,biome44)$(sum(cell(i,j), f44_biome(j,biome44)*f44_rr_layer(j)) <= 1e-10) = 0; -v44_bii_missing.fx(i,biome44)$(sum(cell(i,j), f44_biome(j,biome44)*f44_rr_layer(j)) <= 1e-10) = 0; +v44_bii.fx(i,biome44)$(sum(cell(i,j), f44_biome(j,biome44)*f44_rr_layer(j)) <= 1e-6) = 0; +v44_bii_missing.fx(i,biome44)$(sum(cell(i,j), f44_biome(j,biome44)*f44_rr_layer(j)) <= 1e-6) = 0; p44_bii_lower_bound(t,i,biome44) = 0; vm_bv.l(j,landcover44,potnatveg) = 0; diff --git a/modules/44_biodiversity/bii_target_apr24/presolve.gms b/modules/44_biodiversity/bii_target_apr24/presolve.gms index 487b68041..4af7a228c 100644 --- a/modules/44_biodiversity/bii_target_apr24/presolve.gms +++ b/modules/44_biodiversity/bii_target_apr24/presolve.gms @@ -23,7 +23,7 @@ else ); p44_bii_lower_bound(t2,i,biome44)$(p44_bii_lower_bound(t2,i,biome44) >= 1) = 1; p44_bii_lower_bound(t2,i,biome44)$(m_year(t2) < s44_start_year) = 0; - p44_bii_lower_bound(t2,i,biome44)$(sum(cell(i,j), f44_biome(j,biome44)**f44_rr_layer(j)) <= 1e-10) = 0; + p44_bii_lower_bound(t2,i,biome44)$(sum(cell(i,j), f44_biome(j,biome44)**f44_rr_layer(j)) <= 1e-6) = 0; * The lower bound of `v44_bii` is set to `p44_bii_lower_bound` to avoid a reduction of BII in combination with `v44_bii_missing`. v44_bii.lo(i,biome44) = p44_bii_lower_bound(t,i,biome44); display p44_bii_lower_bound; diff --git a/modules/44_biodiversity/bii_target_apr24/realization.gms b/modules/44_biodiversity/bii_target_apr24/realization.gms index 1b1298ab5..f8fbd4252 100644 --- a/modules/44_biodiversity/bii_target_apr24/realization.gms +++ b/modules/44_biodiversity/bii_target_apr24/realization.gms @@ -19,6 +19,7 @@ $Ifi "%phase%" == "sets" $include "./modules/44_biodiversity/bii_target_apr24/se $Ifi "%phase%" == "declarations" $include "./modules/44_biodiversity/bii_target_apr24/declarations.gms" $Ifi "%phase%" == "input" $include "./modules/44_biodiversity/bii_target_apr24/input.gms" $Ifi "%phase%" == "equations" $include "./modules/44_biodiversity/bii_target_apr24/equations.gms" +$Ifi "%phase%" == "scaling" $include "./modules/44_biodiversity/bii_target_apr24/scaling.gms" $Ifi "%phase%" == "preloop" $include "./modules/44_biodiversity/bii_target_apr24/preloop.gms" $Ifi "%phase%" == "presolve" $include "./modules/44_biodiversity/bii_target_apr24/presolve.gms" $Ifi "%phase%" == "postsolve" $include "./modules/44_biodiversity/bii_target_apr24/postsolve.gms" diff --git a/modules/44_biodiversity/bii_target_apr24/scaling.gms b/modules/44_biodiversity/bii_target_apr24/scaling.gms new file mode 100644 index 000000000..5e247851b --- /dev/null +++ b/modules/44_biodiversity/bii_target_apr24/scaling.gms @@ -0,0 +1,9 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +v44_bii.scale(i,biome44) = 10e-4; +vm_bv.scale(j,landcover44,potnatveg) = 10e-4; From a3743a6d0e3fa2c74fcf507200777c0617007943 Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 5 Nov 2024 15:45:45 +0100 Subject: [PATCH 18/31] update --- modules/10_land/landmatrix_dec18/scaling.gms | 4 ++-- modules/44_biodiversity/bii_target_apr24/equations.gms | 4 ++-- modules/44_biodiversity/bii_target_apr24/preloop.gms | 4 ++-- modules/44_biodiversity/bii_target_apr24/presolve.gms | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/10_land/landmatrix_dec18/scaling.gms b/modules/10_land/landmatrix_dec18/scaling.gms index 72e83b61f..661fd1064 100644 --- a/modules/10_land/landmatrix_dec18/scaling.gms +++ b/modules/10_land/landmatrix_dec18/scaling.gms @@ -6,5 +6,5 @@ *** | Contact: magpie@pik-potsdam.de vm_landdiff.scale = 10e3; -*v10_balance_positive.scale(j) = 10e-9; -*v10_balance_negative.scale(j) = 10e-9; +v10_balance_positive.scale(j,land_from) = 10e-3; +v10_balance_negative.scale(j,land_from) = 10e-3; diff --git a/modules/44_biodiversity/bii_target_apr24/equations.gms b/modules/44_biodiversity/bii_target_apr24/equations.gms index 13604ddc0..e0584c0b9 100644 --- a/modules/44_biodiversity/bii_target_apr24/equations.gms +++ b/modules/44_biodiversity/bii_target_apr24/equations.gms @@ -11,7 +11,7 @@ *' Biodiversity stock weighted by range-rarity restoration prioritization layer (`f44_rr_layer`) *' The regional layer is needed for compatibility with the high resolution parallel optimization output script (scripts/output/extra/highres.R) - q44_bii(i2,biome44)$(sum(cell(i2,j2), f44_biome(j2,biome44)*f44_rr_layer(j2)) > 1e-6) .. + q44_bii(i2,biome44)$(sum(cell(i2,j2), f44_biome(j2,biome44)*f44_rr_layer(j2)) > 1e-10) .. v44_bii(i2,biome44) * sum((cell(i2,j2),land), pcm_land(j2,land) * f44_rr_layer(j2) * f44_biome(j2,biome44)) =e= sum((cell(i2,j2),potnatveg,landcover44), vm_bv(j2,landcover44,potnatveg) * f44_rr_layer(j2) * f44_biome(j2,biome44)); @@ -19,7 +19,7 @@ *' For each of the 71 biomes, the BII has to meet a minium level based on `s44_bii_lower_bound`. *' `v44_bii_missing` is a technical variable to maintain feasibility in case `v44_bii` cannot be increased. - q44_bii_target(i2,biome44)$(sum(cell(i2,j2), f44_biome(j2,biome44)*f44_rr_layer(j2)) > 1e-6) .. + q44_bii_target(i2,biome44)$(sum(cell(i2,j2), f44_biome(j2,biome44)*f44_rr_layer(j2)) > 1e-10) .. v44_bii(i2,biome44) + v44_bii_missing(i2,biome44) =g= sum(ct, p44_bii_lower_bound(ct,i2,biome44)); *' Costs accrue only for `v44_bii_missing`. In the best case costs should be zero or close to zero. diff --git a/modules/44_biodiversity/bii_target_apr24/preloop.gms b/modules/44_biodiversity/bii_target_apr24/preloop.gms index 589c41bec..717263d63 100644 --- a/modules/44_biodiversity/bii_target_apr24/preloop.gms +++ b/modules/44_biodiversity/bii_target_apr24/preloop.gms @@ -7,8 +7,8 @@ v44_bii.l(i,biome44) = 0.75; -v44_bii.fx(i,biome44)$(sum(cell(i,j), f44_biome(j,biome44)*f44_rr_layer(j)) <= 1e-6) = 0; -v44_bii_missing.fx(i,biome44)$(sum(cell(i,j), f44_biome(j,biome44)*f44_rr_layer(j)) <= 1e-6) = 0; +v44_bii.fx(i,biome44)$(sum(cell(i,j), f44_biome(j,biome44)*f44_rr_layer(j)) <= 1e-10) = 0; +v44_bii_missing.fx(i,biome44)$(sum(cell(i,j), f44_biome(j,biome44)*f44_rr_layer(j)) <= 1e-10) = 0; p44_bii_lower_bound(t,i,biome44) = 0; vm_bv.l(j,landcover44,potnatveg) = 0; diff --git a/modules/44_biodiversity/bii_target_apr24/presolve.gms b/modules/44_biodiversity/bii_target_apr24/presolve.gms index 4af7a228c..487b68041 100644 --- a/modules/44_biodiversity/bii_target_apr24/presolve.gms +++ b/modules/44_biodiversity/bii_target_apr24/presolve.gms @@ -23,7 +23,7 @@ else ); p44_bii_lower_bound(t2,i,biome44)$(p44_bii_lower_bound(t2,i,biome44) >= 1) = 1; p44_bii_lower_bound(t2,i,biome44)$(m_year(t2) < s44_start_year) = 0; - p44_bii_lower_bound(t2,i,biome44)$(sum(cell(i,j), f44_biome(j,biome44)**f44_rr_layer(j)) <= 1e-6) = 0; + p44_bii_lower_bound(t2,i,biome44)$(sum(cell(i,j), f44_biome(j,biome44)**f44_rr_layer(j)) <= 1e-10) = 0; * The lower bound of `v44_bii` is set to `p44_bii_lower_bound` to avoid a reduction of BII in combination with `v44_bii_missing`. v44_bii.lo(i,biome44) = p44_bii_lower_bound(t,i,biome44); display p44_bii_lower_bound; From a378239138d4d520dd48591219dcfa6b58d3387d Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 5 Nov 2024 16:04:22 +0100 Subject: [PATCH 19/31] update --- modules/10_land/landmatrix_dec18/preloop.gms | 3 --- 1 file changed, 3 deletions(-) diff --git a/modules/10_land/landmatrix_dec18/preloop.gms b/modules/10_land/landmatrix_dec18/preloop.gms index 3523a193e..3a209b115 100644 --- a/modules/10_land/landmatrix_dec18/preloop.gms +++ b/modules/10_land/landmatrix_dec18/preloop.gms @@ -4,6 +4,3 @@ *** | AGPL-3.0, you are granted additional permissions described in the *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de - -*v10_balance_positive.fx(j) = 0; -*v10_balance_negative.fx(j) = 0; From ba9483d3b13ea4cc9913dbdff3c8ad5e6521e947 Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 5 Nov 2024 20:53:20 +0100 Subject: [PATCH 20/31] test --- modules/10_land/landmatrix_dec18/scaling.gms | 4 ++-- modules/44_biodiversity/bii_target_apr24/scaling.gms | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/10_land/landmatrix_dec18/scaling.gms b/modules/10_land/landmatrix_dec18/scaling.gms index 661fd1064..6f29db5b5 100644 --- a/modules/10_land/landmatrix_dec18/scaling.gms +++ b/modules/10_land/landmatrix_dec18/scaling.gms @@ -6,5 +6,5 @@ *** | Contact: magpie@pik-potsdam.de vm_landdiff.scale = 10e3; -v10_balance_positive.scale(j,land_from) = 10e-3; -v10_balance_negative.scale(j,land_from) = 10e-3; +*v10_balance_positive.scale(j,land_from) = 10e-3; +*v10_balance_negative.scale(j,land_from) = 10e-3; diff --git a/modules/44_biodiversity/bii_target_apr24/scaling.gms b/modules/44_biodiversity/bii_target_apr24/scaling.gms index 5e247851b..33a5a1296 100644 --- a/modules/44_biodiversity/bii_target_apr24/scaling.gms +++ b/modules/44_biodiversity/bii_target_apr24/scaling.gms @@ -5,5 +5,5 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -v44_bii.scale(i,biome44) = 10e-4; -vm_bv.scale(j,landcover44,potnatveg) = 10e-4; +*v44_bii.scale(i,biome44) = 10e-4; +*vm_bv.scale(j,landcover44,potnatveg) = 10e-4; From af74fd22a1c06f083a068c9a82e669fe5011d0c5 Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 5 Nov 2024 21:05:03 +0100 Subject: [PATCH 21/31] update --- modules/80_optimization/lp_nlp_apr17/solve.gms | 3 --- modules/80_optimization/nlp_apr17/solve.gms | 3 --- modules/80_optimization/nlp_par/solve.gms | 3 --- 3 files changed, 9 deletions(-) diff --git a/modules/80_optimization/lp_nlp_apr17/solve.gms b/modules/80_optimization/lp_nlp_apr17/solve.gms index f84f03fc1..c3250b566 100644 --- a/modules/80_optimization/lp_nlp_apr17/solve.gms +++ b/modules/80_optimization/lp_nlp_apr17/solve.gms @@ -36,9 +36,6 @@ $endif $onecho > conopt4.opt Lim_Variable = 1.e25 -Tol_Bound = 1.e-10 -Tol_Opt_Infeas = 1.e-10 -Tol_Optimality = 1.e-10 $offecho $onecho > conopt4.op2 diff --git a/modules/80_optimization/nlp_apr17/solve.gms b/modules/80_optimization/nlp_apr17/solve.gms index 6956fe7f9..7dc3b1198 100644 --- a/modules/80_optimization/nlp_apr17/solve.gms +++ b/modules/80_optimization/nlp_apr17/solve.gms @@ -20,9 +20,6 @@ magpie.holdfixed = 1 ; $onecho > conopt4.opt Lim_Variable = 1.e25 -Tol_Bound = 1.e-10 -Tol_Opt_Infeas = 1.e-10 -Tol_Optimality = 1.e-10 $offecho $onecho > conopt4.op2 diff --git a/modules/80_optimization/nlp_par/solve.gms b/modules/80_optimization/nlp_par/solve.gms index 3aae97264..60d888a72 100644 --- a/modules/80_optimization/nlp_par/solve.gms +++ b/modules/80_optimization/nlp_par/solve.gms @@ -23,9 +23,6 @@ magpie.savepoint = 0; $onecho > conopt4.opt Lim_Variable = 1.e25 -Tol_Bound = 1.e-10 -Tol_Opt_Infeas = 1.e-10 -Tol_Optimality = 1.e-10 $offecho $onecho > conopt4.op2 From d386fb180e1a52e59f6ed6a4a18a6f43c0dd7e89 Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 5 Nov 2024 21:18:32 +0100 Subject: [PATCH 22/31] test --- modules/10_land/landmatrix_dec18/scaling.gms | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/10_land/landmatrix_dec18/scaling.gms b/modules/10_land/landmatrix_dec18/scaling.gms index 6f29db5b5..661fd1064 100644 --- a/modules/10_land/landmatrix_dec18/scaling.gms +++ b/modules/10_land/landmatrix_dec18/scaling.gms @@ -6,5 +6,5 @@ *** | Contact: magpie@pik-potsdam.de vm_landdiff.scale = 10e3; -*v10_balance_positive.scale(j,land_from) = 10e-3; -*v10_balance_negative.scale(j,land_from) = 10e-3; +v10_balance_positive.scale(j,land_from) = 10e-3; +v10_balance_negative.scale(j,land_from) = 10e-3; From 47f3227b15f161c19efa62f460e7c138ea2847ac Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 5 Nov 2024 22:42:18 +0100 Subject: [PATCH 23/31] bugfix --- modules/38_factor_costs/sticky_feb18/scaling.gms | 1 - modules/38_factor_costs/sticky_labor/scaling.gms | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/38_factor_costs/sticky_feb18/scaling.gms b/modules/38_factor_costs/sticky_feb18/scaling.gms index 27fd45cc5..77d624808 100644 --- a/modules/38_factor_costs/sticky_feb18/scaling.gms +++ b/modules/38_factor_costs/sticky_feb18/scaling.gms @@ -7,4 +7,3 @@ vm_cost_prod_crop.scale(i,factors) = 10e5; v38_investment_immobile.scale(j,kcr) = 10e3; -v38_capital_need.scale(j,kcr,mobil38) = 10e3; diff --git a/modules/38_factor_costs/sticky_labor/scaling.gms b/modules/38_factor_costs/sticky_labor/scaling.gms index d4602db9f..f24ae1f0b 100644 --- a/modules/38_factor_costs/sticky_labor/scaling.gms +++ b/modules/38_factor_costs/sticky_labor/scaling.gms @@ -6,3 +6,5 @@ *** | Contact: magpie@pik-potsdam.de vm_cost_prod_crop.scale(i,factors) = 10e4; +v38_investment_immobile.scale(j,kcr) = 10e3; +v38_capital_need.scale(j,kcr,mobil38) = 10e3; From fe8cd67a21d9659ac9453b484d75e65dfd0cb180 Mon Sep 17 00:00:00 2001 From: florianh Date: Wed, 6 Nov 2024 06:48:39 +0100 Subject: [PATCH 24/31] update --- modules/29_cropland/detail_apr24/realization.gms | 1 + .../detail_apr24}/scaling.gms | 4 ++-- modules/38_factor_costs/sticky_labor/scaling.gms | 2 +- .../44_biodiversity/bii_target_apr24/realization.gms | 1 - modules/70_livestock/fbask_jan16/realization.gms | 1 + modules/70_livestock/{ => fbask_jan16}/scaling.gms | 0 .../70_livestock/fbask_jan16_sticky/realization.gms | 1 + .../fbask_jan16_sticky}/scaling.gms | 6 +++--- .../71_disagg_lvst/foragebased_aug18/realization.gms | 1 - modules/71_disagg_lvst/foragebased_aug18/scaling.gms | 10 ---------- .../71_disagg_lvst/foragebased_jul23/realization.gms | 1 - 11 files changed, 9 insertions(+), 19 deletions(-) rename modules/{44_biodiversity/bii_target_apr24 => 29_cropland/detail_apr24}/scaling.gms (82%) rename modules/70_livestock/{ => fbask_jan16}/scaling.gms (100%) rename modules/{71_disagg_lvst/foragebased_jul23 => 70_livestock/fbask_jan16_sticky}/scaling.gms (65%) delete mode 100644 modules/71_disagg_lvst/foragebased_aug18/scaling.gms diff --git a/modules/29_cropland/detail_apr24/realization.gms b/modules/29_cropland/detail_apr24/realization.gms index 071000bd1..c9b62fec8 100644 --- a/modules/29_cropland/detail_apr24/realization.gms +++ b/modules/29_cropland/detail_apr24/realization.gms @@ -25,6 +25,7 @@ $Ifi "%phase%" == "sets" $include "./modules/29_cropland/detail_apr24/sets.gms" $Ifi "%phase%" == "declarations" $include "./modules/29_cropland/detail_apr24/declarations.gms" $Ifi "%phase%" == "input" $include "./modules/29_cropland/detail_apr24/input.gms" $Ifi "%phase%" == "equations" $include "./modules/29_cropland/detail_apr24/equations.gms" +$Ifi "%phase%" == "scaling" $include "./modules/29_cropland/detail_apr24/scaling.gms" $Ifi "%phase%" == "preloop" $include "./modules/29_cropland/detail_apr24/preloop.gms" $Ifi "%phase%" == "presolve" $include "./modules/29_cropland/detail_apr24/presolve.gms" $Ifi "%phase%" == "postsolve" $include "./modules/29_cropland/detail_apr24/postsolve.gms" diff --git a/modules/44_biodiversity/bii_target_apr24/scaling.gms b/modules/29_cropland/detail_apr24/scaling.gms similarity index 82% rename from modules/44_biodiversity/bii_target_apr24/scaling.gms rename to modules/29_cropland/detail_apr24/scaling.gms index 33a5a1296..49bccf2ac 100644 --- a/modules/44_biodiversity/bii_target_apr24/scaling.gms +++ b/modules/29_cropland/detail_apr24/scaling.gms @@ -5,5 +5,5 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -*v44_bii.scale(i,biome44) = 10e-4; -*vm_bv.scale(j,landcover44,potnatveg) = 10e-4; +v29_treecover.scale(j,ac) = 10e-3; +v29_treecover_missing.scale(j) = 10e-3; diff --git a/modules/38_factor_costs/sticky_labor/scaling.gms b/modules/38_factor_costs/sticky_labor/scaling.gms index f24ae1f0b..27fd45cc5 100644 --- a/modules/38_factor_costs/sticky_labor/scaling.gms +++ b/modules/38_factor_costs/sticky_labor/scaling.gms @@ -5,6 +5,6 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -vm_cost_prod_crop.scale(i,factors) = 10e4; +vm_cost_prod_crop.scale(i,factors) = 10e5; v38_investment_immobile.scale(j,kcr) = 10e3; v38_capital_need.scale(j,kcr,mobil38) = 10e3; diff --git a/modules/44_biodiversity/bii_target_apr24/realization.gms b/modules/44_biodiversity/bii_target_apr24/realization.gms index f8fbd4252..1b1298ab5 100644 --- a/modules/44_biodiversity/bii_target_apr24/realization.gms +++ b/modules/44_biodiversity/bii_target_apr24/realization.gms @@ -19,7 +19,6 @@ $Ifi "%phase%" == "sets" $include "./modules/44_biodiversity/bii_target_apr24/se $Ifi "%phase%" == "declarations" $include "./modules/44_biodiversity/bii_target_apr24/declarations.gms" $Ifi "%phase%" == "input" $include "./modules/44_biodiversity/bii_target_apr24/input.gms" $Ifi "%phase%" == "equations" $include "./modules/44_biodiversity/bii_target_apr24/equations.gms" -$Ifi "%phase%" == "scaling" $include "./modules/44_biodiversity/bii_target_apr24/scaling.gms" $Ifi "%phase%" == "preloop" $include "./modules/44_biodiversity/bii_target_apr24/preloop.gms" $Ifi "%phase%" == "presolve" $include "./modules/44_biodiversity/bii_target_apr24/presolve.gms" $Ifi "%phase%" == "postsolve" $include "./modules/44_biodiversity/bii_target_apr24/postsolve.gms" diff --git a/modules/70_livestock/fbask_jan16/realization.gms b/modules/70_livestock/fbask_jan16/realization.gms index 97f9aa427..c3b44b9eb 100644 --- a/modules/70_livestock/fbask_jan16/realization.gms +++ b/modules/70_livestock/fbask_jan16/realization.gms @@ -84,6 +84,7 @@ $Ifi "%phase%" == "sets" $include "./modules/70_livestock/fbask_jan16/sets.gms" $Ifi "%phase%" == "declarations" $include "./modules/70_livestock/fbask_jan16/declarations.gms" $Ifi "%phase%" == "input" $include "./modules/70_livestock/fbask_jan16/input.gms" $Ifi "%phase%" == "equations" $include "./modules/70_livestock/fbask_jan16/equations.gms" +$Ifi "%phase%" == "scaling" $include "./modules/70_livestock/fbask_jan16/scaling.gms" $Ifi "%phase%" == "preloop" $include "./modules/70_livestock/fbask_jan16/preloop.gms" $Ifi "%phase%" == "presolve" $include "./modules/70_livestock/fbask_jan16/presolve.gms" $Ifi "%phase%" == "postsolve" $include "./modules/70_livestock/fbask_jan16/postsolve.gms" diff --git a/modules/70_livestock/scaling.gms b/modules/70_livestock/fbask_jan16/scaling.gms similarity index 100% rename from modules/70_livestock/scaling.gms rename to modules/70_livestock/fbask_jan16/scaling.gms diff --git a/modules/70_livestock/fbask_jan16_sticky/realization.gms b/modules/70_livestock/fbask_jan16_sticky/realization.gms index 46ff7d532..734972e76 100644 --- a/modules/70_livestock/fbask_jan16_sticky/realization.gms +++ b/modules/70_livestock/fbask_jan16_sticky/realization.gms @@ -102,6 +102,7 @@ $Ifi "%phase%" == "sets" $include "./modules/70_livestock/fbask_jan16_sticky/set $Ifi "%phase%" == "declarations" $include "./modules/70_livestock/fbask_jan16_sticky/declarations.gms" $Ifi "%phase%" == "input" $include "./modules/70_livestock/fbask_jan16_sticky/input.gms" $Ifi "%phase%" == "equations" $include "./modules/70_livestock/fbask_jan16_sticky/equations.gms" +$Ifi "%phase%" == "scaling" $include "./modules/70_livestock/fbask_jan16_sticky/scaling.gms" $Ifi "%phase%" == "preloop" $include "./modules/70_livestock/fbask_jan16_sticky/preloop.gms" $Ifi "%phase%" == "presolve" $include "./modules/70_livestock/fbask_jan16_sticky/presolve.gms" $Ifi "%phase%" == "postsolve" $include "./modules/70_livestock/fbask_jan16_sticky/postsolve.gms" diff --git a/modules/71_disagg_lvst/foragebased_jul23/scaling.gms b/modules/70_livestock/fbask_jan16_sticky/scaling.gms similarity index 65% rename from modules/71_disagg_lvst/foragebased_jul23/scaling.gms rename to modules/70_livestock/fbask_jan16_sticky/scaling.gms index c3e721d03..120fe5716 100644 --- a/modules/71_disagg_lvst/foragebased_jul23/scaling.gms +++ b/modules/70_livestock/fbask_jan16_sticky/scaling.gms @@ -5,6 +5,6 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -vm_costs_additional_mon.scale(i) = 10e4; -*Don't scale this variable. Model is very sensitive to scaling this variable and might become infeasible or very slow. -*v71_feed_balanceflow.scale(j,kforage) = 10e3; + +vm_cost_prod_livst.scale(i,factors) = 10e5; +vm_cost_prod_fish.scale(i) = 10e5; diff --git a/modules/71_disagg_lvst/foragebased_aug18/realization.gms b/modules/71_disagg_lvst/foragebased_aug18/realization.gms index 00e90d401..94a0fdc42 100644 --- a/modules/71_disagg_lvst/foragebased_aug18/realization.gms +++ b/modules/71_disagg_lvst/foragebased_aug18/realization.gms @@ -24,7 +24,6 @@ $Ifi "%phase%" == "sets" $include "./modules/71_disagg_lvst/foragebased_aug18/sets.gms" $Ifi "%phase%" == "declarations" $include "./modules/71_disagg_lvst/foragebased_aug18/declarations.gms" $Ifi "%phase%" == "equations" $include "./modules/71_disagg_lvst/foragebased_aug18/equations.gms" -$Ifi "%phase%" == "scaling" $include "./modules/71_disagg_lvst/foragebased_aug18/scaling.gms" $Ifi "%phase%" == "preloop" $include "./modules/71_disagg_lvst/foragebased_aug18/preloop.gms" $Ifi "%phase%" == "postsolve" $include "./modules/71_disagg_lvst/foragebased_aug18/postsolve.gms" *######################## R SECTION END (PHASES) ############################### diff --git a/modules/71_disagg_lvst/foragebased_aug18/scaling.gms b/modules/71_disagg_lvst/foragebased_aug18/scaling.gms deleted file mode 100644 index a9ec69a79..000000000 --- a/modules/71_disagg_lvst/foragebased_aug18/scaling.gms +++ /dev/null @@ -1,10 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -vm_costs_additional_mon.scale(i) = 10e4; -*Don't scale this variable. Model is very sensitive to scaling this variable and might become infeasible or very slow. -*v71_feed_balanceflow.scale(j,kli_rum,kforage) = 10e3; diff --git a/modules/71_disagg_lvst/foragebased_jul23/realization.gms b/modules/71_disagg_lvst/foragebased_jul23/realization.gms index 638bb9c52..d1cb9f650 100644 --- a/modules/71_disagg_lvst/foragebased_jul23/realization.gms +++ b/modules/71_disagg_lvst/foragebased_jul23/realization.gms @@ -24,7 +24,6 @@ $Ifi "%phase%" == "sets" $include "./modules/71_disagg_lvst/foragebased_jul23/sets.gms" $Ifi "%phase%" == "declarations" $include "./modules/71_disagg_lvst/foragebased_jul23/declarations.gms" $Ifi "%phase%" == "equations" $include "./modules/71_disagg_lvst/foragebased_jul23/equations.gms" -$Ifi "%phase%" == "scaling" $include "./modules/71_disagg_lvst/foragebased_jul23/scaling.gms" $Ifi "%phase%" == "preloop" $include "./modules/71_disagg_lvst/foragebased_jul23/preloop.gms" $Ifi "%phase%" == "postsolve" $include "./modules/71_disagg_lvst/foragebased_jul23/postsolve.gms" $Ifi "%phase%" == "nl_fix" $include "./modules/71_disagg_lvst/foragebased_jul23/nl_fix.gms" From 84436ed1b097027c420d1790c7a84d115ab9bec3 Mon Sep 17 00:00:00 2001 From: florianh Date: Wed, 6 Nov 2024 08:58:33 +0100 Subject: [PATCH 25/31] test --- modules/10_land/landmatrix_dec18/scaling.gms | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/10_land/landmatrix_dec18/scaling.gms b/modules/10_land/landmatrix_dec18/scaling.gms index 661fd1064..d948fc90a 100644 --- a/modules/10_land/landmatrix_dec18/scaling.gms +++ b/modules/10_land/landmatrix_dec18/scaling.gms @@ -6,5 +6,5 @@ *** | Contact: magpie@pik-potsdam.de vm_landdiff.scale = 10e3; -v10_balance_positive.scale(j,land_from) = 10e-3; -v10_balance_negative.scale(j,land_from) = 10e-3; +v10_balance_positive.scale(j,land_from) = 10e-6; +v10_balance_negative.scale(j,land_from) = 10e-6; From 815f223be98855f8d8988cad4bb6366c88c9d204 Mon Sep 17 00:00:00 2001 From: florianh Date: Wed, 6 Nov 2024 10:02:01 +0100 Subject: [PATCH 26/31] bugfix --- modules/10_land/landmatrix_dec18/scaling.gms | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/10_land/landmatrix_dec18/scaling.gms b/modules/10_land/landmatrix_dec18/scaling.gms index d948fc90a..4bb36e606 100644 --- a/modules/10_land/landmatrix_dec18/scaling.gms +++ b/modules/10_land/landmatrix_dec18/scaling.gms @@ -6,5 +6,5 @@ *** | Contact: magpie@pik-potsdam.de vm_landdiff.scale = 10e3; -v10_balance_positive.scale(j,land_from) = 10e-6; -v10_balance_negative.scale(j,land_from) = 10e-6; +v10_balance_positive.scale(j,land_from) = 10e-7; +v10_balance_negative.scale(j,land_from) = 10e-7; From 6592c0487ee5dbe281ca2640b0f307ab96ac6ed7 Mon Sep 17 00:00:00 2001 From: florianh Date: Wed, 6 Nov 2024 10:12:20 +0100 Subject: [PATCH 27/31] changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0eb11e278..1704a4f64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **config** SHAPE scenarios start year of dietary shift changed to 2025 - **core** number of age-classes doubled from 150 to 300 years for better match of growth curves with potential natural vegetation. - **35_natveg** revised age-class initialization of secondary forest +- **modules** update of scaling factors in several modules + ### added - **62_material** added switch to turn off future material demand for bioplastic @@ -28,6 +30,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **29_cropland** treecover age-class growth was not working properly because ac_sub was erroneously not fixed - **scripts** script/output/extra/resubmit.R - **28_ageclass** bugfix input data unit and code clean-up. Renamed `feb21` realization to `oct24` +- **70_livestock** bugfix scaling.gms file in wrong folder +- **10_land** bugfix land transition matrix for improved feasibility (variables and parameters have different accuracy) +- **44_biodiversity** avoid division by zero and improved consistency between realisations for fixing variables ## [4.8.2] - 2024-09-24 From aa034ef644048018219664b51bc58ce0b7fc3dbb Mon Sep 17 00:00:00 2001 From: florianh Date: Wed, 6 Nov 2024 13:42:05 +0100 Subject: [PATCH 28/31] bugfix typo --- modules/44_biodiversity/bii_target_apr24/presolve.gms | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/44_biodiversity/bii_target_apr24/presolve.gms b/modules/44_biodiversity/bii_target_apr24/presolve.gms index 487b68041..5a3ee7f43 100644 --- a/modules/44_biodiversity/bii_target_apr24/presolve.gms +++ b/modules/44_biodiversity/bii_target_apr24/presolve.gms @@ -23,7 +23,7 @@ else ); p44_bii_lower_bound(t2,i,biome44)$(p44_bii_lower_bound(t2,i,biome44) >= 1) = 1; p44_bii_lower_bound(t2,i,biome44)$(m_year(t2) < s44_start_year) = 0; - p44_bii_lower_bound(t2,i,biome44)$(sum(cell(i,j), f44_biome(j,biome44)**f44_rr_layer(j)) <= 1e-10) = 0; + p44_bii_lower_bound(t2,i,biome44)$(sum(cell(i,j), f44_biome(j,biome44)*f44_rr_layer(j)) <= 1e-10) = 0; * The lower bound of `v44_bii` is set to `p44_bii_lower_bound` to avoid a reduction of BII in combination with `v44_bii_missing`. v44_bii.lo(i,biome44) = p44_bii_lower_bound(t,i,biome44); display p44_bii_lower_bound; From 1a84ac8e51ec998f5471a5529544352a4e479d7d Mon Sep 17 00:00:00 2001 From: florianh Date: Wed, 6 Nov 2024 14:21:47 +0100 Subject: [PATCH 29/31] update start scripts --- scripts/start/projects/paper_peatlandTax.R | 12 ++++++++++-- scripts/start/projects/project_ABCDR.R | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/scripts/start/projects/paper_peatlandTax.R b/scripts/start/projects/paper_peatlandTax.R index 5b20f9e1b..43dccf667 100644 --- a/scripts/start/projects/paper_peatlandTax.R +++ b/scripts/start/projects/paper_peatlandTax.R @@ -23,7 +23,7 @@ source("scripts/start_functions.R") source("config/default.cfg") # create additional information to describe the runs -cfg$info$flag <- "PTax35" +cfg$info$flag <- "PTax36" cfg$results_folder <- "output/:title:" cfg$results_folder_highres <- "output" @@ -69,6 +69,7 @@ calc_ghgprice <- function() { T200[, , "n2o_n_indirect"] <- T200[, , "co2_c"] * 265 * 44 / 28 T200[, , "co2_c"] <- T200[, , "co2_c"] * 44 / 12 + T25 <- T200 * 0.125 T50 <- T200 * 0.25 T100 <- T200 * 0.5 T400 <- T200 * 2 @@ -76,6 +77,12 @@ calc_ghgprice <- function() { GHG <- mbind( add_dimension(T0, dim = 3.2, add = "scen", nm = "T0-GHG"), + add_dimension( + T25, + dim = 3.2, + add = "scen", + nm = "T25-GHG" + ), add_dimension( T50, dim = 3.2, @@ -158,7 +165,8 @@ for (res in c("c400")) { start_run(cfg, codeCheck = FALSE) ## Policy scenarios - for (tax in c("T50-CO2", + for (tax in c("T25-CO2", + "T50-CO2", "T100-CO2", "T200-CO2", "T400-CO2", diff --git a/scripts/start/projects/project_ABCDR.R b/scripts/start/projects/project_ABCDR.R index cf52c94a9..c721ab8aa 100644 --- a/scripts/start/projects/project_ABCDR.R +++ b/scripts/start/projects/project_ABCDR.R @@ -19,7 +19,7 @@ source("config/default.cfg") #download_and_update(cfg) # create additional information to describe the runs -cfg$info$flag <- "ABCDR16" +cfg$info$flag <- "ABCDR17" cfg$results_folder <- "output/:title:" cfg$force_replace <- TRUE From 3323a4e8c63fb5e66794d6afec0f2f5750a488ef Mon Sep 17 00:00:00 2001 From: florianh Date: Fri, 8 Nov 2024 12:57:49 +0100 Subject: [PATCH 30/31] remove scaling for 29_cropland --- modules/29_cropland/detail_apr24/realization.gms | 1 - modules/29_cropland/detail_apr24/scaling.gms | 9 --------- 2 files changed, 10 deletions(-) delete mode 100644 modules/29_cropland/detail_apr24/scaling.gms diff --git a/modules/29_cropland/detail_apr24/realization.gms b/modules/29_cropland/detail_apr24/realization.gms index c9b62fec8..071000bd1 100644 --- a/modules/29_cropland/detail_apr24/realization.gms +++ b/modules/29_cropland/detail_apr24/realization.gms @@ -25,7 +25,6 @@ $Ifi "%phase%" == "sets" $include "./modules/29_cropland/detail_apr24/sets.gms" $Ifi "%phase%" == "declarations" $include "./modules/29_cropland/detail_apr24/declarations.gms" $Ifi "%phase%" == "input" $include "./modules/29_cropland/detail_apr24/input.gms" $Ifi "%phase%" == "equations" $include "./modules/29_cropland/detail_apr24/equations.gms" -$Ifi "%phase%" == "scaling" $include "./modules/29_cropland/detail_apr24/scaling.gms" $Ifi "%phase%" == "preloop" $include "./modules/29_cropland/detail_apr24/preloop.gms" $Ifi "%phase%" == "presolve" $include "./modules/29_cropland/detail_apr24/presolve.gms" $Ifi "%phase%" == "postsolve" $include "./modules/29_cropland/detail_apr24/postsolve.gms" diff --git a/modules/29_cropland/detail_apr24/scaling.gms b/modules/29_cropland/detail_apr24/scaling.gms deleted file mode 100644 index 49bccf2ac..000000000 --- a/modules/29_cropland/detail_apr24/scaling.gms +++ /dev/null @@ -1,9 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -v29_treecover.scale(j,ac) = 10e-3; -v29_treecover_missing.scale(j) = 10e-3; From 0ebe1364cdf9b8b86dd6f5aae3a736b472951c72 Mon Sep 17 00:00:00 2001 From: florianh Date: Fri, 8 Nov 2024 13:43:06 +0100 Subject: [PATCH 31/31] start script update counter --- scripts/start/projects/project_ABCDR.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/start/projects/project_ABCDR.R b/scripts/start/projects/project_ABCDR.R index c721ab8aa..a36e9c200 100644 --- a/scripts/start/projects/project_ABCDR.R +++ b/scripts/start/projects/project_ABCDR.R @@ -19,7 +19,7 @@ source("config/default.cfg") #download_and_update(cfg) # create additional information to describe the runs -cfg$info$flag <- "ABCDR17" +cfg$info$flag <- "ABCDR18" cfg$results_folder <- "output/:title:" cfg$force_replace <- TRUE