diff --git a/debug_config.properties b/debug_config.properties index 69f55b1b9ece55678b9dec52247f87321bb9a0a2..5d5b07046336db670772b6a0a3afa512c969dbec 100644 --- a/debug_config.properties +++ b/debug_config.properties @@ -9,7 +9,7 @@ IS_CALIBRATION_RUN = false GENERATE_NEW_YIELD_CLUSTERS = false NUM_YIELD_CLUSTERS=8000 -END_TIMESTEP=0 +END_TIMESTEP=18 TIMESTEP_SIZE=5 INTERPOLATE_OUTPUT_YEARS = false diff --git a/src/ac/ed/lurg/country/gams/GamsDemandOptimiser.java b/src/ac/ed/lurg/country/gams/GamsDemandOptimiser.java index f64f01863241245a2ef0c563f287eac7340c527c..ef34748595f336a5562fce28fc4969df15e11d82 100644 --- a/src/ac/ed/lurg/country/gams/GamsDemandOptimiser.java +++ b/src/ac/ed/lurg/country/gams/GamsDemandOptimiser.java @@ -104,7 +104,7 @@ public class GamsDemandOptimiser { private GamsDemandOutput handleResults(GAMSDatabase outDB) { int modelStatus = (int) outDB.getParameter("ms").findRecord().getValue(); String status = GAMSGlobals.ModelStat.lookup(modelStatus).toString(); - LogWriter.println(String.format("\nDemamd %s: Modelstatus %s, Solvestatus %s", inputData.getCountry(), + LogWriter.println(String.format("\nDemamd %s %d: Modelstatus %s, Solvestatus %s", inputData.getCountry(), inputData.getYear(), status, GAMSGlobals.SolveStat.lookup((int) outDB.getParameter("ss").findRecord().getValue()) )); GAMSVariable varU = outDB.getVariable("u"); diff --git a/src/ac/ed/lurg/demand/ElasticDemandManager.java b/src/ac/ed/lurg/demand/ElasticDemandManager.java index ad27844b64510758e7deb71f3b461c6dcb0f39c6..e0d466cc8d361ec98d266eb281ef11f40f9e812f 100644 --- a/src/ac/ed/lurg/demand/ElasticDemandManager.java +++ b/src/ac/ed/lurg/demand/ElasticDemandManager.java @@ -77,13 +77,13 @@ public class ElasticDemandManager extends AbstractSSPDemandManager { foodDemands.put(commodity, d); } - writeGamsDemandOutputs(inputData, gamsOutput, foodDemands); + writeGamsDemandOutputs(inputData, gamsOutput, foodDemands, population); return foodDemands; } private String getDamsDemandOutputsHeader() { - StringBuffer sbHeader = new StringBuffer("country,year,gdpPc"); + StringBuffer sbHeader = new StringBuffer("country,year,gdpPc,population"); for (CommodityType commodity : CommodityType.values()) sbHeader.append(",price_" + commodity.getGamsName()); @@ -102,9 +102,10 @@ public class ElasticDemandManager extends AbstractSSPDemandManager { return sbHeader.toString(); } - private void writeGamsDemandOutputs(GamsDemandInput inputData, GamsDemandOutput gamsOutput, Map<CommodityType, Double> foodDemands) { + private void writeGamsDemandOutputs(GamsDemandInput inputData, GamsDemandOutput gamsOutput, Map<CommodityType, Double> foodDemands, double population) { try { - StringBuffer sbData = new StringBuffer(String.format("%s,%d,%.2f", inputData.getCountry(), inputData.getYear(),inputData.getGdpPc())); + Map<CommodityType, Double> plumDemands = gamsOutput.getPlumDemands(); + StringBuffer sbData = new StringBuffer(String.format("%s,%d,%.2f,%.6f", inputData.getCountry(), inputData.getYear(),inputData.getGdpPc(), population)); for (CommodityType commodity : CommodityType.values()) sbData.append(String.format(",%.4f", inputData.getPrices().get(commodity))); @@ -116,9 +117,9 @@ public class ElasticDemandManager extends AbstractSSPDemandManager { for (CommodityType commodity : CommodityType.values()) sbData.append(String.format(",%.4f", gamsOutput.getGamsDemands(commodity).getDiscretionary())); for (CommodityType commodity : CommodityType.getAllFoodItems()) - sbData.append(String.format(",%.4f", gamsOutput.getPlumDemands().get(commodity))); + sbData.append(String.format(",%.4f", plumDemands.get(commodity))); for (CommodityType commodity : CommodityType.getAllFoodItems()) - sbData.append(String.format(",%.4f", foodDemands.get(commodity))); + sbData.append(String.format(",%.4f", foodDemands.get(commodity)/population)); outputFile.write(sbData.toString()); outputFile.newLine();