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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Land Use Lab
PLUM
Commits
d2880d00
Commit
d2880d00
authored
10 years ago
by
Peter Alexander
Browse files
Options
Downloads
Patches
Plain Diff
Added imports
parent
c64eb11b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
GAMS/IntExtOpt.gms
+21
-15
21 additions, 15 deletions
GAMS/IntExtOpt.gms
src/ac/ed/lurg/GamsTest.java
+9
-0
9 additions, 0 deletions
src/ac/ed/lurg/GamsTest.java
with
30 additions
and
15 deletions
GAMS/IntExtOpt.gms
+
21
−
15
View file @
d2880d00
SET all_types crop types including pasture and animal products / cereals, fruits, oilcrops, starchyRoots, treenuts, vegetables, pasture, meat /;
SET crop crop types including pasture / cereals, fruits, oilcrops, starchyRoots, treenuts, vegetables, pasture /;
SET commodities(all_types) crop types including pasture / cereals, fruits, oilcrops, starchyRoots, treenuts, vegetables, meat /;
SET crop(all_types) crop types including pasture / cereals, fruits, oilcrops, starchyRoots, treenuts, vegetables, pasture /;
SET crop_less_pasture(crop) arable crops types includes treenuts but not pasture / cereals, fruits, oilcrops, starchyRoots, treenuts, vegetables /;
SET feed_crop(crop) / cereals, oilcrops /;
SET landuse land use type / cropland, pasture /;
PARAMETER previous_area(landuse) areas for previous timestep in ha;
PARAMETER demand(crop) yield in t per ha;
PARAMETER demand(crop
_less_pasture
) yield in t per ha;
PARAMETER yield_ref(crop) yield in t per ha;
PARAMETER world_input_energy(crop_less_pasture) average input energy from world exports used to determine if we should import or export;
SCALAR meatDemand;
SCALAR meatEfficency;
SCALAR worldMeatInputEnergy
SCALAR maxLandUseChange;
SCALAR maxIntensity;
$gdxin %gdxincname%
$load previous_area, demand, yield_ref, meatDemand, meatEfficency, maxLandUseChange, maxIntensity
$load previous_area, demand, yield_ref,
world_input_energy,
meatDemand, meatEfficency,
worldMeatInputEnergy,
maxLandUseChange, maxIntensity
$gdxin
PARAMETER feedEnergy(crop) energy from feed in MJ per t
/ cereals 1
oilcrops 1.5
pasture 0.4
/ ;
pasture 0.4 / ;
VARIABLES
area(crop) total area for each crop
feedArea(crop) area used for feed for each crop
intensity(crop) intensity for each crop
yield(crop) yield per area for each crop
unit_energy(crop) energy per area for each crop
energy total input energy;
area(crop) total area for each crop - ha
feedArea(crop) area used for feed for each crop - ha
intensity(crop) intensity for each crop - unitless
yield(crop) yield per area for each crop - t per ha
unit_energy(crop) energy per area for each crop - energy
importAmount(crop_less_pasture) import of crop - t
meatImport meat import - t
energy total input energy - energy;
POSITIVE VARIABLE area, intensity, feedArea;
POSITIVE VARIABLE area, intensity, feedArea
, importAmount, meatImport
;
EQUATIONS
UNIT_ENERGY_EQ(crop) energy per area
...
...
@@ -49,10 +55,10 @@ $gdxin
YIELD_EQ(crop) .. yield(crop) =E= yield_ref(crop) * intensity(crop);
CROP_DEMAND_CONSTRAINT(crop_less_pasture) .. (area(crop_less_pasture) - feedArea(crop_less_pasture)) * yield(crop_less_pasture) =G= demand(crop_less_pasture);
CROP_DEMAND_CONSTRAINT(crop_less_pasture) .. (area(crop_less_pasture) - feedArea(crop_less_pasture)) * yield(crop_less_pasture) =G= demand(crop_less_pasture)
- importAmount(crop_less_pasture)
;
MEAT_DEMAND_CONSTRAINT .. meatEfficency*sum(feed_crop, feedEnergy(feed_crop) * feedArea(feed_crop) * yield(feed_crop)) +
feedEnergy('pasture') * area('pasture') * yield('pasture') =G= meatDemand;
feedEnergy('pasture') * area('pasture') * yield('pasture') =G= meatDemand
- meatImport
;
MIN_INTENSITY_CONSTRAINT(crop) .. intensity(crop) =G= 1;
...
...
@@ -64,7 +70,7 @@ $gdxin
AGRI_LAND_CHANGE_CONSTRAINT .. abs(sum(crop, area(crop)) / sum(landuse, previous_area(landuse)) - 1) =L= maxLandUseChange;
ENERGY_EQ .. energy =E= SUM(crop, area(crop)*unit_energy(crop));
ENERGY_EQ .. energy =E= SUM(crop, area(crop)*unit_energy(crop))
+ sum(crop_less_pasture, importAmount(crop_less_pasture) * world_input_energy(crop_less_pasture) + meatImport * worldMeatInputEnergy)
;
MODEL LAND_USE /ALL/ ;
SOLVE LAND_USE USING DNLP MINIMIZING energy;
...
...
This diff is collapsed.
Click to expand it.
src/ac/ed/lurg/GamsTest.java
+
9
−
0
View file @
d2880d00
...
...
@@ -53,8 +53,17 @@ public class GamsTest {
parm
.
addRecord
(
"vegetables"
).
setValue
(
1
);
parm
.
addRecord
(
"pasture"
).
setValue
(
0.7
);
parm
=
db
.
addParameter
(
"world_input_energy"
,
1
,
"average input energy from world exports used to determine if we should import or export energy per t"
);
parm
.
addRecord
(
"cereals"
).
setValue
(
0.5
);
parm
.
addRecord
(
"fruits"
).
setValue
(
2.0
);
parm
.
addRecord
(
"oilcrops"
).
setValue
(
2.0
);
parm
.
addRecord
(
"starchyRoots"
).
setValue
(
0.3
);
parm
.
addRecord
(
"treenuts"
).
setValue
(
2.0
);
parm
.
addRecord
(
"vegetables"
).
setValue
(
2
);
db
.
addParameter
(
"meatDemand"
,
0
,
"demand for meat milk and eggs"
).
addRecord
().
setValue
(
160
);
db
.
addParameter
(
"meatEfficency"
,
0
,
"efficency of converting feed and pasture into animal products"
).
addRecord
().
setValue
(
0.1
);
db
.
addParameter
(
"worldMeatInputEnergy"
,
0
,
"world average meat export energy"
).
addRecord
().
setValue
(
3
);
db
.
addParameter
(
"maxLandUseChange"
,
0
,
"max rate of land use change"
).
addRecord
().
setValue
(
0.1
);
db
.
addParameter
(
"maxIntensity"
,
0
,
"max intensity which will rise over time"
).
addRecord
().
setValue
(
3
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment