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

Changes for tradeBarriers

parent d47ebb57
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
...@@ -361,7 +361,6 @@ public class ModelConfig { ...@@ -361,7 +361,6 @@ public class ModelConfig {
public static final double TRADE_BARRIER_FACTOR_DEFAULT = getDoubleProperty("TRADE_BARRIER_FACTOR_DEFAULT", 0.2); // price factor in international trade, transport cost and real trade barriers public static final double TRADE_BARRIER_FACTOR_DEFAULT = getDoubleProperty("TRADE_BARRIER_FACTOR_DEFAULT", 0.2); // price factor in international trade, transport cost and real trade barriers
public static final double TRADE_BARRIER_MULTIPLIER = getDoubleProperty("TRADE_BARRIER_MULTIPLIER", 1.0); public static final double TRADE_BARRIER_MULTIPLIER = getDoubleProperty("TRADE_BARRIER_MULTIPLIER", 1.0);
public static final boolean ACTIVE_TRADE_BARRIERS = getBooleanProperty("ACTIVE_TRADE_BARRIERS", true); // if set to true read in barrier information from file, otherwise use default as above public static final boolean ACTIVE_TRADE_BARRIERS = getBooleanProperty("ACTIVE_TRADE_BARRIERS", true); // if set to true read in barrier information from file, otherwise use default as above
public static final boolean ACTIVE_TRADE_DISTORTIONS = getBooleanProperty("ACTIVE_TRADE_DISTORTIONS", false); // if set to true read in distortions information from file
public static final boolean SHOCKS_POSSIBLE = getBooleanProperty("SHOCKS_POSSIBLE", false); public static final boolean SHOCKS_POSSIBLE = getBooleanProperty("SHOCKS_POSSIBLE", false);
public static final double YIELD_SHOCK_MAGNIFIER = getDoubleProperty("YIELD_SHOCK_MAGNIFIER", 1.0); public static final double YIELD_SHOCK_MAGNIFIER = getDoubleProperty("YIELD_SHOCK_MAGNIFIER", 1.0);
......
...@@ -18,7 +18,6 @@ public class TradeManager { ...@@ -18,7 +18,6 @@ public class TradeManager {
private static final int COUNTRY_COL = 0; private static final int COUNTRY_COL = 0;
private static final int ITEM_COL = 1; private static final int ITEM_COL = 1;
private static final int TRADE_BARRIER_COL = 2; private static final int TRADE_BARRIER_COL = 2;
private static final int TRADE_DISTORTION_COL = 3;
private CompositeCountryManager compositeCountryManager; private CompositeCountryManager compositeCountryManager;
private Map<CompositeCountry, CropToDoubleMap> tradeMap = new HashMap<CompositeCountry, CropToDoubleMap>(); private Map<CompositeCountry, CropToDoubleMap> tradeMap = new HashMap<CompositeCountry, CropToDoubleMap>();
...@@ -53,7 +52,7 @@ public class TradeManager { ...@@ -53,7 +52,7 @@ public class TradeManager {
try { try {
BufferedReader reader = new BufferedReader(new FileReader(filename)); BufferedReader reader = new BufferedReader(new FileReader(filename));
String line, countryName, itemName; String line, countryName, itemName;
double barrierValue,distortionsValue; double barrierValue;
reader.readLine(); // read header reader.readLine(); // read header
while ((line=reader.readLine()) != null) { while ((line=reader.readLine()) != null) {
...@@ -67,8 +66,6 @@ public class TradeManager { ...@@ -67,8 +66,6 @@ public class TradeManager {
countryName = tokens[COUNTRY_COL]; countryName = tokens[COUNTRY_COL];
itemName = tokens[ITEM_COL]; itemName = tokens[ITEM_COL];
barrierValue = Double.parseDouble(tokens[TRADE_BARRIER_COL]); barrierValue = Double.parseDouble(tokens[TRADE_BARRIER_COL]);
distortionsValue= Double.parseDouble(tokens[TRADE_DISTORTION_COL]);
SingleCountry country = CountryManager.getForName(countryName); SingleCountry country = CountryManager.getForName(countryName);
...@@ -87,8 +84,7 @@ public class TradeManager { ...@@ -87,8 +84,7 @@ public class TradeManager {
} }
double tradeBarriersValue = (ModelConfig.ACTIVE_TRADE_DISTORTIONS) ? barrierValue+distortionsValue : barrierValue; countryData.incrementValue(crop, barrierValue);
countryData.incrementValue(crop, tradeBarriersValue);
} }
} catch (Exception e) { } catch (Exception e) {
LogWriter.printlnError("Failed in processing trade barriers line " + line); LogWriter.printlnError("Failed in processing trade barriers line " + line);
......
...@@ -40,7 +40,7 @@ public class YieldClusterPoint implements ClusteringPoint<String> { ...@@ -40,7 +40,7 @@ public class YieldClusterPoint implements ClusteringPoint<String> {
this.pasture = yields.getYield(YieldType.NO_FERT_NO_IRRIG, CropType.PASTURE); this.pasture = yields.getYield(YieldType.NO_FERT_NO_IRRIG, CropType.PASTURE);
this.wheatMax = yields.getYield(YieldType.FERT_MAX_IRRIG_MAX, CropType.WHEAT); this.wheatMax = yields.getYield(YieldType.FERT_MAX_IRRIG_MAX, CropType.WHEAT);
this.maizeMax = yields.getYield(YieldType.FERT_MAX_IRRIG_MAX, CropType.MAIZE); this.maizeMax = yields.getYield(YieldType.FERT_MAX_IRRIG_MAX, CropType.MAIZE);
this.irrigWaterAval = irrigItem.getIrrigConstraint(); this.irrigWaterAval = (irrigItem==null) ? 0.0 :irrigItem.getIrrigConstraint();
this.protectedArea = protectedArea; this.protectedArea = protectedArea;
} }
......
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