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