diff --git a/src/ac/ed/lurg/ModelConfig.java b/src/ac/ed/lurg/ModelConfig.java index 59019ffab80920746b313a35304347d748a2ad25..399813cf9136d33357fd785b283eba541cb720f2 100644 --- a/src/ac/ed/lurg/ModelConfig.java +++ b/src/ac/ed/lurg/ModelConfig.java @@ -148,7 +148,7 @@ public class ModelConfig { public static final double MARKET_LAMBA = getDoubleProperty("MARKET_LAMBA", 0.3); // controls international market price adjustment rate public static final double POPULATION_AGGREG_LIMIT = getDoubleProperty("POPULATION_AGGREG_LIMIT", 40.0); // in millions, smaller countries are aggregated on a regional basis - public static final double IRRIG_COST_SCALE_FACTOR = getDoubleProperty("IRRIG_COST_SCALE_FACTOR", 0.1); + public static final double IRRIG_COST_SCALE_FACTOR = getDoubleProperty("IRRIG_COST_SCALE_FACTOR", 0.02); public static final double FERTILISER_MAX_COST = getDoubleProperty("FERTILISER_MAX_COST", 2.5); public static final double TRANSPORT_LOSSES = getDoubleProperty("TRANSPORT_LOSSES", 0.15); // in international trade public static final double TRADE_BARRIER_FACTOR = getDoubleProperty("TRADE_BARRIER_FACTOR", 1.2); // price factor in international trade, transport cost and real trade barriers @@ -157,5 +157,7 @@ public class ModelConfig { public static final int NUM_PASTURE_CATEGORIES = getIntProperty("NUM_PASTURE_CATEGORIES", 1); public static final boolean DEBUG_LIMIT_COUNTRIES = getBooleanProperty("DEBUG_LIMIT_COUNTRIES", false); - public static final double DEFAULT_MAX_IRRIGATION_RATE = getDoubleProperty("DEFAULT_MAX_IRRIGATION_RATE", 50.0); // should need this but some areas crops don't have a value, but was causing them to be selected + public static final double PASTURE_MAX_IRRIGATION_RATE = getDoubleProperty("DEFAULT_MAX_IRRIGATION_RATE", 50.0); // should need this but some areas crops don't have a value, but was causing them to be selected + public static int NUM_CALIBRATION_ITERATIONS = 10; + } \ No newline at end of file diff --git a/src/ac/ed/lurg/country/gams/GamsLocationOptimiser.java b/src/ac/ed/lurg/country/gams/GamsLocationOptimiser.java index 06ee659bc7b342db6fb66be1e77d1e0b6c4dc78b..f20496827c7b067c6fbe75f3a8fbce1ee9df40b7 100644 --- a/src/ac/ed/lurg/country/gams/GamsLocationOptimiser.java +++ b/src/ac/ed/lurg/country/gams/GamsLocationOptimiser.java @@ -121,9 +121,9 @@ public class GamsLocationOptimiser { IrrigationItem irrigCostItem = entry.getValue(); double irrigCost = irrigCostItem.getIrrigCost(); double irrigConstraint = irrigCostItem.getIrrigConstraint(); - if (DEBUG) LogWriter.println(String.format(" %d \t %.1f,\t %.1f", locationId, irrigCost, irrigConstraint)); + if (DEBUG) LogWriter.println(String.format(" %d \t %.3f,\t %.1f", locationId, irrigCost, irrigConstraint)); irrigCostP.addRecord(Integer.toString(locationId)).setValue(irrigCost); - irrigConstraintP.addRecord(Integer.toString(locationId)).setValue(irrigCost); + irrigConstraintP.addRecord(Integer.toString(locationId)).setValue(irrigConstraint); } if (DEBUG) LogWriter.println("\nDemand"); diff --git a/src/ac/ed/lurg/country/gams/GamsRasterOptimiser.java b/src/ac/ed/lurg/country/gams/GamsRasterOptimiser.java index ef8ffcd5f3d2f1be7809b1e68ab0f35ad204db4a..9985cbe635dca202b3b07351df02642e78bf3d22 100644 --- a/src/ac/ed/lurg/country/gams/GamsRasterOptimiser.java +++ b/src/ac/ed/lurg/country/gams/GamsRasterOptimiser.java @@ -65,7 +65,7 @@ public class GamsRasterOptimiser { LogWriter.println("baseCropland=" + baseCropland + ", basePasture=" + basePasture); - for (int i=0; i<10; i++) { + for (int i=0; i<ModelConfig.NUM_CALIBRATION_ITERATIONS; i++) { GamsLocationInput newInput = GamsLocationInput.createWithNewAdjustments(gamsInput, cropAdjustments); GamsLocationOptimiser opti= new GamsLocationOptimiser(newInput); @@ -354,12 +354,15 @@ public class GamsRasterOptimiser { // Crops yields and area fractions for (CropType crop : CropType.getNonMeatTypes()) { - if (irrigItem!= null) { + if (irrigItem!= null) { double irrigMax = irrigItem.getMaxIrrigAmount(crop); - + if (irrigMax == 0.0) { - LogWriter.printlnError("Can't find irrig max amount for col:" + key.getCol() + ", row:" + key.getRow() + ", x:" + yieldRaster.getXCoordin(key) + ", y:" + yieldRaster.getYCoordin(key) + ", crop:" + crop); - irrigMax = ModelConfig.DEFAULT_MAX_IRRIGATION_RATE; + if (CropType.PASTURE == crop) + irrigMax = ModelConfig.PASTURE_MAX_IRRIGATION_RATE; + else { + LogWriter.printlnError("Can't find irrig max amount for col:" + key.getCol() + ", row:" + key.getRow() + ", x:" + yieldRaster.getXCoordin(key) + ", y:" + yieldRaster.getYCoordin(key) + ", crop:" + crop); + } } aggIrig.setMaxIrrigAmount(crop, aggregateMean(aggIrig.getMaxIrrigAmount(crop), suitableAreaSoFar, irrigMax, suitableAreaThisTime));