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

Use 2010 population to decide which countries to include separately or to aggregate.

parent 4a724bc0
No related branches found
No related tags found
No related merge requests found
BASE_DIR=C:\\Eclipse_workspace\\plum_st
YIELD_DIR=C:\\Eclipse_workspace\\plum_st\\LJP\\LPJ_output
This diff is collapsed.
...@@ -11,9 +11,9 @@ YIELD_DIR=/Users/peteralexander/Documents/LURG/LPJ/IPSL/LPJG_PLUM_expt1.2_rcp45_ ...@@ -11,9 +11,9 @@ YIELD_DIR=/Users/peteralexander/Documents/LURG/LPJ/IPSL/LPJG_PLUM_expt1.2_rcp45_
#MARKET_ADJ_PRICE=false #MARKET_ADJ_PRICE=false
SSP_SCENARIO=SSP5_v9_130325 SSP_SCENARIO=SSP5_v9_130325
LAND_CHANGE_COST=0.6 #LAND_CHANGE_COST=0.6
IS_CALIBRATION_RUN = false IS_CALIBRATION_RUN = true
#LAND_CHANGE_COST=.6 #LAND_CHANGE_COST=.6
...@@ -21,7 +21,7 @@ IS_CALIBRATION_RUN = false ...@@ -21,7 +21,7 @@ IS_CALIBRATION_RUN = false
#TECHNOLOGY_CHANGE_ANNUAL_RATE=0.005 #TECHNOLOGY_CHANGE_ANNUAL_RATE=0.005
#TRADE_BARRIER_FACTOR_DEFAULT=0.3 #TRADE_BARRIER_FACTOR_DEFAULT=0.3
END_TIMESTEP=18 END_TIMESTEP=10
TIMESTEP_SIZE=5 TIMESTEP_SIZE=5
INTERPOLATE_OUTPUT_YEARS = false INTERPOLATE_OUTPUT_YEARS = false
\ No newline at end of file
This diff is collapsed.
...@@ -11,9 +11,9 @@ GAMS_MODEL=./GAMS/IntExtOpt.gms ...@@ -11,9 +11,9 @@ GAMS_MODEL=./GAMS/IntExtOpt.gms
#DEBUG_LIMIT_COUNTRIES=true #DEBUG_LIMIT_COUNTRIES=true
#DEBUG_COUNTRY_NAME=Pakistan #DEBUG_COUNTRY_NAME=Pakistan
IS_CALIBRATION_RUN = true IS_CALIBRATION_RUN = false
END_TIMESTEP=10 END_TIMESTEP=20
TIMESTEP_SIZE=1 TIMESTEP_SIZE=1
INTERPOLATE_OUTPUT_YEARS = false INTERPOLATE_OUTPUT_YEARS = false
...@@ -195,7 +195,7 @@ public class ModelConfig { ...@@ -195,7 +195,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 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 POPULATION_AGGREG_LIMIT = getDoubleProperty("POPULATION_AGGREG_LIMIT", 30.0); // in millions, smaller countries are aggregated on a regional basis
public static final double UNHANDLED_CROP_AREA = getDoubleProperty("UNHANDLED_CROP_AREA", 0.3); // includes fruit veg forage crops set aside and failed crop public static final double UNHANDLED_CROP_AREA = getDoubleProperty("UNHANDLED_CROP_AREA", 0.3); // includes fruit veg forage crops set aside and failed crop
...@@ -222,4 +222,5 @@ public class ModelConfig { ...@@ -222,4 +222,5 @@ public class ModelConfig {
public static final int LPJG_TIMESTEP_SIZE = 5; public static final int LPJG_TIMESTEP_SIZE = 5;
public static final int NUM_YIELD_CLUSTERS = 500; public static final int NUM_YIELD_CLUSTERS = 500;
public static final long RANDOM_SEED = 290374; // any number will do
} }
...@@ -30,7 +30,7 @@ public class CompositeCountryManager { ...@@ -30,7 +30,7 @@ public class CompositeCountryManager {
for (SingleCountry c : baseConsumpManager.getAllCountries()) { for (SingleCountry c : baseConsumpManager.getAllCountries()) {
CompositeCountry cc; CompositeCountry cc;
if (baseConsumpManager.getBasePopulation(c) < ModelConfig.POPULATION_AGGREG_LIMIT || countryExclusionList.contains(c.getCountryName())) if (baseConsumpManager.getPopForGrouping(c) < ModelConfig.POPULATION_AGGREG_LIMIT || countryExclusionList.contains(c.getCountryName()))
cc = getForName(c.getRegion() + "_other"); cc = getForName(c.getRegion() + "_other");
else else
cc = getForName(c.getCountryName()); cc = getForName(c.getCountryName());
......
...@@ -17,10 +17,12 @@ public class BaseConsumpManager { ...@@ -17,10 +17,12 @@ public class BaseConsumpManager {
private static final int BASE_POP_COL = 1; private static final int BASE_POP_COL = 1;
private static final int COMMODITY_COL = 2; private static final int COMMODITY_COL = 2;
private static final int BASE_CPC_COL = 3; private static final int BASE_CPC_COL = 3;
private static final int POP_FOR_GROUPING_COL = 4;
private Map<SingleCountry, Map<CommodityType, Double>> baseConsumpMap = new HashMap<SingleCountry, Map<CommodityType, Double>>(); private Map<SingleCountry, Map<CommodityType, Double>> baseConsumpMap = new HashMap<SingleCountry, Map<CommodityType, Double>>();
// Don't like the duplication of population in this base consumption file, but guess not really a problem // Don't like the duplication of population in this base consumption file, but guess not really a problem
private Map<SingleCountry, Double> basePop = new HashMap<SingleCountry, Double>(); private Map<SingleCountry, Double> basePop = new HashMap<SingleCountry, Double>();
private Map<SingleCountry, Double> popForGroupingMap = new HashMap<SingleCountry, Double>();
public BaseConsumpManager() { public BaseConsumpManager() {
super(); super();
...@@ -32,7 +34,7 @@ public class BaseConsumpManager { ...@@ -32,7 +34,7 @@ public class BaseConsumpManager {
try { try {
BufferedReader fitReader = new BufferedReader(new FileReader(filename)); BufferedReader fitReader = new BufferedReader(new FileReader(filename));
String line, countryName, commodityName; String line, countryName, commodityName;
double pop, cpc; double pop, cpc, popForGrouping;
fitReader.readLine(); // read header fitReader.readLine(); // read header
while ((line=fitReader.readLine()) != null) { while ((line=fitReader.readLine()) != null) {
...@@ -45,6 +47,7 @@ public class BaseConsumpManager { ...@@ -45,6 +47,7 @@ public class BaseConsumpManager {
pop = Double.parseDouble(tokens[BASE_POP_COL]); pop = Double.parseDouble(tokens[BASE_POP_COL]);
commodityName = tokens[COMMODITY_COL]; commodityName = tokens[COMMODITY_COL];
cpc = Double.parseDouble(tokens[BASE_CPC_COL]); cpc = Double.parseDouble(tokens[BASE_CPC_COL]);
popForGrouping = Double.parseDouble(tokens[POP_FOR_GROUPING_COL]);
SingleCountry country = CountryManager.getForName(countryName); SingleCountry country = CountryManager.getForName(countryName);
if (country == null) if (country == null)
...@@ -60,6 +63,7 @@ public class BaseConsumpManager { ...@@ -60,6 +63,7 @@ public class BaseConsumpManager {
commodityMap.put(commodity, cpc); commodityMap.put(commodity, cpc);
basePop.put(country, pop); basePop.put(country, pop);
popForGroupingMap.put(country, popForGrouping);
} }
fitReader.close(); fitReader.close();
...@@ -87,6 +91,11 @@ public class BaseConsumpManager { ...@@ -87,6 +91,11 @@ public class BaseConsumpManager {
return (d != null) ? d.doubleValue() : Double.NaN; return (d != null) ? d.doubleValue() : Double.NaN;
} }
public double getPopForGrouping(SingleCountry country) {
Double d = popForGroupingMap.get(country);
return (d != null) ? d.doubleValue() : Double.NaN;
}
public Collection<SingleCountry> getAllCountries() { public Collection<SingleCountry> getAllCountries() {
return basePop.keySet(); return basePop.keySet();
} }
......
...@@ -7,6 +7,7 @@ import java.util.List; ...@@ -7,6 +7,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Random; import java.util.Random;
import ac.ed.lurg.ModelConfig;
import ac.ed.lurg.utils.LogWriter; import ac.ed.lurg.utils.LogWriter;
public class KMeans<K, P extends ClusteringPoint<K>> { public class KMeans<K, P extends ClusteringPoint<K>> {
...@@ -47,9 +48,10 @@ public class KMeans<K, P extends ClusteringPoint<K>> { ...@@ -47,9 +48,10 @@ public class KMeans<K, P extends ClusteringPoint<K>> {
} }
} }
private static Random r = new Random(ModelConfig.RANDOM_SEED);
private CentriodPoint<K> generateRandomCentriod() { private CentriodPoint<K> generateRandomCentriod() {
double min, max, rand, v; double min, max, rand, v;
Random r = new Random();
Map<K, Double> randomCentroid = new HashMap<K, Double>(); Map<K, Double> randomCentroid = new HashMap<K, Double>();
......
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