From 5630863c8001545c54fcf742dfdd8c73dcdc7e30 Mon Sep 17 00:00:00 2001
From: Peter Alexander <peter@blackhillock.co.uk>
Date: Tue, 11 Apr 2017 09:51:04 +0100
Subject: [PATCH] Separate out param for agri expansion (again)

---
 GAMS/IntExtOpt.gms                               |  8 +++++---
 hindcast/hind_config.properties                  | 16 ++++++++++------
 src/ac/ed/lurg/ModelConfig.java                  |  5 +++--
 .../lurg/country/gams/GamsLocationOptimiser.java | 11 ++++++-----
 4 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/GAMS/IntExtOpt.gms b/GAMS/IntExtOpt.gms
index 15bc8a48..53d54f3f 100644
--- a/GAMS/IntExtOpt.gms
+++ b/GAMS/IntExtOpt.gms
@@ -30,7 +30,8 @@
  PARAMETER irrigMaxRate(crop, location)      max water application rate irrigation in litre per m2;
  PARAMETER irrigConstraint(location)         max water available for irrigation in litre per m2;
  
- PARAMETER pastureIncCost(location)          price for increasing pasture area varies based on amount of managed or unmanaged forest;
+ PARAMETER agriExpansionCost(location)       price for increase agricultural area varies based on amount of managed or unmanaged forest;
+ SCALAR pastureIncCost                       price for increasing pasture area ;
  SCALAR cropIncCost                          price for increasing crop;
  SCALAR cropOrPastureDecCost                 price for decreasing crop or pasture;
   
@@ -43,7 +44,7 @@
  
 *$gdxin "/Users/peteralexander/Documents/R_Workspace/UNPLUM/temp/GamsTmp/t1.gdx"
 $gdxin %gdxincname% 
-$load location, suitableLandArea, demand, cropIncCost, pastureIncCost, cropOrPastureDecCost
+$load location, suitableLandArea, demand, agriExpansionCost, cropIncCost, pastureIncCost, cropOrPastureDecCost
 $load previousArea, previousFertIntensity, previousIrrigIntensity, previousOtherIntensity
 $load yieldNone, yieldFertOnly, yieldIrrigOnly, yieldBoth
 $load fertParam, irrigParam, otherIParam, exportPrices, importPrices, maxNetImport, minNetImport, unhandledCropArea
