Commit 424c167575d6b22e3584d3092ce43a583a9d9d15

Authored by ednice
1 parent 7ed8d2ad
Exists in Standardized

more standardization, doesn't require all the criteria files

MODFIRE-Prototype/Maps/MapInputFile.txt
@@ -7,21 +7,19 @@ @@ -7,21 +7,19 @@
7 10,2067,Ec-h 7 10,2067,Ec-h
8 11,2048,Pb-t 8 11,2048,Pb-t
9 11,2063,Pb-h 9 11,2063,Pb-h
10 -12,2027,Ec-h  
11 -12,2057,Sb-t  
12 -12,2067,Sb-t 10 +12,2025,Ec-h
  11 +12,2055,Sb-t
  12 +12,2065,Sb-t
13 13,2028,Pb-t 13 13,2028,Pb-t
14 13,2038,Pb-t 14 13,2038,Pb-t
15 13,2048,Pb-t 15 13,2048,Pb-t
16 13,2063,Pb-h 16 13,2063,Pb-h
17 -14,2027,Ec-h  
18 -14,2057,Sb-t  
19 -14,2067,Sb-t  
20 -167,2023,Ec-h  
21 -167,2034,Ec-h  
22 -167,2045,Ec-h  
23 -167,2056,Ec-h  
24 -167,2067,Ec-h 17 +14,2026,Ec-h
  18 +14,2056,Sb-t
  19 +14,2066,Sb-t
  20 +167,2022,Ec-h
  21 +167,2052,Sb-t
  22 +167,2062,Sb-t
25 451,2021,Pb-h 23 451,2021,Pb-h
26 451,2051,Sb-t 24 451,2051,Sb-t
27 451,2061,Sb-t 25 451,2061,Sb-t
MODFIRE-Prototype/Maps/MapOutput/Map_2022.png

384 KB | W: | H:

384 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
MODFIRE-Prototype/Maps/MapOutput/Map_2023.png

381 KB | W: | H:

381 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
MODFIRE-Prototype/Maps/MapOutput/Map_2024.png

379 KB | W: | H:

379 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
MODFIRE-Prototype/Maps/MapOutput/Map_2025.png

377 KB | W: | H:

377 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
MODFIRE-Prototype/Maps/MapOutput/Map_2026.png

375 KB | W: | H:

374 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
MODFIRE-Prototype/Maps/MapOutput/Map_2027.png

373 KB | W: | H:

373 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
MODFIRE-Prototype/Maps/MapOutput/Map_2028.png 0 โ†’ 100644

371 KB

MODFIRE-Prototype/Results/outputPairsSingle.csv
@@ -0,0 +1,203 @@ @@ -0,0 +1,203 @@
  1 +3,19
  2 +4,500
  3 +5,500
  4 +7,1
  5 +19,1
  6 +20,1
  7 +21,1
  8 +22,1
  9 +23,1
  10 +24,1
  11 +29,1
  12 +34,1
  13 +39,1
  14 +40,1
  15 +41,3
  16 +46,2
  17 +59,500
  18 +63,501
  19 +64,1
  20 +66,19
  21 +90,304
  22 +91,19
  23 +92,3
  24 +93,500
  25 +95,1
  26 +97,2
  27 +98,2
  28 +99,1
  29 +100,1
  30 +101,500
  31 +102,500
  32 +103,500
  33 +104,500
  34 +105,1
  35 +106,1
  36 +108,1
  37 +109,500
  38 +110,1
  39 +135,308
  40 +136,2
  41 +138,1
  42 +144,1
  43 +153,304
  44 +163,19
  45 +164,1
  46 +172,500
  47 +173,308
  48 +174,1
  49 +177,1
  50 +178,3
  51 +180,1
  52 +181,1
  53 +184,1
  54 +187,3
  55 +194,500
  56 +195,1
  57 +196,1
  58 +210,500
  59 +218,1
  60 +219,500
  61 +225,500
  62 +226,1
  63 +227,1
  64 +229,3
  65 +230,1
  66 +231,3
  67 +233,500
  68 +235,1
  69 +236,1
  70 +237,1
  71 +246,3
  72 +247,1
  73 +248,1
  74 +250,1
  75 +251,3
  76 +255,1
  77 +256,19
  78 +257,20
  79 +258,1
  80 +259,500
  81 +260,1
  82 +266,1
  83 +267,1
  84 +268,1
  85 +269,1
  86 +270,500
  87 +271,312
  88 +272,1
  89 +274,500
  90 +275,1
  91 +276,1
  92 +277,500
  93 +278,4
  94 +297,1
  95 +307,316
  96 +348,1
  97 +363,3
  98 +364,3
  99 +368,1
  100 +369,1
  101 +370,3
  102 +371,1
  103 +372,1
  104 +373,2
  105 +374,500
  106 +375,2
  107 +376,1
  108 +377,1
  109 +378,1
  110 +379,500
  111 +380,1601
  112 +381,1
  113 +384,500
  114 +385,500
  115 +386,1
  116 +387,3
  117 +391,1
  118 +408,3
  119 +409,1
  120 +410,1
  121 +414,1
  122 +427,501
  123 +428,500
  124 +429,500
  125 +433,1
  126 +458,500
  127 +459,1
  128 +460,3
  129 +461,1
  130 +464,1
  131 +465,3
  132 +470,500
  133 +474,802
  134 +483,500
  135 +484,1
  136 +501,1
  137 +502,2
  138 +503,1
  139 +504,1
  140 +505,1
  141 +512,500
  142 +533,500
  143 +555,19
  144 +556,1
  145 +557,1
  146 +558,1
  147 +559,1
  148 +560,1
  149 +586,2
  150 +587,1
  151 +588,1
  152 +589,13
  153 +590,500
  154 +591,19
  155 +592,1
  156 +605,2
  157 +606,1
  158 +611,500
  159 +612,1
  160 +614,1
  161 +615,2
  162 +616,1
  163 +618,1
  164 +619,1
  165 +642,3
  166 +655,800
  167 +675,1
  168 +678,1
  169 +679,1
  170 +682,1
  171 +712,28
  172 +713,2
  173 +730,34
  174 +731,1
  175 +736,501
  176 +737,308
  177 +742,2
  178 +743,1
  179 +746,801
  180 +748,801
  181 +749,500
  182 +755,3
  183 +756,1
  184 +757,1
  185 +762,1
  186 +763,1
  187 +764,1
  188 +767,1
  189 +773,500
  190 +774,1
  191 +775,304
  192 +776,801
  193 +777,801
  194 +782,1
  195 +828,19
  196 +832,19
  197 +941,35
  198 +952,34
  199 +1427,1
  200 +1468,19
  201 +1571,800
  202 +1622,1
  203 +1623,20
MODFIRE-Prototype/Results/pairCriteria.csv
@@ -0,0 +1,204 @@ @@ -0,0 +1,204 @@
  1 +UG_2 = 19, Crit0_2 = 1565,end
  2 +UG_3 = 500, Crit0_3 = 4966,end
  3 +UG_4 = 500, Crit0_4 = 1481,end
  4 +UG_6 = 1, Crit0_6 = 15522,end
  5 +UG_15 = 1, Crit0_15 = 2505,end
  6 +UG_16 = 1, Crit0_16 = 2479,end
  7 +UG_17 = 1, Crit0_17 = 6239,end
  8 +UG_18 = 1, Crit0_18 = 3524,end
  9 +UG_19 = 1, Crit0_19 = 7002,end
  10 +UG_20 = 1, Crit0_20 = 10215,end
  11 +UG_24 = 1, Crit0_24 = 6103,end
  12 +UG_29 = 1, Crit0_29 = 18458,end
  13 +UG_33 = 1, Crit0_33 = 5713,end
  14 +UG_34 = 1, Crit0_34 = 5519,end
  15 +UG_35 = 3, Crit0_35 = 4356,end
  16 +UG_39 = 2, Crit0_39 = 183,end
  17 +UG_51 = 500, Crit0_51 = 747,end
  18 +UG_55 = 501, Crit0_55 = 3420,end
  19 +UG_56 = 1, Crit0_56 = 7184,end
  20 +UG_57 = 19, Crit0_57 = 2332,end
  21 +UG_78 = 304, Crit0_78 = 1075,end
  22 +UG_79 = 19, Crit0_79 = 1436,end
  23 +UG_80 = 3, Crit0_80 = 1005,end
  24 +UG_81 = 500, Crit0_81 = 1775,end
  25 +UG_83 = 1, Crit0_83 = 6375,end
  26 +UG_85 = 2, Crit0_85 = 3885,end
  27 +UG_86 = 2, Crit0_86 = 4966,end
  28 +UG_87 = 1, Crit0_87 = 4394,end
  29 +UG_88 = 1, Crit0_88 = 5433,end
  30 +UG_89 = 500, Crit0_89 = 2221,end
  31 +UG_90 = 500, Crit0_90 = 1596,end
  32 +UG_91 = 500, Crit0_91 = 2079,end
  33 +UG_92 = 500, Crit0_92 = 1950,end
  34 +UG_93 = 1, Crit0_93 = 3041,end
  35 +UG_94 = 1, Crit0_94 = 3896,end
  36 +UG_96 = 1, Crit0_96 = 2236,end
  37 +UG_97 = 500, Crit0_97 = 1002,end
  38 +UG_98 = 1, Crit0_98 = 7881,end
  39 +UG_122 = 308, Crit0_122 = 1025,end
  40 +UG_123 = 2, Crit0_123 = 4441,end
  41 +UG_124 = 1, Crit0_124 = 10646,end
  42 +UG_129 = 1, Crit0_129 = 1633,end
  43 +UG_135 = 304, Crit0_135 = 1817,end
  44 +UG_145 = 19, Crit0_145 = 1783,end
  45 +UG_146 = 1, Crit0_146 = 4550,end
  46 +UG_154 = 500, Crit0_154 = 3036,end
  47 +UG_155 = 308, Crit0_155 = 1855,end
  48 +UG_156 = 1, Crit0_156 = 1600,end
  49 +UG_159 = 1, Crit0_159 = 5964,end
  50 +UG_160 = 3, Crit0_160 = 10948,end
  51 +UG_162 = 1, Crit0_162 = 1372,end
  52 +UG_163 = 1, Crit0_163 = 4658,end
  53 +UG_166 = 1, Crit0_166 = 11543,end
  54 +UG_169 = 3, Crit0_169 = 4910,end
  55 +UG_176 = 500, Crit0_176 = 3174,end
  56 +UG_177 = 1, Crit0_177 = 3381,end
  57 +UG_178 = 1, Crit0_178 = 1010,end
  58 +UG_190 = 500, Crit0_190 = 448,end
  59 +UG_197 = 1, Crit0_197 = 4742,end
  60 +UG_198 = 500, Crit0_198 = 611,end
  61 +UG_203 = 500, Crit0_203 = 5864,end
  62 +UG_204 = 1, Crit0_204 = 2926,end
  63 +UG_205 = 1, Crit0_205 = 3182,end
  64 +UG_206 = 3, Crit0_206 = 2128,end
  65 +UG_207 = 1, Crit0_207 = 728,end
  66 +UG_208 = 3, Crit0_208 = 4225,end
  67 +UG_209 = 500, Crit0_209 = 145,end
  68 +UG_210 = 1, Crit0_210 = 7248,end
  69 +UG_211 = 1, Crit0_211 = 4052,end
  70 +UG_212 = 1, Crit0_212 = 1797,end
  71 +UG_219 = 3, Crit0_219 = 3921,end
  72 +UG_220 = 1, Crit0_220 = 860,end
  73 +UG_221 = 1, Crit0_221 = 934,end
  74 +UG_223 = 1, Crit0_223 = 1434,end
  75 +UG_224 = 3, Crit0_224 = 2031,end
  76 +UG_228 = 1, Crit0_228 = 10211,end
  77 +UG_229 = 19, Crit0_229 = 8193,end
  78 +UG_230 = 20, Crit0_230 = 8686,end
  79 +UG_231 = 1, Crit0_231 = 6994,end
  80 +UG_232 = 500, Crit0_232 = 1923,end
  81 +UG_233 = 1, Crit0_233 = 4555,end
  82 +UG_236 = 1, Crit0_236 = 1372,end
  83 +UG_237 = 1, Crit0_237 = 3314,end
  84 +UG_238 = 1, Crit0_238 = 4889,end
  85 +UG_239 = 1, Crit0_239 = 11071,end
  86 +UG_240 = 500, Crit0_240 = 1578,end
  87 +UG_241 = 312, Crit0_241 = 4140,end
  88 +UG_242 = 1, Crit0_242 = 1885,end
  89 +UG_244 = 500, Crit0_244 = 1431,end
  90 +UG_245 = 1, Crit0_245 = 6146,end
  91 +UG_246 = 1, Crit0_246 = 590,end
  92 +UG_247 = 500, Crit0_247 = 2186,end
  93 +UG_248 = 4, Crit0_248 = 2056,end
  94 +UG_266 = 1, Crit0_266 = 8471,end
  95 +UG_275 = 316, Crit0_275 = 5909,end
  96 +UG_312 = 1, Crit0_312 = 2676,end
  97 +UG_324 = 3, Crit0_324 = 3736,end
  98 +UG_325 = 3, Crit0_325 = 3665,end
  99 +UG_327 = 1, Crit0_327 = 3023,end
  100 +UG_328 = 1, Crit0_328 = 4418,end
  101 +UG_329 = 3, Crit0_329 = 4808,end
  102 +UG_330 = 1, Crit0_330 = 7342,end
  103 +UG_331 = 1, Crit0_331 = 3277,end
  104 +UG_332 = 2, Crit0_332 = 1702,end
  105 +UG_333 = 500, Crit0_333 = 947,end
  106 +UG_334 = 2, Crit0_334 = 4719,end
  107 +UG_335 = 1, Crit0_335 = 1917,end
  108 +UG_336 = 1, Crit0_336 = 11583,end
  109 +UG_337 = 1, Crit0_337 = 2108,end
  110 +UG_338 = 500, Crit0_338 = 2272,end
  111 +UG_339 = 1601, Crit0_339 = 210,end
  112 +UG_340 = 1, Crit0_340 = 204,end
  113 +UG_343 = 500, Crit0_343 = 549,end
  114 +UG_344 = 500, Crit0_344 = 1345,end
  115 +UG_345 = 1, Crit0_345 = 1348,end
  116 +UG_346 = 3, Crit0_346 = 6395,end
  117 +UG_350 = 1, Crit0_350 = 4219,end
  118 +UG_366 = 3, Crit0_366 = 9817,end
  119 +UG_367 = 1, Crit0_367 = 7741,end
  120 +UG_368 = 1, Crit0_368 = 4946,end
  121 +UG_372 = 1, Crit0_372 = 2714,end
  122 +UG_383 = 501, Crit0_383 = 1632,end
  123 +UG_384 = 500, Crit0_384 = 859,end
  124 +UG_385 = 500, Crit0_385 = 1095,end
  125 +UG_388 = 1, Crit0_388 = 6357,end
  126 +UG_410 = 500, Crit0_410 = 3069,end
  127 +UG_411 = 1, Crit0_411 = 1689,end
  128 +UG_412 = 3, Crit0_412 = 1279,end
  129 +UG_413 = 1, Crit0_413 = 2443,end
  130 +UG_416 = 1, Crit0_416 = 1204,end
  131 +UG_417 = 3, Crit0_417 = 2147,end
  132 +UG_422 = 500, Crit0_422 = 239,end
  133 +UG_426 = 802, Crit0_426 = 0,end
  134 +UG_435 = 500, Crit0_435 = 1426,end
  135 +UG_436 = 1, Crit0_436 = 1045,end
  136 +UG_452 = 1, Crit0_452 = 12250,end
  137 +UG_453 = 2, Crit0_453 = 3940,end
  138 +UG_454 = 1, Crit0_454 = 2526,end
  139 +UG_455 = 1, Crit0_455 = 2241,end
  140 +UG_456 = 1, Crit0_456 = 5184,end
  141 +UG_463 = 500, Crit0_463 = 2257,end
  142 +UG_482 = 500, Crit0_482 = 124,end
  143 +UG_501 = 19, Crit0_501 = 16074,end
  144 +UG_502 = 1, Crit0_502 = 2019,end
  145 +UG_503 = 1, Crit0_503 = 1951,end
  146 +UG_504 = 1, Crit0_504 = 4891,end
  147 +UG_505 = 1, Crit0_505 = 6115,end
  148 +UG_506 = 1, Crit0_506 = 1076,end
  149 +UG_530 = 2, Crit0_530 = 5750,end
  150 +UG_531 = 1, Crit0_531 = 2560,end
  151 +UG_532 = 1, Crit0_532 = 5920,end
  152 +UG_533 = 13, Crit0_533 = 3993,end
  153 +UG_534 = 500, Crit0_534 = 7716,end
  154 +UG_535 = 19, Crit0_535 = 6966,end
  155 +UG_536 = 1, Crit0_536 = 11568,end
  156 +UG_549 = 2, Crit0_549 = 9581,end
  157 +UG_550 = 1, Crit0_550 = 4005,end
  158 +UG_555 = 500, Crit0_555 = 650,end
  159 +UG_556 = 1, Crit0_556 = 5364,end
  160 +UG_558 = 1, Crit0_558 = 1488,end
  161 +UG_559 = 2, Crit0_559 = 4807,end
  162 +UG_560 = 1, Crit0_560 = 3181,end
  163 +UG_561 = 1, Crit0_561 = 932,end
  164 +UG_562 = 1, Crit0_562 = 4306,end
  165 +UG_585 = 3, Crit0_585 = 344,end
  166 +UG_597 = 800, Crit0_597 = 0,end
  167 +UG_616 = 1, Crit0_616 = 7393,end
  168 +UG_619 = 1, Crit0_619 = 3075,end
  169 +UG_620 = 1, Crit0_620 = 19353,end
  170 +UG_623 = 1, Crit0_623 = 10531,end
  171 +UG_653 = 28, Crit0_653 = 2509,end
  172 +UG_654 = 2, Crit0_654 = 3381,end
  173 +UG_669 = 34, Crit0_669 = 2771,end
  174 +UG_670 = 1, Crit0_670 = 1128,end
  175 +UG_674 = 501, Crit0_674 = 2182,end
  176 +UG_675 = 308, Crit0_675 = 1760,end
  177 +UG_680 = 2, Crit0_680 = 1783,end
  178 +UG_681 = 1, Crit0_681 = 3511,end
  179 +UG_684 = 801, Crit0_684 = 0,end
  180 +UG_685 = 801, Crit0_685 = 0,end
  181 +UG_686 = 500, Crit0_686 = 1012,end
  182 +UG_691 = 3, Crit0_691 = 6719,end
  183 +UG_692 = 1, Crit0_692 = 6028,end
  184 +UG_693 = 1, Crit0_693 = 5366,end
  185 +UG_698 = 1, Crit0_698 = 7466,end
  186 +UG_699 = 1, Crit0_699 = 7031,end
  187 +UG_700 = 1, Crit0_700 = 12622,end
  188 +UG_703 = 1, Crit0_703 = 4814,end
  189 +UG_707 = 500, Crit0_707 = 2504,end
  190 +UG_708 = 1, Crit0_708 = 2610,end
  191 +UG_709 = 304, Crit0_709 = 384,end
  192 +UG_710 = 801, Crit0_710 = 0,end
  193 +UG_711 = 801, Crit0_711 = 0,end
  194 +UG_716 = 1, Crit0_716 = 5087,end
  195 +UG_740 = 19, Crit0_740 = 2677,end
  196 +UG_743 = 19, Crit0_743 = 1061,end
  197 +UG_848 = 35, Crit0_848 = 5109,end
  198 +UG_859 = 34, Crit0_859 = 3010,end
  199 +UG_1264 = 1, Crit0_1264 = 1050,end
  200 +UG_1293 = 19, Crit0_1293 = 4128,end
  201 +UG_1369 = 800, Crit0_1369 = 0,end
  202 +UG_1403 = 1, Crit0_1403 = 300,end
  203 +UG_1404 = 20, Crit0_1404 = 138,end
  204 +CRIT0_SUM = 788418
