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 | import java.util.Scanner; |
8 | 8 | |
9 | 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 | 11 | int index = 0; |
12 | 12 | try { |
13 | 13 | File allUg = new File(dir + "/ugs_init.txt"); |
... | ... | @@ -21,7 +21,7 @@ public class GetInput { |
21 | 21 | |
22 | 22 | String dataWood = myReaderWood.nextLine(); |
23 | 23 | |
24 | - if(index <= ugLimit) { | |
24 | + if(nodes[index].valid) { | |
25 | 25 | String[] str_split = dataUg.split(",", 0); |
26 | 26 | |
27 | 27 | String[] str_split_wood = dataWood.split(",", 0); |
... | ... | @@ -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 | 93 | System.out.println("running"); |
... | ... | @@ -115,13 +115,14 @@ public class GetInput { |
115 | 115 | |
116 | 116 | for(int i = 0; i < nodes.length; i++){ |
117 | 117 | if(nodes[i].valid) { |
118 | - IntVar prescIndex = m.intVar(0, 62); | |
118 | + IntVar prescIndex = m.intVar(0, 255); | |
119 | 119 | |
120 | 120 | m.element(ugs[i], nodes[i].presc, prescIndex).post(); |
121 | 121 | |
122 | 122 | m.element(woodYield[i], nodes[i].wood_total, prescIndex).post(); |
123 | 123 | } |
124 | 124 | else{ |
125 | + //System.out.println("UG_"+i + " "+woodYield[i]); | |
125 | 126 | m.arithm(woodYield[i], "=", 0).post(); |
126 | 127 | } |
127 | 128 | } | ... | ... |