Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PLUM
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Land Use Lab
PLUM
Merge requests
!2
Bringing Bart's recent changes into the inequality branch
Code
Review changes
Check out branch
Download
Patches
Plain diff
Expand sidebar
Closed
Bringing Bart's recent changes into the inequality branch
master
into
subnational_inequality
Overview
0
Commits
51
Changes
3
Closed
Bringing Bart's recent changes into the inequality branch
s1713176
requested to merge
master
into
subnational_inequality
Aug 19, 2024
Overview
0
Commits
51
Changes
3
Including abandonment of agricultural land
0
0
Merge request reports
Viewing commit
0a702a0f
Prev
Next
Show latest version
3 files
+
8
−
8
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
0a702a0f
Sigmoid function for dietary preferences change.
· 0a702a0f
Bart Arendarczyk
authored
Jun 12, 2024
src/ac/ed/lurg/country/gams/DietParamCalculationManager.java
+
3
−
4
View file @ 0a702a0f
Edit in single-file editor
Open in Web IDE
Show full file
@@ -39,10 +39,9 @@ public class DietParamCalculationManager {
}
private
double
interpolateParam
(
int
year
,
double
initialParam
,
double
shiftParam
)
{
double
ratio
=
(
double
)
(
year
-
ModelConfig
.
DIET_CHANGE_START_YEAR
)
/
(
ModelConfig
.
DIET_CHANGE_END_YEAR
-
ModelConfig
.
DIET_CHANGE_START_YEAR
);
ratio
=
Math
.
min
(
Math
.
max
(
ratio
,
0
),
1
);
double
offset
=
(
ModelConfig
.
DIET_CHANGE_END_YEAR
-
ModelConfig
.
DIET_CHANGE_START_YEAR
)
/
2.0
;
double
x
=
year
-
ModelConfig
.
DIET_CHANGE_START_YEAR
;
double
ratio
=
1
/
(
1
+
Math
.
exp
(-
ModelConfig
.
DIET_CHANGE_RATE
*
(
x
-
offset
)));
// sigmoid
return
ratio
*
shiftParam
+
(
1
-
ratio
)
*
initialParam
;
}
Loading