Skip to content

Commit

Permalink
Devel (#8)
Browse files Browse the repository at this point in the history
* rather set defaults than run into null pointer exceptions
  • Loading branch information
emanuel-schmid authored Aug 31, 2022
1 parent 3e1cef0 commit f6244e2
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>FARMIND</groupId>
<artifactId>FARMIND</artifactId>
<version>0.12.0</version>
<version>0.12.1</version>
<build>
<plugins>
<plugin>
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/farmind/agent/Farm.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public List<String> decideActivitySet(List<Farm> allFarms, Properties cmd) {
FuzzyLogicCalculator fuzzyLogicCalc = new FuzzyLogicCalculator(this, allFarms); // calculator for the activity selection

// modified simulation using only satisfaction
if (cmd.getProperty("uncertainty").equals("0")) {
if (cmd.getProperty("uncertainty", "1").equals("0")) {
if (this.Satisfaction >= this.getP_aspiration_coef() ) {
this.strategy = 4; //REPETITION
for (int i = 0; i < this.getCurrentActivity().size(); i++) {
Expand All @@ -175,7 +175,7 @@ public List<String> decideActivitySet(List<Farm> allFarms, Properties cmd) {
else {
if (this.Activity_Dissimilarity >= this.p_activity_tolerance_coef
|| this.Income_Dissimilarity >= this.p_income_tolerance_coef) {
if (cmd.getProperty("noOptOut").equals("1")
if (cmd.getProperty("noOptOut", "0").equals("1")
|| this.Satisfaction >= this.getP_aspiration_coef()) {
this.strategy = 2; //IMITATION
ActivitySet = fuzzyLogicCalc.getImitationActivities();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public void runModel(Properties cmd, int nFarm, int year, boolean pricingAverage
* @throws
*/
private static void createRunGamsBatch(Properties cmd, String OS) throws FileNotFoundException {
if (cmd.getProperty("debug").equals("1")) {
if (cmd.getProperty("debug", "0").equals("1")) {
if (OS.equals("win")) {
LOGGER.info("Creating run_gams.bat file for debug");
try (PrintWriter writer = new PrintWriter("run_gams.bat")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void runModel(Properties cmd, int nFarm, int year, boolean pricingAverage
* @throws FileNotFoundException
*/
private static void createRunGamsBatch(Properties cmd, String OS) throws FileNotFoundException {
if (cmd.getProperty("debug").equals("1")) {
if (cmd.getProperty("debug", "0").equals("1")) {
if (OS.equals("win")) {
LOGGER.info("Creating run_gams.bat file for debug");
try (PrintWriter writer = new PrintWriter("run_gams.bat")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void runModel(Properties cmd, int nFarm, int year, boolean pricingAverage
* @throws IOException
*/
private static void createRunGamsBatch(Properties cmd, String OS) throws IOException {
if (cmd.getProperty("debug").equals("1")) {
if (cmd.getProperty("debug", "0").equals("1")) {
if (OS.equals("win")) {
LOGGER.info("Creating run_gams.bat file for debug");
File f = new File("run_gams.bat");
Expand Down

0 comments on commit f6244e2

Please sign in to comment.