Skip to content
Snippets Groups Projects
Commit c33d227d authored by Peter Alexander's avatar Peter Alexander
Browse files

Fix for setting irrigation constraint

parent d0b747f6
Branches
Tags
No related merge requests found
......@@ -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
......@@ -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");
......
......@@ -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));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment