Commit 844958a572394cc8a9ca67c5bf564141dfb54408

Authored by Eduardo Eloy
1 parent 26954736

fixed infinite loop bug that caused solution for 200UG limit to take too long, p…

…rogramm should now be test ready
MODFIRE-Prototype/Times/results
1 -Wood_Yield_0 = {4511,5239,5558,5947,6287,6994...,34515}  
2 -8865  
3 -4443.3657  
4 -H  
5 -Wood_Yield_0 = {4511,5239,5558,5947,6287,6994...,34515}  
6 -  
7 -real 0m1,979s  
8 -user 0m4,200s  
9 -sys 0m0,375s  
10 -running  
11 -  
12 -real 0m2,272s  
13 -user 0m3,787s  
14 -sys 0m0,432s  
15 -running  
16 -  
17 -real 0m11,754s  
18 -user 0m5,970s  
19 -sys 0m0,700s  
20 -running  
21 -  
22 -real 0m6,372s  
23 -user 0m6,190s  
24 -sys 0m0,554s  
25 running 1 running
  2 +UG_0 = 3313, wyWood_Yield_0 = 11176
  3 +UG_1 = 20, wyWood_Yield_1 = 1889
  4 +UG_2 = 21, wyWood_Yield_2 = 1692
  5 +UG_3 = 503, wyWood_Yield_3 = 8718
  6 +UG_4 = 503, wyWood_Yield_4 = 2579
  7 +UG_5 = 20, wyWood_Yield_5 = 5684
  8 +UG_6 = 1, wyWood_Yield_6 = 15522
  9 +UG_7 = 503, wyWood_Yield_7 = 2651
  10 +UG_8 = 700, wyWood_Yield_8 = 1773
  11 +UG_9 = 21, wyWood_Yield_9 = 15701
  12 +UG_10 = 503, wyWood_Yield_10 = 890
  13 +UG_11 = 3, wyWood_Yield_11 = 1181
  14 +UG_12 = 503, wyWood_Yield_12 = 5566
  15 +UG_13 = 3, wyWood_Yield_13 = 6344
  16 +UG_14 = 2, wyWood_Yield_14 = 1270
  17 +UG_15 = 3, wyWood_Yield_15 = 2685
  18 +UG_16 = 3, wyWood_Yield_16 = 2518
  19 +UG_17 = 3, wyWood_Yield_17 = 6284
  20 +UG_18 = 3, wyWood_Yield_18 = 3550
  21 +UG_19 = 2, wyWood_Yield_19 = 7943
  22 +UG_20 = 1, wyWood_Yield_20 = 10215
  23 +UG_21 = 3, wyWood_Yield_21 = 1216
  24 +UG_22 = 1, wyWood_Yield_22 = 6146
  25 +UG_23 = 1, wyWood_Yield_23 = 5049
  26 +UG_24 = 3, wyWood_Yield_24 = 6287
  27 +UG_25 = 2, wyWood_Yield_25 = 5814
  28 +UG_26 = 1, wyWood_Yield_26 = 3654
  29 +UG_27 = 503, wyWood_Yield_27 = 7602
  30 +UG_28 = 503, wyWood_Yield_28 = 5097
  31 +UG_29 = 2, wyWood_Yield_29 = 20911
  32 +UG_30 = 503, wyWood_Yield_30 = 6408
  33 +UG_31 = 2, wyWood_Yield_31 = 2595
  34 +UG_32 = 3316, wyWood_Yield_32 = 8640
  35 +UG_33 = 3, wyWood_Yield_33 = 6011
  36 +UG_34 = 2, wyWood_Yield_34 = 6156
  37 +UG_35 = 3, wyWood_Yield_35 = 4356
  38 +UG_36 = 1, wyWood_Yield_36 = 1191
  39 +UG_37 = 503, wyWood_Yield_37 = 2892
  40 +UG_38 = 3, wyWood_Yield_38 = 2352
  41 +UG_39 = 3, wyWood_Yield_39 = 209
  42 +UG_40 = 3, wyWood_Yield_40 = 5356
  43 +UG_41 = 2, wyWood_Yield_41 = 4328
  44 +UG_42 = 3, wyWood_Yield_42 = 4039
  45 +UG_43 = 2, wyWood_Yield_43 = 4140
  46 +UG_44 = 2, wyWood_Yield_44 = 3985
  47 +UG_45 = 2, wyWood_Yield_45 = 1322
  48 +UG_46 = 3, wyWood_Yield_46 = 3478
  49 +UG_47 = 21, wyWood_Yield_47 = 4056
  50 +UG_48 = 2, wyWood_Yield_48 = 1367
  51 +UG_49 = 503, wyWood_Yield_49 = 3752
  52 +UG_50 = 503, wyWood_Yield_50 = 2637
  53 +UG_51 = 503, wyWood_Yield_51 = 1335
  54 +UG_52 = 1, wyWood_Yield_52 = 2980
  55 +UG_53 = 500, wyWood_Yield_53 = 6275
  56 +UG_54 = 503, wyWood_Yield_54 = 814
  57 +UG_55 = 503, wyWood_Yield_55 = 5044
  58 +UG_56 = 2, wyWood_Yield_56 = 8365
  59 +UG_57 = 20, wyWood_Yield_57 = 2690
  60 +UG_58 = 2, wyWood_Yield_58 = 32897
  61 +UG_59 = 3, wyWood_Yield_59 = 4720
  62 +UG_60 = 503, wyWood_Yield_60 = 12677
  63 +UG_61 = 503, wyWood_Yield_61 = 870
  64 +UG_62 = 503, wyWood_Yield_62 = 1031
  65 +UG_63 = 2, wyWood_Yield_63 = 1440
  66 +UG_64 = 503, wyWood_Yield_64 = 787
  67 +UG_65 = 1, wyWood_Yield_65 = 7905
  68 +UG_66 = 503, wyWood_Yield_66 = 1008
  69 +UG_67 = 503, wyWood_Yield_67 = 988
  70 +UG_68 = 2, wyWood_Yield_68 = 3094
  71 +UG_69 = 503, wyWood_Yield_69 = 3632
  72 +UG_70 = 503, wyWood_Yield_70 = 281
  73 +UG_71 = 2, wyWood_Yield_71 = 11008
  74 +UG_72 = 3316, wyWood_Yield_72 = 5480
  75 +UG_73 = 2317, wyWood_Yield_73 = 5715
  76 +UG_74 = 503, wyWood_Yield_74 = 2513
  77 +UG_75 = 503, wyWood_Yield_75 = 2374
  78 +UG_76 = 1, wyWood_Yield_76 = 8849
  79 +UG_77 = 2, wyWood_Yield_77 = 1715
  80 +UG_78 = 503, wyWood_Yield_78 = 2169
  81 +UG_79 = 20, wyWood_Yield_79 = 1670
  82 +UG_80 = 2, wyWood_Yield_80 = 1191
  83 +UG_81 = 503, wyWood_Yield_81 = 2769
  84 +UG_82 = 3316, wyWood_Yield_82 = 7852
  85 +UG_83 = 2, wyWood_Yield_83 = 7220
  86 +UG_84 = 3, wyWood_Yield_84 = 3913
  87 +UG_85 = 1, wyWood_Yield_85 = 4328
  88 +UG_86 = 3, wyWood_Yield_86 = 5616
  89 +UG_87 = 1, wyWood_Yield_87 = 4394
  90 +UG_88 = 1, wyWood_Yield_88 = 5433
  91 +UG_89 = 503, wyWood_Yield_89 = 3734
  92 +UG_90 = 503, wyWood_Yield_90 = 2657
  93 +UG_91 = 503, wyWood_Yield_91 = 3474
  94 +UG_92 = 503, wyWood_Yield_92 = 2988
  95 +UG_93 = 2, wyWood_Yield_93 = 3508
  96 +UG_94 = 3, wyWood_Yield_94 = 3957
  97 +UG_95 = 3, wyWood_Yield_95 = 3095
  98 +UG_96 = 1, wyWood_Yield_96 = 2236
  99 +UG_97 = 503, wyWood_Yield_97 = 1792
  100 +UG_98 = 1, wyWood_Yield_98 = 7881
  101 +UG_99 = 503, wyWood_Yield_99 = 252
  102 +UG_100 = 318, wyWood_Yield_100 = 2725
  103 +UG_101 = 1, wyWood_Yield_101 = 7248
  104 +UG_102 = 2, wyWood_Yield_102 = 2097
  105 +UG_103 = 2, wyWood_Yield_103 = 3419
  106 +UG_104 = 3, wyWood_Yield_104 = 529
  107 +UG_105 = 1, wyWood_Yield_105 = 4845
  108 +UG_106 = 34, wyWood_Yield_106 = 24996
  109 +UG_107 = 3, wyWood_Yield_107 = 2501
  110 +UG_108 = 2, wyWood_Yield_108 = 3899
  111 +UG_109 = 3, wyWood_Yield_109 = 1502
  112 +UG_110 = 3, wyWood_Yield_110 = 5342
  113 +UG_111 = 503, wyWood_Yield_111 = 1252
  114 +UG_112 = 500, wyWood_Yield_112 = 2066
  115 +UG_113 = 3, wyWood_Yield_113 = 6492
  116 +UG_114 = 503, wyWood_Yield_114 = 2863
  117 +UG_115 = 3, wyWood_Yield_115 = 3176
  118 +UG_116 = 1, wyWood_Yield_116 = 11234
  119 +UG_117 = 503, wyWood_Yield_117 = 1245
  120 +UG_118 = 503, wyWood_Yield_118 = 5295
  121 +UG_119 = 503, wyWood_Yield_119 = 2720
  122 +UG_120 = 503, wyWood_Yield_120 = 274
  123 +UG_121 = 503, wyWood_Yield_121 = 3331
  124 +UG_122 = 503, wyWood_Yield_122 = 2067
  125 +UG_123 = 3, wyWood_Yield_123 = 5061
  126 +UG_124 = 2, wyWood_Yield_124 = 11961
  127 +UG_125 = 3316, wyWood_Yield_125 = 5753
  128 +UG_126 = 2, wyWood_Yield_126 = 1582
  129 +UG_127 = 503, wyWood_Yield_127 = 836
  130 +UG_128 = 12, wyWood_Yield_128 = 4064
  131 +UG_129 = 3, wyWood_Yield_129 = 1682
  132 +UG_130 = 2, wyWood_Yield_130 = 1128
  133 +UG_131 = 2, wyWood_Yield_131 = 7645
  134 +UG_132 = 1, wyWood_Yield_132 = 5472
  135 +UG_133 = 2, wyWood_Yield_133 = 225
  136 +UG_134 = 1, wyWood_Yield_134 = 3350
  137 +UG_135 = 503, wyWood_Yield_135 = 3745
  138 +UG_136 = 2, wyWood_Yield_136 = 1892
  139 +UG_137 = 1, wyWood_Yield_137 = 5556
  140 +UG_138 = 2, wyWood_Yield_138 = 590
  141 +UG_139 = 503, wyWood_Yield_139 = 3762
  142 +UG_140 = 2, wyWood_Yield_140 = 4218
  143 +UG_141 = 2, wyWood_Yield_141 = 2449
  144 +UG_142 = 2, wyWood_Yield_142 = 7362
  145 +UG_143 = 503, wyWood_Yield_143 = 455
  146 +UG_144 = 503, wyWood_Yield_144 = 3173
  147 +UG_145 = 20, wyWood_Yield_145 = 2021
  148 +UG_146 = 3316, wyWood_Yield_146 = 6011
  149 +UG_147 = 2, wyWood_Yield_147 = 3700
  150 +UG_148 = 2, wyWood_Yield_148 = 2533
  151 +UG_149 = 2, wyWood_Yield_149 = 6555
  152 +UG_150 = 2, wyWood_Yield_150 = 3621
  153 +UG_151 = 1, wyWood_Yield_151 = 2002
  154 +UG_152 = 2, wyWood_Yield_152 = 3283
  155 +UG_153 = 2, wyWood_Yield_153 = 1390
  156 +UG_154 = 503, wyWood_Yield_154 = 4909
  157 +UG_155 = 503, wyWood_Yield_155 = 3698
  158 +UG_156 = 2, wyWood_Yield_156 = 1881
  159 +UG_157 = 801, wyWood_Yield_157 = 0
  160 +UG_158 = 2, wyWood_Yield_158 = 1454
  161 +UG_159 = 2, wyWood_Yield_159 = 6765
  162 +UG_160 = 3, wyWood_Yield_160 = 10948
  163 +UG_161 = 1, wyWood_Yield_161 = 1398
  164 +UG_162 = 2, wyWood_Yield_162 = 1598
  165 +UG_163 = 3, wyWood_Yield_163 = 4902
  166 +UG_164 = 3, wyWood_Yield_164 = 4662
  167 +UG_165 = 3316, wyWood_Yield_165 = 4187
  168 +UG_166 = 2, wyWood_Yield_166 = 13027
  169 +UG_167 = 2, wyWood_Yield_167 = 2353
  170 +UG_168 = 1, wyWood_Yield_168 = 8650
  171 +UG_169 = 2, wyWood_Yield_169 = 5821
  172 +UG_170 = 1, wyWood_Yield_170 = 327
  173 +UG_171 = 2, wyWood_Yield_171 = 3755
  174 +UG_172 = 503, wyWood_Yield_172 = 1402
  175 +UG_173 = 500, wyWood_Yield_173 = 2430
  176 +UG_174 = 503, wyWood_Yield_174 = 1182
  177 +UG_175 = 2, wyWood_Yield_175 = 1956
  178 +UG_176 = 503, wyWood_Yield_176 = 5340
  179 +UG_177 = 2, wyWood_Yield_177 = 3846
  180 +UG_178 = 2, wyWood_Yield_178 = 1189
  181 +UG_179 = 503, wyWood_Yield_179 = 538
  182 +UG_180 = 15, wyWood_Yield_180 = 735
  183 +UG_181 = 34, wyWood_Yield_181 = 516
  184 +UG_182 = 503, wyWood_Yield_182 = 944
  185 +UG_183 = 503, wyWood_Yield_183 = 2402
  186 +UG_184 = 503, wyWood_Yield_184 = 9486
  187 +UG_185 = 503, wyWood_Yield_185 = 1490
  188 +UG_186 = 503, wyWood_Yield_186 = 2126
  189 +UG_187 = 2, wyWood_Yield_187 = 650
  190 +UG_188 = 503, wyWood_Yield_188 = 1570
  191 +UG_189 = 503, wyWood_Yield_189 = 592
  192 +UG_190 = 503, wyWood_Yield_190 = 998
  193 +UG_191 = 2, wyWood_Yield_191 = 2752
  194 +UG_192 = 2, wyWood_Yield_192 = 1171
  195 +UG_193 = 2, wyWood_Yield_193 = 2233
  196 +UG_194 = 2, wyWood_Yield_194 = 4127
  197 +UG_195 = 21316, wyWood_Yield_195 = 9072
  198 +UG_196 = 2, wyWood_Yield_196 = 2773
  199 +UG_197 = 3, wyWood_Yield_197 = 4989
  200 +UG_198 = 503, wyWood_Yield_198 = 1310
  201 +UG_199 = 503, wyWood_Yield_199 = 935
  202 +UG_200 = 2, wyWood_Yield_200 = 2356
  203 +SUM = 841133
