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
bc47f15e
Commit
bc47f15e
authored
8 years ago
by
Peter Alexander
Browse files
Options
Downloads
Patches
Plain Diff
Some fixes. To try to stop pasture disappearing.
parent
65ea262e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
GAMS/IntExtOpt.gms
+4
-9
4 additions, 9 deletions
GAMS/IntExtOpt.gms
src/ac/ed/lurg/ModelConfig.java
+1
-1
1 addition, 1 deletion
src/ac/ed/lurg/ModelConfig.java
src/ac/ed/lurg/country/gams/GamsRasterOptimiser.java
+14
-11
14 additions, 11 deletions
src/ac/ed/lurg/country/gams/GamsRasterOptimiser.java
with
19 additions
and
21 deletions
GAMS/IntExtOpt.gms
+
4
−
9
View file @
bc47f15e
...
...
@@ -36,7 +36,7 @@
SCALAR unhandledCropArea includes fruit veg forage crops set aside and failed crop;
SCALAR domesticPriceMarkup factor price increased from cost of production;
*$gdxin "/Users/peteralexander/Documents/R_Workspace/temp/GamsT
est
/_gams_java_
1091455539
.gdx"
*$gdxin "/Users/peteralexander/Documents/R_Workspace/
UNPLUM/
temp/GamsT
mp
/_gams_java_
gdb1
.gdx"
$gdxin %gdxincname%
$load location, suitableLandArea, previousArea, demand, landChangeCost
$load yieldNone, yieldFertOnly, yieldIrrigOnly, yieldBoth
...
...
@@ -183,15 +183,10 @@ $gdxin
) * domesticPriceMarkup +
SUM(import_crop, importAmount(import_crop) * worldImportPrices(import_crop) - exportAmount(import_crop) * worldExportPrices(import_crop))
)
/ 1000000
;
);
MODEL LAND_USE /ALL/ ;
fertI.L(crop, location) = 0.5;
irrigI.L(crop, location) = 0.5;
otherIntensity.L(crop, location) = 0.5;
importAmount.L(import_crop)$((maxNetImport(import_crop) + minNetImport(import_crop)) gt 0) = (maxNetImport(import_crop) + minNetImport(import_crop)) / 2;
exportAmount.L(import_crop)$((maxNetImport(import_crop) + minNetImport(import_crop)) lt 0) = -(maxNetImport(import_crop) + minNetImport(import_crop)) / 2;
...
...
@@ -199,7 +194,7 @@ $gdxin
SOLVE LAND_USE USING NLP MINIMIZING total_cost;
* display agriLandExpansion.l, previousArea, area.l, net_supply.l, demand, feedAmount.l, yield.l, importAmount.l, exportAmount.l;
* display unitCost.l, area.l, pastureDecrease.l, cropIncrease.l
* Calculate summary information used in Java process
parameter totalProd(all_types);
...
...
@@ -225,7 +220,7 @@ $gdxin
feedCost(feed_crop)$(netImportAmount(feed_crop) le 0 and totalProd(feed_crop) gt 0) = totalProdCost(feed_crop) * feedAmount.l(feed_crop) / totalProd(feed_crop);
totalProdCost('meat') = sum(feed_crop, feedCost(feed_crop));
* display totalProdCost, totalProd,
total
ImportCost
, feedCost, totalProdCost
* display totalProdCost, totalProd,
net
ImportCost
Scalar ms 'model status', ss 'solve status';
ms=LAND_USE.modelstat;
...
...
This diff is collapsed.
Click to expand it.
src/ac/ed/lurg/ModelConfig.java
+
1
−
1
View file @
bc47f15e
...
...
@@ -139,7 +139,7 @@ public class ModelConfig {
// Fertiliser application rates in kg/ha
public
static
final
double
MIN_FERT_AMOUNT
=
getDoubleProperty
(
"MIN_FERT_AMOUNT"
,
5.0
);
public
static
final
double
MID_FERT_AMOUNT
=
getDoubleProperty
(
"MID_FERT_AMOUNT"
,
20.0
);
public
static
final
double
MAX_FERT_AMOUNT
=
getDoubleProperty
(
"M
ID
_FERT_AMOUNT"
,
200.0
);
public
static
final
double
MAX_FERT_AMOUNT
=
getDoubleProperty
(
"M
AX
_FERT_AMOUNT"
,
200.0
);
public
static
final
int
FERT_AMOUNT_PADDING
=
getIntProperty
(
"FERT_AMOUNT_PADDING"
,
3
);;
// Other model parameters
...
...
This diff is collapsed.
Click to expand it.
src/ac/ed/lurg/country/gams/GamsRasterOptimiser.java
+
14
−
11
View file @
bc47f15e
...
...
@@ -2,7 +2,6 @@ package ac.ed.lurg.country.gams;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -53,7 +52,7 @@ public class GamsRasterOptimiser {
GamsLocationOutput
result
=
null
;
/
/ t
his code
does similar calibration to that in the GAMS script
/
* T
his code
used to try to do some calibration, but was causing more distortions than it fixed.
if (gamsInput.getCountryInput().isCalibrateToObserved()) {
Map<CropType, Double> cropAdjustments = new HashMap<CropType, Double>(); // recreate, but might have been null is this case anyway
for (CropType c : CropType.getNonMeatTypes()) {
...
...
@@ -63,8 +62,6 @@ public class GamsRasterOptimiser {
double baseCropland = LandUseItem.getTotalLandCover(gamsInput.getPreviousLandUse().values(), LandCoverType.CROPLAND);
double basePasture = LandUseItem.getTotalLandCover(gamsInput.getPreviousLandUse().values(), LandCoverType.PASTURE);
LogWriter
.
println
(
"baseCropland="
+
baseCropland
+
", basePasture="
+
basePasture
);
for (int i=0; i<ModelConfig.NUM_CALIBRATION_ITERATIONS; i++) {
GamsLocationInput newInput = GamsLocationInput.createWithNewAdjustments(gamsInput, cropAdjustments);
...
...
@@ -87,10 +84,10 @@ public class GamsRasterOptimiser {
}
}
}
else
{
else {
*/
GamsLocationOptimiser
opti
=
new
GamsLocationOptimiser
(
gamsInput
);
result
=
opti
.
run
();
}
//
}
return
result
;
}
...
...
@@ -360,17 +357,19 @@ public class GamsRasterOptimiser {
aggIrig
.
setMaxIrrigAmount
(
crop
,
aggregateMean
(
aggIrig
.
getMaxIrrigAmount
(
crop
),
suitableAreaSoFar
,
irrigMax
,
suitableAreaThisTime
));
}
double
areaSoFar
=
aggLandUse
.
getCropArea
(
crop
);
double
areaThisTime
=
landUseItem
.
getCropArea
(
crop
);
for
(
YieldType
yieldType
:
YieldType
.
values
())
{
double
y
=
yresp
.
getYield
(
yieldType
,
crop
);
if
(
Double
.
isNaN
(
y
))
logErrorWithCoord
(
"Problem getting yield for type:"
+
yieldType
+
", "
,
key
,
yieldRaster
,
crop
);
else
aggYResp
.
setYield
(
yieldType
,
crop
,
aggregateMean
(
aggYResp
.
getYield
(
yieldType
,
crop
),
areaSoFar
,
y
,
areaThisTime
));
else
{
double
yieldSoFar
=
aggYResp
.
getYield
(
yieldType
,
crop
);
double
updatedYield
=
aggregateMean
(
yieldSoFar
,
suitableAreaSoFar
,
y
,
suitableAreaThisTime
);
aggYResp
.
setYield
(
yieldType
,
crop
,
updatedYield
);
}
}
double
areaSoFar
=
aggLandUse
.
getCropArea
(
crop
);
double
areaThisTime
=
landUseItem
.
getCropArea
(
crop
);
double
updateCropland
=
(
landUseItem
.
getLandCoverArea
(
LandCoverType
.
CROPLAND
)
+
aggLandUse
.
getLandCoverArea
(
LandCoverType
.
CROPLAND
));
if
(
updateCropland
>
0
)
...
...
@@ -402,6 +401,10 @@ public class GamsRasterOptimiser {
LogWriter.println("");
} */
}
double
baseCropland
=
LandUseItem
.
getTotalLandCover
(
aggregatedAreas
.
values
(),
LandCoverType
.
CROPLAND
);
double
basePasture
=
LandUseItem
.
getTotalLandCover
(
aggregatedAreas
.
values
(),
LandCoverType
.
PASTURE
);
LogWriter
.
println
(
"\nbaseCropland="
+
baseCropland
+
", basePasture="
+
basePasture
);
return
new
GamsLocationInput
(
rasterInputData
.
getTimestep
(),
aggregatedYields
,
aggregatedAreas
,
aggregatedIrrigCosts
,
rasterInputData
.
getCountryInput
());
}
...
...
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