MODFIRE-Prototype/out/production/MODFIRE-Prototype/MainTime.class
No preview for this file type
MODFIRE-Prototype/out/production/MODFIRE-Prototype/MainWithSpecific.class
No preview for this file type
MODFIRE-Prototype/out/production/MODFIRE-Prototype/UG.class
No preview for this file type
MODFIRE-Prototype/src/MainTime.java
@@ -9,7 +9,7 @@ import java.io.*; @@ -9,7 +9,7 @@ import java.io.*;
9 import java.util.ArrayList; 9 import java.util.ArrayList;
10 import java.util.List; 10 import java.util.List;
11 import java.util.Scanner; 11 import java.util.Scanner;
12 - 12 +/*
13 public class MainTime { 13 public class MainTime {
14 14
15 public static void giveDomains (Model model, IntVar[] ugs, String dir, IntVar[] crit0, IntVar[] crit1, 15 public static void giveDomains (Model model, IntVar[] ugs, String dir, IntVar[] crit0, IntVar[] crit1,
@@ -210,7 +210,7 @@ public class MainTime { @@ -210,7 +210,7 @@ public class MainTime {
210 8-R 210 8-R
211 9-Rait 211 9-Rait
212 10-Sbiom 212 10-Sbiom
213 - */ 213 +
214 214
215 String[] varNames = new String[]{"Crit0","Crit1","Crit2","Crit3","Crit4","Crit5","Crit6","Crit7","Crit8","Crit9","Crit10"}; 215 String[] varNames = new String[]{"Crit0","Crit1","Crit2","Crit3","Crit4","Crit5","Crit6","Crit7","Crit8","Crit9","Crit10"};
216 ArrayList<Boolean> flags = new ArrayList<>(); 216 ArrayList<Boolean> flags = new ArrayList<>();
@@ -507,4 +507,4 @@ public class MainTime { @@ -507,4 +507,4 @@ public class MainTime {
507 507
508 System.out.println(l + " solutions"); 508 System.out.println(l + " solutions");
509 } 509 }
510 -} 510 +} */
MODFIRE-Prototype/src/MainWithSpecific.java
@@ -14,77 +14,143 @@ public class MainWithSpecific { @@ -14,77 +14,143 @@ public class MainWithSpecific {
14 14
15 public static void giveDomains (Model model, IntVar[] ugs, String dir, IntVar[] crit0, IntVar[] crit1, 15 public static void giveDomains (Model model, IntVar[] ugs, String dir, IntVar[] crit0, IntVar[] crit1,
16 IntVar[] crit2, IntVar[] crit3, IntVar[] crit4, IntVar[] crit5, 16 IntVar[] crit2, IntVar[] crit3, IntVar[] crit4, IntVar[] crit5,
17 - IntVar[] crit6, IntVar[] crit7, IntVar[] crit8,IntVar[] crit9,IntVar[] crit10, UG[] nodes){ 17 + IntVar[] crit6, IntVar[] crit7, IntVar[] crit8,IntVar[] crit9,IntVar[] crit10, UG[] nodes, ArrayList<Boolean> flags){
18 int index = 0; 18 int index = 0;
19 try { 19 try {
20 File allUg = new File(dir + "/ugs_init.txt"); 20 File allUg = new File(dir + "/ugs_init.txt");
21 Scanner readerUg = new Scanner(allUg); 21 Scanner readerUg = new Scanner(allUg);
22 22
23 File critFile0 = new File(dir + "/crit_file0.txt"); 23 File critFile0 = new File(dir + "/crit_file0.txt");
24 - Scanner reader0 = new Scanner(critFile0); 24 + Scanner reader0 = null;
  25 + if(flags.get(0))
  26 + reader0 = new Scanner(critFile0);
25 27
26 File critFile1 = new File(dir + "/crit_file1.txt"); 28 File critFile1 = new File(dir + "/crit_file1.txt");
27 - Scanner reader1 = new Scanner(critFile1); 29 + Scanner reader1 = null;
  30 + if(flags.get(1))
  31 + reader1 = new Scanner(critFile1);
28 32
29 File critFile2 = new File(dir + "/crit_file2.txt"); 33 File critFile2 = new File(dir + "/crit_file2.txt");
30 - Scanner reader2 = new Scanner(critFile2); 34 + Scanner reader2 = null;
  35 + if(flags.get(2))
  36 + new Scanner(critFile2);
31 37
32 File critFile3 = new File(dir + "/crit_file3.txt"); 38 File critFile3 = new File(dir + "/crit_file3.txt");
33 - Scanner reader3 = new Scanner(critFile3); 39 + Scanner reader3 = null;
  40 + if(flags.get(3))
  41 + reader3 = new Scanner(critFile3);
34 42
35 File critFile4 = new File(dir + "/crit_file4.txt"); 43 File critFile4 = new File(dir + "/crit_file4.txt");
36 - Scanner reader4 = new Scanner(critFile4); 44 + Scanner reader4 = null;
  45 + if(flags.get(4))
  46 + reader4 = new Scanner(critFile4);
37 47
38 File critFile5 = new File(dir + "/crit_file5.txt"); 48 File critFile5 = new File(dir + "/crit_file5.txt");
39 - Scanner reader5 = new Scanner(critFile5); 49 + Scanner reader5 = null;
  50 + if(flags.get(5))
  51 + reader5 = new Scanner(critFile5);
40 52
41 File critFile6 = new File(dir + "/crit_file6.txt"); 53 File critFile6 = new File(dir + "/crit_file6.txt");
42 - Scanner reader6 = new Scanner(critFile6); 54 + Scanner reader6 = null;
  55 + if(flags.get(6))
  56 + reader6 = new Scanner(critFile6);
43 57
44 File critFile7 = new File(dir + "/crit_file7.txt"); 58 File critFile7 = new File(dir + "/crit_file7.txt");
45 - Scanner reader7 = new Scanner(critFile7); 59 + Scanner reader7 = null;
  60 + if(flags.get(7))
  61 + reader7 = new Scanner(critFile7);
46 62
47 File critFile8 = new File(dir + "/crit_file8.txt"); 63 File critFile8 = new File(dir + "/crit_file8.txt");
48 - Scanner reader8 = new Scanner(critFile8); 64 + Scanner reader8 = null;
  65 + if(flags.get(8))
  66 + reader8 = new Scanner(critFile8);
49 67
50 File critFile9 = new File(dir + "/crit_file9.txt"); 68 File critFile9 = new File(dir + "/crit_file9.txt");
51 - Scanner reader9 = new Scanner(critFile9); 69 + Scanner reader9 = null;
  70 + if(flags.get(9))
  71 + reader9 = new Scanner(critFile9);
52 72
53 File critFile10 = new File(dir + "/crit_file10.txt"); 73 File critFile10 = new File(dir + "/crit_file10.txt");
54 - Scanner reader10 = new Scanner(critFile10); 74 + Scanner reader10 = null;
  75 + if(flags.get(10))
  76 + reader10 = new Scanner(critFile10);
55 77
56 while (readerUg.hasNextLine()) { 78 while (readerUg.hasNextLine()) {
57 String dataUg = readerUg.nextLine(); 79 String dataUg = readerUg.nextLine();
58 80
59 - String data0 = reader0.nextLine();  
60 - String data1 = reader1.nextLine();  
61 - String data2 = reader2.nextLine();  
62 - String data3 = reader3.nextLine();  
63 - String data4 = reader4.nextLine();  
64 - String data5 = reader5.nextLine();  
65 - String data6 = reader6.nextLine();  
66 - String data7 = reader7.nextLine();  
67 - String data8 = reader8.nextLine();  
68 - String data9 = reader9.nextLine();  
69 - String data10 = reader10.nextLine(); 81 + String data0 = null;
  82 + if(flags.get(0))
  83 + data0 = reader0.nextLine();
  84 + String data1 = null;
  85 + if(flags.get(1))
  86 + data1 = reader1.nextLine();
  87 + String data2 = null;
  88 + if(flags.get(2))
  89 + data2 = reader2.nextLine();
  90 + String data3 = null;
  91 + if(flags.get(3))
  92 + data3 = reader3.nextLine();
  93 + String data4 = null;
  94 + if(flags.get(4))
  95 + data4 = reader4.nextLine();
  96 + String data5 = null;
  97 + if(flags.get(5))
  98 + data5 = reader5.nextLine();
  99 + String data6 = null;
  100 + if(flags.get(6))
  101 + data6 = reader6.nextLine();
  102 + String data7 = null;
  103 + if(flags.get(7))
  104 + data7 = reader7.nextLine();
  105 + String data8 = null;
  106 + if(flags.get(8))
  107 + data8 = reader8.nextLine();
  108 + String data9 = null;
  109 + if(flags.get(9))
  110 + data9 = reader9.nextLine();
  111 + String data10 = null;
  112 + if(flags.get(10))
  113 + data10 = reader10.nextLine();
70 114
71 115
72 116
73 117
74 - if(nodes[index].valid) { 118 + if(nodes[index].valid || nodes[index].noAdjacencies) {
75 String[] str_split = dataUg.split(",", 0); 119 String[] str_split = dataUg.split(",", 0);
76 120
77 - String[] str_split0 = data0.split(",", 0);  
78 - String[] str_split1 = data1.split(",", 0);  
79 - String[] str_split2 = data2.split(",", 0);  
80 - String[] str_split3 = data3.split(",", 0);  
81 - String[] str_split4 = data4.split(",", 0);  
82 - String[] str_split5 = data5.split(",", 0);  
83 - String[] str_split6 = data6.split(",", 0);  
84 - String[] str_split7 = data7.split(",", 0);  
85 - String[] str_split8 = data8.split(",", 0);  
86 - String[] str_split9 = data9.split(",", 0);  
87 - String[] str_split10 = data10.split(",", 0); 121 + String[] str_split0 = null;
  122 + if(flags.get(0))
  123 + str_split0 = data0.split(",", 0);
  124 + String[] str_split1 = null;
  125 + if(flags.get(1))
  126 + str_split1 = data1.split(",", 0);
  127 + String[] str_split2 = null;
  128 + if(flags.get(2))
  129 + str_split2 = data2.split(",", 0);
  130 + String[] str_split3 = null;
  131 + if(flags.get(3))
  132 + str_split3 = data3.split(",", 0);
  133 + String[] str_split4 = null;
  134 + if(flags.get(4))
  135 + str_split4 = data4.split(",", 0);
  136 + String[] str_split5 = null;
  137 + if(flags.get(5))
  138 + str_split5 = data5.split(",", 0);
  139 + String[] str_split6 = null;
  140 + if(flags.get(6))
  141 + str_split6 = data6.split(",", 0);
  142 + String[] str_split7 = null;
  143 + if(flags.get(7))
  144 + str_split7 = data7.split(",", 0);
  145 + String[] str_split8 = null;
  146 + if(flags.get(8))
  147 + str_split8 = data8.split(",", 0);
  148 + String[] str_split9 = null;
  149 + if(flags.get(9))
  150 + str_split9 = data9.split(",", 0);
  151 + String[] str_split10 = null;
  152 + if(flags.get(10))
  153 + str_split10 = data10.split(",", 0);
88 154
89 155
90 156
@@ -105,19 +171,38 @@ public class MainWithSpecific { @@ -105,19 +171,38 @@ public class MainWithSpecific {
105 171
106 for (int i = 0; i < size; i++) { 172 for (int i = 0; i < size; i++) {
107 toInsert[i] = Integer.parseInt(str_split[i]); 173 toInsert[i] = Integer.parseInt(str_split[i]);
108 - toInsert0[i] = (int) Float.parseFloat(str_split0[i]);  
109 - toInsert1[i] = (int) Float.parseFloat(str_split1[i]); 174 + if(flags.get(0)) toInsert0[i] = (int) Float.parseFloat(str_split0[i]);
  175 + else toInsert0[i] = 0;
  176 +
  177 + if(flags.get(1)) toInsert1[i] = (int) Float.parseFloat(str_split1[i]);
  178 + else toInsert1[i] = 0;
  179 +
  180 + if(flags.get(2)) toInsert2[i] = (int) Float.parseFloat(str_split2[i]);
  181 + else toInsert2[i] = 0;
  182 +
  183 + if(flags.get(3)) toInsert3[i] = (int) Float.parseFloat(str_split3[i]);
  184 + else toInsert3[i] = 0;
110 185
111 - toInsert2[i] = (int) Float.parseFloat(str_split2[i]);  
112 - toInsert3[i] = (int) Float.parseFloat(str_split3[i]);  
113 - toInsert4[i] = (int) Float.parseFloat(str_split4[i]);  
114 - toInsert5[i] = (int) Float.parseFloat(str_split5[i]);  
115 - toInsert6[i] = (int) Float.parseFloat(str_split6[i]);  
116 - toInsert7[i] = (int) Float.parseFloat(str_split7[i]);  
117 - toInsert8[i] = (int) Float.parseFloat(str_split8[i]);  
118 - toInsert9[i] = (int) Float.parseFloat(str_split9[i]);  
119 - toInsert10[i] = (int) Float.parseFloat(str_split10[i]); 186 + if(flags.get(4)) toInsert4[i] = (int) Float.parseFloat(str_split4[i]);
  187 + else toInsert4[i] = 0;
120 188
  189 + if(flags.get(5)) toInsert5[i] = (int) Float.parseFloat(str_split5[i]);
  190 + else toInsert5[i] = 0;
  191 +
  192 + if(flags.get(6)) toInsert6[i] = (int) Float.parseFloat(str_split6[i]);
  193 + else toInsert6[i] = 0;
  194 +
  195 + if(flags.get(7)) toInsert7[i] = (int) Float.parseFloat(str_split7[i]);
  196 + else toInsert7[i] = 0;
  197 +
  198 + if(flags.get(8)) toInsert8[i] = (int) Float.parseFloat(str_split8[i]);
  199 + else toInsert8[i] = 0;
  200 +
  201 + if(flags.get(9)) toInsert9[i] = (int) Float.parseFloat(str_split9[i]);
  202 + else toInsert9[i] = 0;
  203 +
  204 + if(flags.get(10)) toInsert10[i] = (int) Float.parseFloat(str_split10[i]);
  205 + else toInsert10[i] = 0;
121 206
122 } 207 }
123 208
@@ -161,17 +246,17 @@ public class MainWithSpecific { @@ -161,17 +246,17 @@ public class MainWithSpecific {
161 } 246 }
162 247
163 readerUg.close(); 248 readerUg.close();
164 - reader0.close();  
165 - reader1.close();  
166 - reader2.close();  
167 - reader3.close();  
168 - reader4.close();  
169 - reader5.close();  
170 - reader6.close();  
171 - reader7.close();  
172 - reader8.close();  
173 - reader9.close();  
174 - reader10.close(); 249 + if(flags.get(0)) reader0.close();
  250 + if(flags.get(1)) reader1.close();
  251 + if(flags.get(2)) reader2.close();
  252 + if(flags.get(3)) reader3.close();
  253 + if(flags.get(4)) reader4.close();
  254 + if(flags.get(5)) reader5.close();
  255 + if(flags.get(6)) reader6.close();
  256 + if(flags.get(7)) reader7.close();
  257 + if(flags.get(8)) reader8.close();
  258 + if(flags.get(9)) reader9.close();
  259 + if(flags.get(10)) reader10.close();
175 260
176 261
177 } catch (FileNotFoundException e) { 262 } catch (FileNotFoundException e) {
@@ -197,7 +282,6 @@ public class MainWithSpecific { @@ -197,7 +282,6 @@ public class MainWithSpecific {
197 282
198 String criterion = args[3]; 283 String criterion = args[3];
199 284
200 -  
201 /*Set Flags 285 /*Set Flags
202 0-woodYield 286 0-woodYield
203 1-Soil Loss 287 1-Soil Loss
@@ -227,6 +311,7 @@ public class MainWithSpecific { @@ -227,6 +311,7 @@ public class MainWithSpecific {
227 311
228 Model m = new Model("Forest Management"); 312 Model m = new Model("Forest Management");
229 313
  314 + System.out.println("Reading Input Files");
230 BufferedReader reader = new BufferedReader(new FileReader(fileDirectory + "/ugs_init.txt")); 315 BufferedReader reader = new BufferedReader(new FileReader(fileDirectory + "/ugs_init.txt"));
231 316
232 int nUgs = 0; 317 int nUgs = 0;
@@ -237,9 +322,9 @@ public class MainWithSpecific { @@ -237,9 +322,9 @@ public class MainWithSpecific {
237 //if 0 ignore 322 //if 0 ignore
238 int minBorder = Integer.parseInt(args[2]); 323 int minBorder = Integer.parseInt(args[2]);
239 if(minBorder <= 0) 324 if(minBorder <= 0)
240 - UG.fillArray(nodes, fileDirectory, 0); 325 + UG.fillArray(nodes, fileDirectory, 0, flags);
241 else 326 else
242 - UG.fillArray(nodes, fileDirectory, minBorder); 327 + UG.fillArray(nodes, fileDirectory, minBorder, flags);
243 328
244 for(int i = 0; i < nodes.length; i++){ 329 for(int i = 0; i < nodes.length; i++){
245 if(!islandUGs.contains(nodes[i].externalId)){ 330 if(!islandUGs.contains(nodes[i].externalId)){
@@ -266,10 +351,10 @@ public class MainWithSpecific { @@ -266,10 +351,10 @@ public class MainWithSpecific {
266 IntVar[] crit10 = new IntVar[nUgs]; 351 IntVar[] crit10 = new IntVar[nUgs];
267 352
268 giveDomains(m, ugs, fileDirectory, crit0, crit1, crit2, crit3, crit4, crit5, crit6, 353 giveDomains(m, ugs, fileDirectory, crit0, crit1, crit2, crit3, crit4, crit5, crit6,
269 - crit7, crit8, crit9, crit10, nodes); // reads the ugs_init file and initializes each variable with its possible prescription values as domain 354 + crit7, crit8, crit9, crit10, nodes, flags); // reads the ugs_init file and initializes each variable with its possible prescription values as domain
270 355
271 356
272 - System.out.println("running"); 357 + System.out.println("Setting up Constraints");
273 358
274 359
275 for(int ugIndex = 0; ugIndex < nodes.length; ugIndex++) { //loops through every UG 360 for(int ugIndex = 0; ugIndex < nodes.length; ugIndex++) { //loops through every UG
@@ -290,7 +375,7 @@ public class MainWithSpecific { @@ -290,7 +375,7 @@ public class MainWithSpecific {
290 375
291 376
292 for(int i = 0; i < nodes.length; i++){ 377 for(int i = 0; i < nodes.length; i++){
293 - if(nodes[i].valid) { 378 + if(nodes[i].valid || nodes[i].noAdjacencies) {
294 IntVar prescIndex = m.intVar(0, 255); 379 IntVar prescIndex = m.intVar(0, 255);
295 380
296 m.element(ugs[i], nodes[i].presc, prescIndex).post(); 381 m.element(ugs[i], nodes[i].presc, prescIndex).post();
@@ -379,7 +464,7 @@ public class MainWithSpecific { @@ -379,7 +464,7 @@ public class MainWithSpecific {
379 464
380 switch(singleFlag) { 465 switch(singleFlag) {
381 case 0: 466 case 0:
382 - m.setObjective(Model.MAXIMIZE, sum0); 467 + //m.setObjective(Model.MAXIMIZE, sum0);
383 break; 468 break;
384 case 1: 469 case 1:
385 m.setObjective(Model.MAXIMIZE, sum1); 470 m.setObjective(Model.MAXIMIZE, sum1);
@@ -416,21 +501,26 @@ public class MainWithSpecific { @@ -416,21 +501,26 @@ public class MainWithSpecific {
416 501
417 Solver s = m.getSolver(); 502 Solver s = m.getSolver();
418 503
419 - if (s.solve()) { 504 + System.out.println("Running Solver");
420 505
  506 + if (s.solve()) {
  507 + System.out.println("FOUND OPTIMAL SOLUTION!");
421 FileWriter outputPairs = new FileWriter("Results/outputPairsSingle.csv"); 508 FileWriter outputPairs = new FileWriter("Results/outputPairsSingle.csv");
422 509
423 for (int i = 0; i < ugs.length; i++) { 510 for (int i = 0; i < ugs.length; i++) {
424 - if (nodes[i].valid) { 511 + if (nodes[i].valid || nodes[i].noAdjacencies) {
425 pairCrits.write(ugs[i] + ", "); 512 pairCrits.write(ugs[i] + ", ");
426 513
427 for (int j = 0; j < flags.size(); j++) { 514 for (int j = 0; j < flags.size(); j++) {
428 - if (flags.get(j))  
429 - pairCrits.write(allTotals[j][i] +","); 515 + if (flags.get(j)) {
  516 + pairCrits.write(allTotals[j][i] + ",");
  517 + }
430 } 518 }
431 pairCrits.write("end\n"); 519 pairCrits.write("end\n");
432 520
433 outputPairs.write(nodes[i].externalId + "," + ugs[i].getValue() + "\n"); 521 outputPairs.write(nodes[i].externalId + "," + ugs[i].getValue() + "\n");
  522 + //System.out.print(nodes[i].externalId + "," + ugs[i].getValue() + "\n");
  523 +
434 } 524 }
435 } 525 }
436 outputPairs.close(); 526 outputPairs.close();
@@ -508,7 +598,7 @@ public class MainWithSpecific { @@ -508,7 +598,7 @@ public class MainWithSpecific {
508 allSolutionPairs.write("end\n"); 598 allSolutionPairs.write("end\n");
509 599
510 for(int i = 0; i < nodes.length; i++){ 600 for(int i = 0; i < nodes.length; i++){
511 - if(nodes[i].valid){ 601 + if(nodes[i].valid || nodes[i].noAdjacencies){
512 allSolutionPairs.write(nodes[i].externalId+","+ugs[i].getValue()+"\n"); 602 allSolutionPairs.write(nodes[i].externalId+","+ugs[i].getValue()+"\n");
513 } 603 }
514 } 604 }
@@ -568,7 +658,7 @@ public class MainWithSpecific { @@ -568,7 +658,7 @@ public class MainWithSpecific {
568 outputPairs.write("end\n"); 658 outputPairs.write("end\n");
569 659
570 for (int i = 0; i < ugs.length; i++) { 660 for (int i = 0; i < ugs.length; i++) {
571 - if (nodes[i].valid) { 661 + if (nodes[i].valid || nodes[i].noAdjacencies) {
572 662
573 pairCrits.write("UG_"+i+"="+so.getIntVal(ugs[i])+", "); 663 pairCrits.write("UG_"+i+"="+so.getIntVal(ugs[i])+", ");
574 664
MODFIRE-Prototype/src/UG.java
1 import java.io.File; 1 import java.io.File;
2 import java.io.FileNotFoundException; 2 import java.io.FileNotFoundException;
  3 +import java.util.ArrayList;
3 import java.util.Scanner; 4 import java.util.Scanner;
4 5
5 public class UG { 6 public class UG {
@@ -27,6 +28,7 @@ public class UG { @@ -27,6 +28,7 @@ public class UG {
27 int time; 28 int time;
28 boolean valid; 29 boolean valid;
29 boolean treated; 30 boolean treated;
  31 + boolean noAdjacencies = false;
30 32
31 static public int[] returnInsertable(Scanner myReader){ 33 static public int[] returnInsertable(Scanner myReader){
32 String data = myReader.nextLine(); 34 String data = myReader.nextLine();
@@ -50,6 +52,14 @@ public class UG { @@ -50,6 +52,14 @@ public class UG {
50 return toInsert; 52 return toInsert;
51 } 53 }
52 54
  55 + static public int[] returnZeroes(int size){
  56 + int[] toInsert = new int[size];
  57 + for(int i=0; i<size; i++) {
  58 + toInsert[i] = 0;
  59 + }
  60 + return toInsert;
  61 + }
  62 +
53 63
54 static public int[] adjacencyReader(Scanner adjacencies, Scanner borders, int minBorder){ 64 static public int[] adjacencyReader(Scanner adjacencies, Scanner borders, int minBorder){
55 String dataAdj = adjacencies.nextLine(); 65 String dataAdj = adjacencies.nextLine();
@@ -85,15 +95,14 @@ public class UG { @@ -85,15 +95,14 @@ public class UG {
85 return toInsert; 95 return toInsert;
86 } 96 }
87 97
88 - static public void fillArray(UG[] array, String dir, int minBorder) { 98 + static public void fillArray(UG[] array, String dir, int minBorder, ArrayList<Boolean> flags) {
89 int index = 0; 99 int index = 0;
90 100
91 - try { // idea: pass a directory, which should contain files called  
92 - // graph_init, ugs_init, ...  
93 - File adj_init = new File(dir + "/adj_init.txt"); 101 + try {
  102 + File adj_init = new File(dir + "/adj_init.txt"); //Adjacency input file
94 Scanner readerAdj = new Scanner(adj_init); 103 Scanner readerAdj = new Scanner(adj_init);
95 104
96 - File borders_init = new File(dir + "/border_init.txt"); 105 + File borders_init = new File(dir + "/border_init.txt"); //Borders input file
97 Scanner readerBorders = new Scanner(borders_init); 106 Scanner readerBorders = new Scanner(borders_init);
98 107
99 File ext_init = new File(dir + "/external_init.txt"); 108 File ext_init = new File(dir + "/external_init.txt");
@@ -110,38 +119,49 @@ public class UG { @@ -110,38 +119,49 @@ public class UG {
110 Scanner readerArea = new Scanner(area_init); 119 Scanner readerArea = new Scanner(area_init);
111 120
112 File critFile0 = new File(dir + "/crit_file0.txt"); 121 File critFile0 = new File(dir + "/crit_file0.txt");
113 - Scanner reader0 = new Scanner(critFile0); 122 + Scanner reader0 = null;
  123 + if(flags.get(0)) reader0 = new Scanner(critFile0);
114 124
115 File critFile1 = new File(dir + "/crit_file1.txt"); 125 File critFile1 = new File(dir + "/crit_file1.txt");
116 - Scanner reader1 = new Scanner(critFile1); 126 + Scanner reader1 = null;
  127 + if(flags.get(1)) reader1 = new Scanner(critFile1);
117 128
118 File critFile2 = new File(dir + "/crit_file2.txt"); 129 File critFile2 = new File(dir + "/crit_file2.txt");
119 - Scanner reader2 = new Scanner(critFile2); 130 + Scanner reader2 = null;
  131 + if(flags.get(2)) reader2 = new Scanner(critFile2);
120 132
121 133
122 File critFile3 = new File(dir + "/crit_file3.txt"); 134 File critFile3 = new File(dir + "/crit_file3.txt");
123 - Scanner reader3 = new Scanner(critFile3); 135 + Scanner reader3 = null;
  136 + if(flags.get(3)) reader3 = new Scanner(critFile3);
124 137
125 File critFile4 = new File(dir + "/crit_file4.txt"); 138 File critFile4 = new File(dir + "/crit_file4.txt");
126 - Scanner reader4 = new Scanner(critFile4); 139 + Scanner reader4 = null;
  140 + if(flags.get(4)) reader4 = new Scanner(critFile4);
127 141
128 File critFile5 = new File(dir + "/crit_file5.txt"); 142 File critFile5 = new File(dir + "/crit_file5.txt");
129 - Scanner reader5 = new Scanner(critFile5); 143 + Scanner reader5 = null;
  144 + if(flags.get(5)) reader5 = new Scanner(critFile5);
130 145
131 File critFile6 = new File(dir + "/crit_file6.txt"); 146 File critFile6 = new File(dir + "/crit_file6.txt");
132 - Scanner reader6 = new Scanner(critFile6); 147 + Scanner reader6 = null;
  148 + if(flags.get(6)) reader6 = new Scanner(critFile6);
133 149
134 File critFile7 = new File(dir + "/crit_file7.txt"); 150 File critFile7 = new File(dir + "/crit_file7.txt");
135 - Scanner reader7 = new Scanner(critFile7); 151 + Scanner reader7 = null;
  152 + if(flags.get(7)) reader7 = new Scanner(critFile7);
136 153
137 File critFile8 = new File(dir + "/crit_file8.txt"); 154 File critFile8 = new File(dir + "/crit_file8.txt");
138 - Scanner reader8 = new Scanner(critFile8); 155 + Scanner reader8 = null;
  156 + if(flags.get(8)) reader8 = new Scanner(critFile8);
139 157
140 File critFile9 = new File(dir + "/crit_file9.txt"); 158 File critFile9 = new File(dir + "/crit_file9.txt");
141 - Scanner reader9 = new Scanner(critFile9); 159 + Scanner reader9 = null;
  160 + if(flags.get(9)) reader9 = new Scanner(critFile9);
142 161
143 File critFile10 = new File(dir + "/crit_file10.txt"); 162 File critFile10 = new File(dir + "/crit_file10.txt");
144 - Scanner reader10 = new Scanner(critFile10); 163 + Scanner reader10 = null;
  164 + if(flags.get(10)) reader10 = new Scanner(critFile10);
145 165
146 while (readerAdj.hasNextLine()) { 166 while (readerAdj.hasNextLine()) {
147 UG toInsert = new UG(); 167 UG toInsert = new UG();
@@ -165,28 +185,44 @@ public class UG { @@ -165,28 +185,44 @@ public class UG {
165 toInsert.years[i] = returnPeriods(str_split[i]); 185 toInsert.years[i] = returnPeriods(str_split[i]);
166 } 186 }
167 187
168 - toInsert.crit0 = returnInsertable2(reader0);  
169 - toInsert.crit1 = returnInsertable2(reader1);  
170 - toInsert.crit2 = returnInsertable2(reader2); 188 + int[] zeroArray = returnZeroes(toInsert.presc.length);
  189 +
  190 + if(flags.get(0)) toInsert.crit0 = returnInsertable2(reader0);
  191 + else toInsert.crit0 = zeroArray;
  192 +
  193 + if(flags.get(1)) toInsert.crit1 = returnInsertable2(reader1);
  194 + else toInsert.crit1 = zeroArray;
171 195
172 - toInsert.crit3 = returnInsertable2(reader3); 196 + if(flags.get(2)) toInsert.crit2 = returnInsertable2(reader2);
  197 + else toInsert.crit2 = zeroArray;
173 198
174 - toInsert.crit4 = returnInsertable2(reader4); 199 + if(flags.get(3)) toInsert.crit3 = returnInsertable2(reader3);
  200 + else toInsert.crit3 = zeroArray;
175 201
176 - toInsert.crit5 = returnInsertable2(reader5); 202 + if(flags.get(4)) toInsert.crit4 = returnInsertable2(reader4);
  203 + else toInsert.crit4 = zeroArray;
177 204
178 - toInsert.crit6 = returnInsertable2(reader6); 205 + if(flags.get(5)) toInsert.crit5 = returnInsertable2(reader5);
  206 + else toInsert.crit5 = zeroArray;
179 207
180 - toInsert.crit7 = returnInsertable2(reader7); 208 + if(flags.get(6)) toInsert.crit6 = returnInsertable2(reader6);
  209 + else toInsert.crit6 = zeroArray;
181 210
182 - toInsert.crit8 = returnInsertable2(reader8); 211 + if(flags.get(7)) toInsert.crit7 = returnInsertable2(reader7);
  212 + else toInsert.crit7 = zeroArray;
183 213
184 - toInsert.crit9 = returnInsertable2(reader9); 214 + if(flags.get(8)) toInsert.crit8 = returnInsertable2(reader8);
  215 + else toInsert.crit8 = zeroArray;
185 216
186 - toInsert.crit10 = returnInsertable2(reader10); 217 + if(flags.get(9)) toInsert.crit9 = returnInsertable2(reader9);
  218 + else toInsert.crit9 = zeroArray;
  219 +
  220 + if(flags.get(10)) toInsert.crit10 = returnInsertable2(reader10);
  221 + else toInsert.crit10 = zeroArray;
187 222
188 if(toInsert.adj[0] == -1){ 223 if(toInsert.adj[0] == -1){
189 toInsert.valid = false; 224 toInsert.valid = false;
  225 + toInsert.noAdjacencies = true; //If unit has no adjacencies it's still used but not in the main loop
190 } 226 }
191 227
192 array[index] = toInsert; 228 array[index] = toInsert;
@@ -202,18 +238,17 @@ public class UG { @@ -202,18 +238,17 @@ public class UG {
202 readerArea.close(); 238 readerArea.close();
203 readerYears.close(); 239 readerYears.close();
204 240
205 -  
206 - reader0.close();  
207 - reader1.close();  
208 - reader2.close();  
209 - reader3.close();  
210 - reader4.close();  
211 - reader5.close();  
212 - reader6.close();  
213 - reader7.close();  
214 - reader8.close();  
215 - reader9.close();  
216 - reader10.close(); 241 + if(flags.get(0)) reader0.close();
  242 + if(flags.get(1)) reader1.close();
  243 + if(flags.get(2)) reader2.close();
  244 + if(flags.get(3)) reader3.close();
  245 + if(flags.get(4)) reader4.close();
  246 + if(flags.get(5)) reader5.close();
  247 + if(flags.get(6)) reader6.close();
  248 + if(flags.get(7)) reader7.close();
  249 + if(flags.get(8)) reader8.close();
  250 + if(flags.get(9)) reader9.close();
  251 + if(flags.get(10)) reader10.close();
217 252
218 253
219 254