26 204
27 -real 358m39,158s  
28 -user 347m35,512s  
29 -sys 1m6,124s 205 +real 0m10,705s
  206 +user 0m13,911s
  207 +sys 0m0,407s
MODFIRE-Prototype/out/production/MODFIRE-Prototype/CustomPropagator2.class
No preview for this file type
MODFIRE-Prototype/outputPairs.csv
1 -1,3 1 +1,3313
2 2,20 2 2,20
3 3,21 3 3,21
4 4,503 4 4,503
5 5,503 5 5,503
6 6,20 6 6,20
7 -7,3316 7 +7,1
8 8,503 8 8,503
9 9,700 9 9,700
10 10,21 10 10,21
11 11,503 11 11,503
12 12,3 12 12,3
13 13,503 13 13,503
14 -14,1 14 +14,3
15 15,2 15 15,2
16 19,3 16 19,3
17 20,3 17 20,3
18 21,3 18 21,3
19 22,3 19 22,3
20 23,2 20 23,2
21 -24,3 21 +24,1
22 25,3 22 25,3
23 27,1 23 27,1
24 28,1 24 28,1
@@ -31,11 +31,11 @@ @@ -31,11 +31,11 @@
31 35,503 31 35,503
32 37,2 32 37,2
33 38,3316 33 38,3316
34 -39,2 34 +39,3
35 40,2 35 40,2
36 41,3 36 41,3
37 42,1 37 42,1
38 -43,502 38 +43,503
39 45,3 39 45,3
40 46,3 40 46,3
41 48,3 41 48,3
@@ -57,10 +57,10 @@ @@ -57,10 +57,10 @@
57 64,2 57 64,2
58 66,20 58 66,20
59 67,2 59 67,2
60 -68,2  
61 -69,502 60 +68,3
  61 +69,503