@@ -193,8 +194,9 @@ $gdxin
               (   SUM((crop, location), area(crop, location) * unitCost(crop, location)) +
                   
                   SUM(location, 
+                     agriExpansionCost(location) * agriLandExpansion(location) +
                      cropIncCost * cropIncrease(location) + 
-                     pastureIncCost(location) * pastureIncrease(location) + 
+                     pastureIncCost * pastureIncrease(location) + 
                      cropOrPastureDecCost * cropDecrease(location) + 
                      cropOrPastureDecCost * pastureDecrease(location)
                      )
diff --git a/hindcast/hind_config.properties b/hindcast/hind_config.properties
index 8df5d8d8..876bb3e3 100644
--- a/hindcast/hind_config.properties
+++ b/hindcast/hind_config.properties
@@ -2,22 +2,26 @@ BASE_DIR=./hind1970
 INITAL_LAND_COVER_FILENAME=hurtt_1970.txt
 BASE_YEAR=1970
 SSP_SCENARIO=HINDCAST
-#YIELD_DIR=/Users/peteralexander/Documents/LURG/LPJ/19Jan2017/LPJG_PLUM_expt1.1_1971-2005_forED
-YIELD_DIR=/Users/peteralexander/Documents/LURG/LPJ/IPSL/LPJG_PLUM_expt1.1_1966-2005_ipsl_lessIO_forED
+YIELD_DIR=/Users/peteralexander/Documents/LURG/LPJ/19Jan2017/LPJG_PLUM_expt1.1_1971-2005_forED
+#YIELD_DIR=/Users/peteralexander/Documents/LURG/LPJ/IPSL/LPJG_PLUM_expt1.1_1966-2005_ipsl_lessIO_forED
 
 # irritatingly the gams file is also found under the BASE_DIR, and don't want to duplicate so need to specify exactly
 GAMS_MODEL=./GAMS/IntExtOpt.gms
 
 #DEBUG_LIMIT_COUNTRIES=true
-#DEBUG_COUNTRY_NAME=Pakistan
+DEBUG_COUNTRY_NAME=Europe & Central Asia_other
+#Russian Federation
+#Europe & Central Asia_other
 
-IS_CALIBRATION_RUN = false
+IS_CALIBRATION_RUN = true
 
-END_TIMESTEP=20
+END_TIMESTEP=0
 TIMESTEP_SIZE=2
 
 BIOENERGY_CHANGE_ANNUAL_RATE=0.25
 BIOENERGY_CHANGE_START_YEAR=1970
 BIOENERGY_CHANGE_END_YEAR=2010
 
-INTERPOLATE_OUTPUT_YEARS = false
\ No newline at end of file
+INTERPOLATE_OUTPUT_YEARS = false
+PASTURE_INCREASE_COST_BASE=0.01
+PASTURE_INCREASE_COST_MANAGED_FOREST=0.5
\ No newline at end of file
diff --git a/src/ac/ed/lurg/ModelConfig.java b/src/ac/ed/lurg/ModelConfig.java
index 964be977..7bbf116e 100644
--- a/src/ac/ed/lurg/ModelConfig.java
+++ b/src/ac/ed/lurg/ModelConfig.java
@@ -186,8 +186,9 @@ public class ModelConfig {
 	public static final double LAND_CHANGE_COST = getDoubleProperty("LAND_CHANGE_COST", 0.9);
 	public static final double CROP_INCREASE_COST = getDoubleProperty("CROP_INCREASE_COST", 1.0 * LAND_CHANGE_COST);
 	public static final double CROP_OR_PASTURE_DECREASE_COST = getDoubleProperty("CROP_OR_PASTURE_DECREASE_COST", 0.5 * LAND_CHANGE_COST);
-	public static final double PASTURE_INCREASE_COST_BASE = getDoubleProperty("PASTURE_INCREASE_COST_BASE", 0.02 * LAND_CHANGE_COST);
-	public static final double PASTURE_INCREASE_COST_MANAGED_FOREST = getDoubleProperty("PASTURE_INCREASE_COST_MANAGED_FOREST", 0.3 * LAND_CHANGE_COST);
+	public static final double PASTURE_INCREASE_COST = getDoubleProperty("PASTURE_INCREASE_COST", 0.02 * LAND_CHANGE_COST);
+	public static final double AGRI_EXPANSION_COST_BASE = getDoubleProperty("PASTURE_INCREASE_COST_MANAGED_FOREST", 0.02 * LAND_CHANGE_COST);
+	public static final double AGRI_EXPANSION_COST_BASE_MANAGED_FOREST = getDoubleProperty("PASTURE_INCREASE_COST_MANAGED_FOREST", 0.3 * LAND_CHANGE_COST);
 
 	public static final double SEED_AND_WASTE_FRACTION = getDoubleProperty("SEED_AND_WASTE_FRACTION", 0.15);  
 
diff --git a/src/ac/ed/lurg/country/gams/GamsLocationOptimiser.java b/src/ac/ed/lurg/country/gams/GamsLocationOptimiser.java
index 7700f14b..979a985b 100644
--- a/src/ac/ed/lurg/country/gams/GamsLocationOptimiser.java
+++ b/src/ac/ed/lurg/country/gams/GamsLocationOptimiser.java
@@ -89,11 +89,12 @@ public class GamsLocationOptimiser {
 		GAMSParameter prevIrrigIP = inDB.addParameter("previousIrrigIntensity", 2);
 		GAMSParameter prevOtherIP = inDB.addParameter("previousOtherIntensity", 2);
 		GAMSParameter landP = inDB.addParameter("suitableLandArea", 1);
-		GAMSParameter pastureIncCostP = inDB.addParameter("pastureIncCost", 1);		
+		GAMSParameter agriExpansionCostP = inDB.addParameter("agriExpansionCost", 1);		
 
 		addScalar(inDB, "cropIncCost", ModelConfig.CROP_INCREASE_COST, 3);		
 		addScalar(inDB, "cropOrPastureDecCost", ModelConfig.CROP_OR_PASTURE_DECREASE_COST, 3);		
-		
+		addScalar(inDB, "pastureIncCost", ModelConfig.PASTURE_INCREASE_COST, 3);		
+
 		double totalAgriLand = 0;
 
 		for (Map.Entry<Integer, ? extends LandUseItem> entry : inputData.getPreviousLandUse().entrySet()) {
@@ -105,9 +106,9 @@ public class GamsLocationOptimiser {
 			if (DEBUG) LogWriter.println(String.format("  %d   %15s,\t %.3f", locationId, "suitableLand", suitableLand));
 			setGamsParamValueTruncate(landP.addRecord(locString), suitableLand, 3);
 			
-			double pastureIncCost = ModelConfig.PASTURE_INCREASE_COST_BASE + landUseItem.getForestManagedFraction() * ModelConfig.PASTURE_INCREASE_COST_MANAGED_FOREST;
-			if (DEBUG) LogWriter.println(String.format("  %d   %15s,\t %.3f", locationId, "pastureIncCost", pastureIncCost));
-			setGamsParamValue(pastureIncCostP.addRecord(Integer.toString(locationId)), pastureIncCost, 3);
+			double agriExpansionCost = ModelConfig.AGRI_EXPANSION_COST_BASE + landUseItem.getForestManagedFraction() * ModelConfig.AGRI_EXPANSION_COST_BASE_MANAGED_FOREST;
+			if (DEBUG) LogWriter.println(String.format("  %d   %15s,\t %.3f", locationId, "agriExpansionCost", agriExpansionCost));
+			setGamsParamValue(agriExpansionCostP.addRecord(Integer.toString(locationId)), agriExpansionCost, 3);
 			
 			for (CropType cropType : CropType.getNonMeatTypes()) {
 				Vector<String> v = new Vector<String>();
-- 
GitLab