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

Fixes to new profit max. optimisation.

parent 6099fdbb
No related branches found
No related tags found
No related merge requests found
SET all_types / monogastrics, ruminants, cereals, wheat, maize, rice, oilcrops, pulses, starchyRoots, energycrops, pasture /;
SET all_types / monogastrics, ruminants, cereals, wheat, maize, rice, oilcrops, pulses, starchyRoots, energycrops, pasture /;
SET crop(all_types) / wheat, maize, rice, oilcrops, pulses, starchyRoots, energycrops, pasture /;
SET crop_less_pasture(crop) / wheat, maize, rice, oilcrops, pulses, starchyRoots, energycrops/;
SET feed_crop(crop) / wheat, maize, oilcrops, pasture/;
SET feed_crop_less_pasture(feed_crop) / wheat, maize, oilcrops /;
SET not_feed_crop(crop) / rice, pulses, starchyRoots, energycrops /;
SET crop(all_types) / wheat, maize, rice, oilcrops, pulses, starchyRoots, energycrops, pasture /;
SET crop_less_pasture(crop) / wheat, maize, rice, oilcrops, pulses, starchyRoots, energycrops/;
SET feed_crop(crop) / wheat, maize, oilcrops, pasture/;
SET feed_crop_less_pasture(feed_crop) / wheat, maize, oilcrops /;
SET not_feed_crop(crop) / rice, pulses, starchyRoots, energycrops /;
SET traded_commodity(all_types) / monogastrics, ruminants, wheat, maize, rice, oilcrops, pulses, starchyRoots, energycrops /;
SET non_traded(all_types) / cereals, pasture /;
SET cereal_crop(crop) / wheat, maize, rice /;
SET non_cereal_crop(crop) / oilcrops, pulses, starchyRoots, energycrops, pasture /;
SET cereal_crop(crop) / wheat, maize, rice /;
SET non_cereal_crop(crop) / oilcrops, pulses, starchyRoots, energycrops, pasture /;
SET location;
PARAMETER suitableLandArea(location) areas of land in Mha;
PARAMETER previousArea(crop, location) areas for previous timestep in Mha;
......@@ -48,7 +49,7 @@
SCALAR domesticPriceMarkup factor price increased from cost of production;
SCALAR maxLandExpansionRate max rate of country land expansion
*$gdxin "/Users/peteralexander/Documents/R_Workspace/UNPLUM/temp/GamsTmp/t1.gdx"
*$gdxin "/Users/peteralexander/Documents/R_Workspace/UNPLUM/output/GamsTmp/China2010.gdx"
$gdxin %gdxincname%
$load location, suitableLandArea, demand, agriExpansionCost, cropIncCost, pastureIncCost, cropDecCost, pastureDecCost
$load previousArea, previousFertIntensity, previousIrrigIntensity, previousOtherIntensity, previousRuminantFeed, previousMonogastricFeed, previousImportAmount
......@@ -115,6 +116,7 @@ $gdxin
YIELD_EQ(crop, location) yield given chosen intensity
RUMINANT_PROD_EQ production of ruminant
MONOGASTRICS_PROD_EQ production of monogastric
NON_TRADED_CONSTRAINT(non_traded) stop not traded stuff like pasture being imported
TOTAL_FEED_CONSTRAINT(feed_crop) total feed constraint
MAX_FERT_INTENSITY_CONSTRAINT(crop, location) constraint on maximum fertilizer intensity
MAX_IRRIG_INTENSITY_CONSTRAINT(crop, location) constraint on maximum irrigation intensity
......@@ -124,8 +126,8 @@ $gdxin
MAX_PRODUCTION_CONSTRAINT(traded_commodity) constraint on max production
MIN_PRODUCTION_CONSTRAINT(traded_commodity) constraint on min production
IRRIGATION_CONSTRAINT(location) constraint no water usage
NET_PRODUCTION_EQ(all_types) calc net production for crops
POSITIVE_SUPPLY_CONSTRAINT(crop_less_pasture)
NET_PRODUCTION_EQ(crop) calc net production for crops
POSITIVE_SUPPLY_CONSTRAINT(crop)
AGRI_LAND_EXPANSION_CALC(location) calc agriLandExpansion
CROP_INCREASE_CALC(location)
CROP_DECREASE_CALC(location)
......@@ -149,10 +151,12 @@ $gdxin
(1 - exp(-fertParam(crop, location)*fertI(crop, location))) * (1 - exp(-irrigParam(crop, location)*irrigI(crop, location)))
) * (1 - exp(-otherIntensity(crop, location)*otherIParam));
NET_PRODUCTION_EQ(crop_less_pasture) .. netProduction(crop_less_pasture) =E= sum(location, area(crop_less_pasture, location) * yield(crop_less_pasture, location)) - feedAmount(crop_less_pasture);
NET_PRODUCTION_EQ(crop) .. netProduction(crop) =E= sum(location, area(crop, location) * yield(crop, location)) - feedAmount(crop);
POSITIVE_SUPPLY_CONSTRAINT(crop) .. importAmount(crop) + netProduction(crop) =G= 0;
NON_TRADED_CONSTRAINT(non_traded) .. importAmount(non_traded) =E= 0;
POSITIVE_SUPPLY_CONSTRAINT(crop_less_pasture) .. importAmount(crop_less_pasture) + netProduction(crop_less_pasture) =G= 0;
RUMINANT_PROD_EQ .. netProduction('ruminants') =E= meatEfficency*sum(feed_crop, ruminantFeed(feed_crop) * cropDM(feed_crop));
MONOGASTRICS_PROD_EQ .. netProduction('monogastrics') =E= meatEfficency*sum(feed_crop_less_pasture, monogastricFeed(feed_crop_less_pasture) * cropDM(feed_crop_less_pasture));
......
This diff is collapsed.
......@@ -5,7 +5,7 @@ YIELD_DIR=/Users/peteralexander/Documents/LURG/LPJ/LPJGPLUM_expt1.1_2006-2100_PL
#YIELD_DIR=/Users/peteralexander/Documents/LURG/LPJ/runs_20170925/LPJG_PLUM_expt1.2_rcp26_ipsl_irrV7104_b20170728_bothDS_irrWaits_forED_20170925154752
# Properties for testing
CHANGE_YIELD_DATA_YEAR=false
CHANGE_YIELD_DATA_YEAR=true
#CHANGE_DEMAND_YEAR=false
DEBUG_LIMIT_COUNTRIES=false
DEBUG_COUNTRY_NAME=China
......@@ -16,17 +16,22 @@ ORIG_LEAST_COST_MIN=false
DEBUG_JUST_DEMAND_OUTPUT=false
SSP_SCENARIO=SSP2_v9_130325
SSP_SCENARIO=SSP3_v9_130325
IS_CALIBRATION_RUN = true
IS_CALIBRATION_RUN = false
GENERATE_NEW_YIELD_CLUSTERS = false
NUM_YIELD_CLUSTERS=200
USE_BIOENERGY_TRAJECTORY=true
ENABLE_GEN2_BIOENERGY=true
FERTILISER_COST_PER_T=1.9
END_TIMESTEP=10
#INITIAL_PRICE_SHIFT=3
END_TIMESTEP=5
TIMESTEP_SIZE=1
INTERPOLATE_OUTPUT_YEARS = false
\ No newline at end of file
INTERPOLATE_OUTPUT_YEARS = false
YIELD_FILENAME=yield.out
\ No newline at end of file
......@@ -152,7 +152,7 @@ public class CountryAgent {
for (CropType crop : commodity.getCropTypes()) {
CropUsageData cropUsage = cropUsages.get(crop);
double prod = cropUsage.getProduction();
double prod = cropUsage.getNetProduction();
totalProd += prod;
double minFract = minCerealFracts.containsKey(crop) ? minCerealFracts.get(crop) : 0.0;
double netImportsFromMinDemand = minFract * demand - prod;
......@@ -217,7 +217,7 @@ public class CountryAgent {
for (Map.Entry<CropType, CropUsageData> entry : previousGamsRasterOutput.getCropUsageData().entrySet()) {
CropUsageData cropUsage = entry.getValue();
CropType crop = entry.getKey();
double baseTradeOrProd = (ModelConfig.ORIG_LEAST_COST_MIN) ? cropUsage.getNetImports() : cropUsage.getProduction();
double baseTradeOrProd = (ModelConfig.ORIG_LEAST_COST_MIN) ? cropUsage.getNetImports() : cropUsage.getNetProduction();
double changeUp = 0.0;
double changeDown = 0.0;
......
......@@ -67,9 +67,10 @@ public class CropUsageReader {
// aggregate if multiple countries for cc
if (oldData != null) {
netImports += oldData.getNetImports();
production += oldData.getProduction();
}
CropUsageData newData = new CropUsageData(Double.NaN, Double.NaN, netImports, production, Double.NaN);
CropUsageData newData = new CropUsageData(0.0, 0.0, netImports, production, Double.NaN);
countryData.put(crop, newData);
}
fitReader.close();
......
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