62 70,503 62 70,503
63 -71,502 63 +71,503
64 72,2 64 72,2
65 73,503 65 73,503
66 74,1 66 74,1
@@ -79,23 +79,123 @@ @@ -79,23 +79,123 @@
79 90,503 79 90,503
80 91,20 80 91,20
81 92,2 81 92,2
82 -93,502 82 +93,503
83 94,3316 83 94,3316
84 95,2 84 95,2
85 96,3 85 96,3
86 97,1 86 97,1
87 98,3 87 98,3
88 -99,2 88 +99,1
89 100,1 89 100,1
90 101,503 90 101,503
91 -102,502  
92 -103,502 91 +102,503
  92 +103,503
93 104,503 93 104,503
94 105,2 94 105,2
95 106,3 95 106,3
96 107,3 96 107,3
97 108,1 97 108,1
98 -109,502  
99 -110,2 98 +109,503
  99 +110,1
100 111,503 100 111,503
101 112,318 101 112,318
  102 +113,1
  103 +114,2
  104 +115,2
  105 +116,3
  106 +117,1
  107 +118,34
  108 +119,3
  109 +120,2
  110 +121,3
  111 +122,3
  112 +124,503
  113 +125,500
  114 +126,3
  115 +127,503
  116 +128,3
  117 +129,1
  118 +130,503
  119 +131,503
  120 +132,503
  121 +133,503
  122 +134,503
  123 +135,503
  124 +136,3
  125 +138,2
  126 +140,3316
  127 +141,2
  128 +142,503
  129 +143,12
  130 +144,3
  131 +145,2
  132 +146,2
  133 +147,1
  134 +149,2
  135 +150,1
  136 +153,503
  137 +154,2
  138 +155,1
  139 +156,2
  140 +157,503
  141 +158,2
  142 +159,2
  143 +160,2
  144 +161,503
  145 +162,503
  146 +163,20
  147 +164,3316
  148 +165,2
  149 +166,2
  150 +167,2
  151 +168,2
  152 +169,1
  153 +170,2
  154 +171,2
  155 +172,503
  156 +173,503
  157 +174,2
  158 +175,801
  159 +176,2
  160 +177,2
  161 +178,3
  162 +179,1
  163 +180,2
  164 +181,3
  165 +182,3
  166 +183,3316
  167 +184,2
  168 +185,2
  169 +186,1
  170 +187,2
  171 +188,1
  172 +189,2
  173 +190,503
  174 +191,500
  175 +192,503
  176 +193,2
  177 +194,503
  178 +195,2
  179 +196,2
  180 +198,503
  181 +199,15
  182 +200,34
  183 +201,503
  184 +202,503
  185 +203,503
  186 +204,503
  187 +206,503
  188 +207,2
  189 +208,503
  190 +209,503
  191 +210,503
  192 +211,2
  193 +212,2
  194 +213,2
  195 +214,2
  196 +215,21316
  197 +217,2
  198 +218,3
  199 +219,503
  200 +220,503
  201 +221,2
