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

Tweaks to calibration

parent 006201f2
No related branches found
No related tags found
No related merge requests found
......@@ -158,14 +158,14 @@ public class ModelConfig {
public static final double PASTURE_HARVEST_FRACTION = getDoubleProperty("PASTURE_HARVEST_FRACTION", 0.25);
public static final double MEAT_EFFICIENCY = getDoubleProperty("MEAT_EFFICIENCY", 1.0); // 'meat' is includes feed conversion ratio already, this is tech. change or similar
public static final double IRRIGIATION_EFFICIENCY = getDoubleProperty("IRRIGIATION_EFFICIENCY", 0.5);
public static final double LAND_CHANGE_COST = getDoubleProperty("LAND_CHANGE_COST", 0.4);
public static final double LAND_CHANGE_COST = getDoubleProperty("LAND_CHANGE_COST", 0.6);
public static final double MIN_FEED_RATE = getDoubleProperty("MIN_FEED_RATE", 0.15);
public static final double SEED_AND_WASTE_FRACTION = getDoubleProperty("SEED_AND_WASTE_FRACTION", 0.15);
public static final double TECHNOLOGY_CHANGE_ANNUAL_RATE = getDoubleProperty("TECHNOLOGY_CHANGE_ANNUAL_RATE", 0.0);
public static final double TECHNOLOGY_CHANGE_ANNUAL_RATE = IS_CALIBRATION_RUN ? 0.0 : getDoubleProperty("TECHNOLOGY_CHANGE_ANNUAL_RATE", 0.0);
public static final int TECHNOLOGY_CHANGE_START_STEP = getIntProperty("TECHNOLOGY_CHANGE_START_STEP", 0);
public static final double BIOENERGY_CHANGE_ANNUAL_RATE = getDoubleProperty("BIOENERGY_CHANGE_ANNUAL_RATE", 0.0);
public static final double BIOENERGY_CHANGE_ANNUAL_RATE = IS_CALIBRATION_RUN ? 0.0 : getDoubleProperty("BIOENERGY_CHANGE_ANNUAL_RATE", 0.0);
public static final int BIOENERGY_CHANGE_START_YEAR = getIntProperty("BIOENERGY_CHANGE_START_YEAR", 2010);
public static final double MARKET_LAMBA = getDoubleProperty("MARKET_LAMBA", 0.5); // controls international market price adjustment rate
......@@ -188,8 +188,8 @@ public class ModelConfig {
public static final boolean PROTECTED_AREAS_ENABLED = getBooleanProperty("PROTECTED_AREAS_ENABLED", true);
public static final int NUM_CEREAL_CATEGORIES = getIntProperty("NUM_CEREAL_CATEGORIES", 6);
public static final int NUM_PASTURE_CATEGORIES = getIntProperty("NUM_PASTURE_CATEGORIES", 6);
public static final int NUM_CEREAL_CATEGORIES = getIntProperty("NUM_CEREAL_CATEGORIES", 12);
public static final int NUM_PASTURE_CATEGORIES = getIntProperty("NUM_PASTURE_CATEGORIES", 3);
public static final boolean DEBUG_LIMIT_COUNTRIES = getBooleanProperty("DEBUG_LIMIT_COUNTRIES", false);
public static final Object DEBUG_COUNTRY_NAME = getProperty("DEBUG_COUNTRY_NAME", "United States of America");
......
......@@ -63,7 +63,7 @@ public class CountryAgent {
}
else {
// optimize areas and intensity
GamsRasterInput input = getGamsRasterInput(currentProjectedDemand, currentCountryPrices, irrigData);
GamsRasterInput input = getGamsRasterInput(irrigData);
GamsRasterOptimiser opti = new GamsRasterOptimiser(input);
LogWriter.println("Running " + country.getName() + ", currentTimestep " + currentTimestep);
......@@ -79,18 +79,19 @@ public class CountryAgent {
return currentProjectedDemand;
}
private GamsRasterInput getGamsRasterInput(Map<CommodityType, Double> projectedDemand, Map<CropType, CountryPrice> countryPrices, RasterSet<IrrigationItem> irrigData) {
//TODO why pass in projectedDemand when currentProjectedDemand belongs to CountryAgent class already?
private GamsRasterInput getGamsRasterInput(RasterSet<IrrigationItem> irrigData) {
GamsRasterOutput prevOutput;
double allowedImportChange;
if (currentTimestep.isInitialTimestep()) { // initialisation time-step
prevOutput = resultsTimeseries.get(currentTimestep);
allowedImportChange = 0.0;
}
else { // normal (not the initial) time-step
prevOutput = resultsTimeseries.get(currentTimestep.getPreviousTimestep());
allowedImportChange = ModelConfig.MAX_IMPORT_CHANGE; // when running is calibration model calibrate (ModelConfig.IS_CALIBRATION_RUN==true) MAX_IMPORT_CHANGE is already 0.
}
Map<CropType, Double> baseNetImport = new HashMap<CropType, Double>();
Map<CropType, Double> maxOfProdOrSupply = new HashMap<CropType, Double>();
......@@ -101,15 +102,13 @@ public class CountryAgent {
maxOfProdOrSupply.put(entry.getKey(), cropUsage.getProduction() + Math.max(netImports, 0));
}
GamsCountryInput countryLevelInputs = GamsCountryInput.createInput(country, projectedDemand, countryPrices, baseNetImport, maxOfProdOrSupply);
GamsCountryInput countryLevelInputs = GamsCountryInput.createInput(country, currentProjectedDemand, currentCountryPrices, baseNetImport, maxOfProdOrSupply, allowedImportChange);
GamsRasterInput input = new GamsRasterInput(currentTimestep, countryYieldSurfaces, prevOutput.getLandUses(), irrigData, countryLevelInputs);
return input;
}
Map<CropType, CountryPrice> calculateCountryPrices(Map<CropType, GlobalPrice> worldPrices){
Map<CropType, CountryPrice> countryPrices = new HashMap <CropType, CountryPrice>();
for (CropType c : CropType.getImportedTypes()) {
......@@ -118,7 +117,6 @@ public class CountryAgent {
countryPrices.put(c, prices);
}
return countryPrices;
return countryPrices;
}
}
......@@ -31,9 +31,8 @@ public class GamsCountryInput {
}
public static GamsCountryInput createInput(CompositeCountry country, Map<CommodityType, Double> projectedDemand, Map<CropType, CountryPrice> countryPrices,
Map<CropType, Double> baseNetImport, Map<CropType, Double> maxOfProdOrSupply) {
Map<CropType, Double> baseNetImport, Map<CropType, Double> maxOfProdOrSupply, double allowedImportChange) {
double allowedImportChange = ModelConfig.MAX_IMPORT_CHANGE;
Map<CropType, ImportExportConstraint> importConstraints = new HashMap<CropType, ImportExportConstraint>();
for (Map.Entry<CropType, Double> entry : baseNetImport.entrySet()) {
......
......@@ -23,7 +23,7 @@ public class GamsLocationTest {
}
private void run() {
GamsCountryInput countryLevelInputs = GamsCountryInput.createInput(new CompositeCountry("Test"), getProjectedDemand(), getCountryPrices(), null, null);
GamsCountryInput countryLevelInputs = GamsCountryInput.createInput(new CompositeCountry("Test"), getProjectedDemand(), getCountryPrices(), null, null, 0.1);
GamsLocationInput gamsInput = new GamsLocationInput(new Timestep(0), getYields(), getPreviousArea(), getIrrigationCosts(), countryLevelInputs);
GamsLocationOptimiser opti = new GamsLocationOptimiser(gamsInput);
......
......@@ -18,7 +18,7 @@ public class GamsRasterTest extends GamsLocationTest {
}
private void run() {
GamsCountryInput countryLevelInputs = GamsCountryInput.createInput(new CompositeCountry("Test"), getProjectedDemand(), getCountryPrices(), null, null);
GamsCountryInput countryLevelInputs = GamsCountryInput.createInput(new CompositeCountry("Test"), getProjectedDemand(), getCountryPrices(), null, null, 0.1);
GamsRasterInput input = new GamsRasterInput(new Timestep(0), getYieldRaster(), getPreviousAreaRaster(), getIrrigationCost(), countryLevelInputs);
GamsRasterOptimiser opti = new GamsRasterOptimiser(input);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment