Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfixes for more robust feasibility #744

Merged
merged 32 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
8 changes: 4 additions & 4 deletions modules/10_land/landmatrix_dec18/declarations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
9 changes: 4 additions & 5 deletions modules/10_land/landmatrix_dec18/equations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,16 @@
*' `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, pcm_land(j2,land));
sum((land_from,land_to), vm_lu_transitions(j2,land_from,land_to)) =e=
sum(land, vm_land(j2,land));

q10_transition_to(j2,land_to) ..
sum(land_from, vm_lu_transitions(j2,land_from,land_to)) =e=
vm_land(j2,land_to);

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) + v10_balance_positive(j2,land_from) - v10_balance_negative(j2,land_from);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that vm_land.l should suppose to be the same as pcm_land.
But as you also pointed out pcm_land is actually changed in some resolve functions, so this is not at all identical or not?

I am not 100% sure why we need this balancing, if we could just define a variable with a level that has the correct value of pcm_land?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this instance it does not make a difference if we use pcm_land or vm_land.l. They should be identical.
The point is that vm_land.l is changed in the presolve based on parameters, which seem to have a different accuracy than the variable.
I tried without the balancing variables. But without them some of the test runs are infeasible.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know this formulation from equations. Thought that's a presolve/postsolve thing. Are you sure that works?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And in the above two equations, you really want the variable and not the level, right? Just to make sure because the first one (q10_transition_matrix) has changed from pcm_land to vm_land, not vm_land.l

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know this formulation from equations. Thought that's a presolve/postsolve thing. Are you sure that works?

Yes, it works ;-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And in the above two equations, you really want the variable and not the level, right? Just to make sure because the first one (q10_transition_matrix) has changed from pcm_land to vm_land, not vm_land.l

I was thinking about the reasons for the infeasible solutions and came to the conclusiong that it might be due to inconsistencies in these 3 equations from the use of vm_land and pcm_land.
Therefore, I switched to vm_land in the first two equations and vm_land.l in third equation.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't fully understand why, but I am happy the infeasibilities are gone, so I'm gonna approve.


*' The following two equations calculate land expansion and land contraction based
*' on the above land transition matrix.
Expand All @@ -47,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]
Expand Down
16 changes: 8 additions & 8 deletions modules/10_land/landmatrix_dec18/postsolve.gms
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions modules/10_land/landmatrix_dec18/scaling.gms
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
*** | Contact: [email protected]

vm_landdiff.scale = 10e3;
v10_balance_positive.scale(j) = 10e-10;
v10_balance_negative.scale(j) = 10e-10;
v10_balance_positive.scale(j,land_from) = 10e-7;
v10_balance_negative.scale(j,land_from) = 10e-7;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain what is happening here? Why does it help to switch to 10^-7?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran gdx2::calcScaling(gdx) on a couple of different test runs. For most of them the suggestion is to use 10^-7 for scaling.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay this may be more of an understanding question, so the scaling tells gams the order of magnitude of step lengths when iterating towards a local optimum?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://www.gams.com/latest/docs/S_CONOPT4.html#CONOPT4_SCALING
internal_model = user_model / scaling_factor
GAMS is also doing automatic scaling but the default for Tol_Scale_Min is 1. Since we have manual scaling factors < 1 I think we should use Tol_Scale_Min = 1.e-10; in the optFile.
https://www.gams.com/latest/docs/S_CONOPT4.html#CONOPTTol_Scale_Min

2 changes: 1 addition & 1 deletion modules/20_processing/substitution_may21/scaling.gms
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
*** | MAgPIE License Exception, version 1.0 (see LICENSE file).
*** | Contact: [email protected]

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;
4 changes: 3 additions & 1 deletion modules/38_factor_costs/sticky_labor/scaling.gms
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@
*** | MAgPIE License Exception, version 1.0 (see LICENSE file).
*** | Contact: [email protected]

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;
3 changes: 2 additions & 1 deletion modules/44_biodiversity/bii_target/equations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down
2 changes: 1 addition & 1 deletion modules/44_biodiversity/bii_target/presolve.gms
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this change (and other similar changes where 0 is replaced with 1e-10) necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this specific case for bii_target it was inconsistent with presolve and equations, where it is already 1e-10.
The intention is to fix v44_bii to zero in case the biome share f44_biome is very small. And this case also the lower bound should be zero.
I implemented the same logic for the bii_target_apr24 realisation.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not convinced. Replacing small values with 0 / treating zeros the same as tiny numbers seems like losing control. We don't quite know why this works, but if we replace it with zero it works, and it's almost zero anyway... I have a bad feeling about this practice, we are piling up ultra hard to debug problems in our code this way is my feeling. This is of course more a general comment and not specific to this instance/PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this point. Why should it be an issue to treat tiny numbers like zero?
My understanding is that such tiny numbers might cause issues for the solver.
We also do this in other parts of the model.
For debugging we have off / simple module realizations in many cases.
Do you have another suggestion for addressing this problem?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why should it be an issue to treat tiny numbers like zero?

It's just mathematically wrong, and we don't understand the implications. This lack of control what's going on is what's bugging me, but that is of course inherent to using gams/conopt4, so not something we can change easily :/

We also do this in other parts of the model.

That is not a great argument and just makes me feel more anxious.

Do you have another suggestion for addressing this problem?

Unfortunately no, I cannot follow what is happening really, so I'll approve. Wanted to emphasize my concerns though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be interested in the other reviewers perspective on this @tscheypidi @FelicitasBeier @k4rst3ns :) Am I just worrying to much? 🙈

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I totally get your concern. It has been a common practice in the past, though. So maybe something to discuss in the next MAgPIE meeting?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same concern here.

On Florians:

My understanding is that such tiny numbers might cause issues for the solver

... I would not know why theoretically and generally this should be an issue.
We observed that over the years, but do not have a great understanding here.

But I am also see @flohump point: this is not specific to this PR. And I like @FelicitasBeier suggestion bringing this up to the MAgPIE meeting and approving this for now.

* 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;
Expand Down
7 changes: 4 additions & 3 deletions modules/44_biodiversity/bii_target_apr24/equations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -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)) > 0) .. 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)) > 0) ..
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.
Expand Down
4 changes: 2 additions & 2 deletions modules/44_biodiversity/bii_target_apr24/preloop.gms
Original file line number Diff line number Diff line change
Expand Up @@ -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(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;
2 changes: 1 addition & 1 deletion modules/44_biodiversity/bii_target_apr24/presolve.gms
Original file line number Diff line number Diff line change
Expand Up @@ -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(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;
Expand Down
1 change: 1 addition & 0 deletions modules/70_livestock/fbask_jan16/realization.gms
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions modules/70_livestock/fbask_jan16_sticky/realization.gms
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
*** | MAgPIE License Exception, version 1.0 (see LICENSE file).
*** | Contact: [email protected]

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;
1 change: 0 additions & 1 deletion modules/71_disagg_lvst/foragebased_aug18/realization.gms
Original file line number Diff line number Diff line change
Expand Up @@ -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) ###############################
10 changes: 0 additions & 10 deletions modules/71_disagg_lvst/foragebased_aug18/scaling.gms

This file was deleted.

1 change: 0 additions & 1 deletion modules/71_disagg_lvst/foragebased_jul23/realization.gms
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion scripts/projects/fsec.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
12 changes: 10 additions & 2 deletions scripts/start/projects/paper_peatlandTax.R
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -69,13 +69,20 @@ 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
T800 <- T200 * 4

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,
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion scripts/start/projects/project_ABCDR.R
Original file line number Diff line number Diff line change
Expand Up @@ -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 <- "ABCDR18"

cfg$results_folder <- "output/:title:"
cfg$force_replace <- TRUE
Expand Down
Loading