MODFIRE-Prototype/src/CustomPropagator2.java
@@ -56,8 +56,8 @@ public class CustomPropagator2 extends org.chocosolver.solver.constraints.Propag @@ -56,8 +56,8 @@ public class CustomPropagator2 extends org.chocosolver.solver.constraints.Propag
56 //recursive function that fills an array list with the continuous adjacent UGs that have CUTS. 56 //recursive function that fills an array list with the continuous adjacent UGs that have CUTS.
57 public int gPropagate(int first, int ugIndex, int year, int sum) throws Exception{ 57 public int gPropagate(int first, int ugIndex, int year, int sum) throws Exception{
58 if(ugIndex == first){ //if the UG we are on isn't the UG we started out from 58 if(ugIndex == first){ //if the UG we are on isn't the UG we started out from
59 - if(nodes[ugIndex].valid && vars[ugIndex].isInstantiated()) { //and if this UG is instantiaded and hasn't been gladed yet  
60 - 59 + if(nodes[ugIndex].valid && vars[ugIndex].isInstantiated() && nodes[ugIndex].time < year) { //and if this UG is instantiaded and hasn't been gladed yet
  60 + nodes[ugIndex].time = year;
61 sum = sum + (int)nodes[ugIndex].area; 61 sum = sum + (int)nodes[ugIndex].area;
62 62
63 if(sum > b){ 63 if(sum > b){
@@ -67,7 +67,7 @@ public class CustomPropagator2 extends org.chocosolver.solver.constraints.Propag @@ -67,7 +67,7 @@ public class CustomPropagator2 extends org.chocosolver.solver.constraints.Propag
67 for (int rec = 0; rec < nodes[ugIndex].adj.length; rec++) { //and check its adjacencies 67 for (int rec = 0; rec < nodes[ugIndex].adj.length; rec++) { //and check its adjacencies
68 68
69 // to access the adjacent ugs we go through the ADJ array in current UG's node. 69 // to access the adjacent ugs we go through the ADJ array in current UG's node.
70 - if(nodes[nodes[ugIndex].adj[rec]].valid && vars[nodes[ugIndex].adj[rec]].isInstantiated()) { 70 + if(nodes[nodes[ugIndex].adj[rec]].valid && vars[nodes[ugIndex].adj[rec]].isInstantiated() && nodes[nodes[ugIndex].adj[rec]].time < year) {
71 //we only do this if the adjacent UG's haven't been gladed and if they've been instantiated. 71 //we only do this if the adjacent UG's haven't been gladed and if they've been instantiated.
72 sum = gPropagate(first, nodes[ugIndex].adj[rec], year, sum); 72 sum = gPropagate(first, nodes[ugIndex].adj[rec], year, sum);
73 } 73 }
@@ -75,7 +75,7 @@ public class CustomPropagator2 extends org.chocosolver.solver.constraints.Propag @@ -75,7 +75,7 @@ public class CustomPropagator2 extends org.chocosolver.solver.constraints.Propag
75 } 75 }
76 } 76 }
77 else { 77 else {
78 - if (nodes[ugIndex].valid && vars[ugIndex].isInstantiated()) { //check if the UG hasn't been gladed and if it's already instantiated 78 + if (nodes[ugIndex].valid && vars[ugIndex].isInstantiated() && nodes[ugIndex].time < year) { //check if the UG hasn't been gladed and if it's already instantiated
79 79
80 int ugPresc = vars[ugIndex].getValue(); //we get the prescription value of the current UG 80 int ugPresc = vars[ugIndex].getValue(); //we get the prescription value of the current UG
81 81
@@ -83,6 +83,7 @@ public class CustomPropagator2 extends org.chocosolver.solver.constraints.Propag @@ -83,6 +83,7 @@ public class CustomPropagator2 extends org.chocosolver.solver.constraints.Propag
83 83
84 if(hasCut.contains(ugPresc)){ //if the List with all those prescriptions has the prescription the UG has been instantiated with. 84 if(hasCut.contains(ugPresc)){ //if the List with all those prescriptions has the prescription the UG has been instantiated with.
85 85
  86 + nodes[ugIndex].time = year;
86 87
87 sum = sum + (int)nodes[ugIndex].area; 88 sum = sum + (int)nodes[ugIndex].area;
88 89
@@ -92,7 +93,7 @@ public class CustomPropagator2 extends org.chocosolver.solver.constraints.Propag @@ -92,7 +93,7 @@ public class CustomPropagator2 extends org.chocosolver.solver.constraints.Propag
92 93
93 for (int rec = 0; rec < nodes[ugIndex].adj.length; rec++) { //and check its adjacencies 94 for (int rec = 0; rec < nodes[ugIndex].adj.length; rec++) { //and check its adjacencies
94 95
95 - if(nodes[nodes[ugIndex].adj[rec]].valid && vars[nodes[ugIndex].adj[rec]].isInstantiated()) { 96 + if(nodes[nodes[ugIndex].adj[rec]].valid && vars[nodes[ugIndex].adj[rec]].isInstantiated() && nodes[nodes[ugIndex].adj[rec]].time < year) {
96 sum = gPropagate(first, nodes[ugIndex].adj[rec], year, sum); 97 sum = gPropagate(first, nodes[ugIndex].adj[rec], year, sum);
97 } 98 }
98 } 99 }
@@ -136,6 +137,9 @@ public class CustomPropagator2 extends org.chocosolver.solver.constraints.Propag @@ -136,6 +137,9 @@ public class CustomPropagator2 extends org.chocosolver.solver.constraints.Propag
136 // if this value was 0 that means the UG with this presc has no cuts 137 // if this value was 0 that means the UG with this presc has no cuts
137 138
138 for(int i = 0; i < nodes.length; i++) 139 for(int i = 0; i < nodes.length; i++)
  140 + nodes[i].time = 0;
  141 +
  142 +
139 for (int p = 0; p < nodes[ugIndex].years[prescIndex].length; p++) { //for every year that our UG has cuts 143 for (int p = 0; p < nodes[ugIndex].years[prescIndex].length; p++) { //for every year that our UG has cuts
140 144
141 int year = nodes[ugIndex].years[prescIndex][p]; //current year 145 int year = nodes[ugIndex].years[prescIndex][p]; //current year
@@ -156,7 +160,8 @@ public class CustomPropagator2 extends org.chocosolver.solver.constraints.Propag @@ -156,7 +160,8 @@ public class CustomPropagator2 extends org.chocosolver.solver.constraints.Propag
156 // same as gPropagate but without the "isInstatiated" checks 160 // same as gPropagate but without the "isInstatiated" checks
157 public int g(int first, int ugIndex, int year, int sum) throws Exception{ 161 public int g(int first, int ugIndex, int year, int sum) throws Exception{
158 if(ugIndex == first){ 162 if(ugIndex == first){
159 - if(nodes[ugIndex].valid) { 163 + if(nodes[ugIndex].valid && nodes[ugIndex].time < year) {
  164 + nodes[ugIndex].time = year;
160 165
161 sum = sum + (int)nodes[ugIndex].area; 166 sum = sum + (int)nodes[ugIndex].area;
162 167
@@ -167,20 +172,21 @@ public class CustomPropagator2 extends org.chocosolver.solver.constraints.Propag @@ -167,20 +172,21 @@ public class CustomPropagator2 extends org.chocosolver.solver.constraints.Propag
167 for (int rec = 0; rec < nodes[ugIndex].adj.length; rec++) { 172 for (int rec = 0; rec < nodes[ugIndex].adj.length; rec++) {
168 173
169 174
170 - if(nodes[nodes[ugIndex].adj[rec]].valid) { 175 + if(nodes[nodes[ugIndex].adj[rec]].valid && nodes[nodes[ugIndex].adj[rec]].time < year) {
171 sum = g(first, nodes[ugIndex].adj[rec], year, sum); 176 sum = g(first, nodes[ugIndex].adj[rec], year, sum);
172 } 177 }
173 } 178 }
174 } 179 }
175 } 180 }
176 else { 181 else {
177 - if (nodes[ugIndex].valid) { 182 + if (nodes[ugIndex].valid && nodes[ugIndex].time < year) {
178 183
179 int ugPresc = vars[ugIndex].getValue(); 184 int ugPresc = vars[ugIndex].getValue();
180 185
181 ArrayList<Integer> hasCut = hasCutInYear(ugIndex, year); 186 ArrayList<Integer> hasCut = hasCutInYear(ugIndex, year);
182 187
183 if(hasCut.contains(ugPresc)){ 188 if(hasCut.contains(ugPresc)){
  189 + nodes[ugIndex].time = year;
184 190
185 sum = sum + (int)nodes[ugIndex].area; 191 sum = sum + (int)nodes[ugIndex].area;
186 192
@@ -190,7 +196,7 @@ public class CustomPropagator2 extends org.chocosolver.solver.constraints.Propag @@ -190,7 +196,7 @@ public class CustomPropagator2 extends org.chocosolver.solver.constraints.Propag
190 196
191 for (int rec = 0; rec < nodes[ugIndex].adj.length; rec++) { 197 for (int rec = 0; rec < nodes[ugIndex].adj.length; rec++) {
192 198
193 - if(nodes[nodes[ugIndex].adj[rec]].valid) { 199 + if(nodes[nodes[ugIndex].adj[rec]].valid && nodes[nodes[ugIndex].adj[rec]].time < year) {
194 sum = g(first, nodes[ugIndex].adj[rec], year, sum); 200 sum = g(first, nodes[ugIndex].adj[rec], year, sum);
195 } 201 }
196 } 202 }
@@ -233,6 +239,7 @@ public class CustomPropagator2 extends org.chocosolver.solver.constraints.Propag @@ -233,6 +239,7 @@ public class CustomPropagator2 extends org.chocosolver.solver.constraints.Propag
233 if (nodes[ugIndex].years[prescIndex][0] > 0) { //if this UG with this PREC has cuts 239 if (nodes[ugIndex].years[prescIndex][0] > 0) { //if this UG with this PREC has cuts
234 240
235 for(int i = 0; i < nodes.length; i++) 241 for(int i = 0; i < nodes.length; i++)
  242 + nodes[i].time = 0;
236 243
237 for (int p = 0; p < nodes[ugIndex].years[prescIndex].length; p++) { //for every year that our UG has cuts 244 for (int p = 0; p < nodes[ugIndex].years[prescIndex].length; p++) { //for every year that our UG has cuts
238 245