Commit 269547364dcadb0533882fb5b1c22dd90dfbf4de
1 parent
d1578c9b
Exists in
master
and in
2 other branches
fixed bug related to invalid UGs wood_yield
Showing
2 changed files
with
5 additions
and
4 deletions
Show diff stats
MODFIRE-Prototype/out/production/MODFIRE-Prototype/GetInput.class
No preview for this file type
MODFIRE-Prototype/src/GetInput.java
@@ -7,7 +7,7 @@ import java.io.*; | @@ -7,7 +7,7 @@ import java.io.*; | ||
7 | import java.util.Scanner; | 7 | import java.util.Scanner; |
8 | 8 | ||
9 | public class GetInput { | 9 | public class GetInput { |
10 | - public static void giveDomains (Model model, IntVar[] ugs, String dir, IntVar[] woodYield, int ugLimit){ | 10 | + public static void giveDomains (Model model, IntVar[] ugs, String dir, IntVar[] woodYield, UG[] nodes){ |
11 | int index = 0; | 11 | int index = 0; |
12 | try { | 12 | try { |
13 | File allUg = new File(dir + "/ugs_init.txt"); | 13 | File allUg = new File(dir + "/ugs_init.txt"); |
@@ -21,7 +21,7 @@ public class GetInput { | @@ -21,7 +21,7 @@ public class GetInput { | ||
21 | 21 | ||
22 | String dataWood = myReaderWood.nextLine(); | 22 | String dataWood = myReaderWood.nextLine(); |
23 | 23 | ||
24 | - if(index <= ugLimit) { | 24 | + if(nodes[index].valid) { |
25 | String[] str_split = dataUg.split(",", 0); | 25 | String[] str_split = dataUg.split(",", 0); |
26 | 26 | ||
27 | String[] str_split_wood = dataWood.split(",", 0); | 27 | String[] str_split_wood = dataWood.split(",", 0); |
@@ -87,7 +87,7 @@ public class GetInput { | @@ -87,7 +87,7 @@ public class GetInput { | ||
87 | 87 | ||
88 | 88 | ||
89 | 89 | ||
90 | - giveDomains(m, ugs, fileDirectory, woodYield, ugLimit); // reads the ugs_init file and initializes each variable with its possible prescription values as domain | 90 | + giveDomains(m, ugs, fileDirectory, woodYield, nodes); // reads the ugs_init file and initializes each variable with its possible prescription values as domain |
91 | 91 | ||
92 | 92 | ||
93 | System.out.println("running"); | 93 | System.out.println("running"); |
@@ -115,13 +115,14 @@ public class GetInput { | @@ -115,13 +115,14 @@ public class GetInput { | ||
115 | 115 | ||
116 | for(int i = 0; i < nodes.length; i++){ | 116 | for(int i = 0; i < nodes.length; i++){ |
117 | if(nodes[i].valid) { | 117 | if(nodes[i].valid) { |
118 | - IntVar prescIndex = m.intVar(0, 62); | 118 | + IntVar prescIndex = m.intVar(0, 255); |
119 | 119 | ||
120 | m.element(ugs[i], nodes[i].presc, prescIndex).post(); | 120 | m.element(ugs[i], nodes[i].presc, prescIndex).post(); |
121 | 121 | ||
122 | m.element(woodYield[i], nodes[i].wood_total, prescIndex).post(); | 122 | m.element(woodYield[i], nodes[i].wood_total, prescIndex).post(); |
123 | } | 123 | } |
124 | else{ | 124 | else{ |
125 | + //System.out.println("UG_"+i + " "+woodYield[i]); | ||
125 | m.arithm(woodYield[i], "=", 0).post(); | 126 | m.arithm(woodYield[i], "=", 0).post(); |
126 | } | 127 | } |
127 | } | 128 | } |