diff --git a/gbac.py b/gbac.py new file mode 100755 index 0000000..e0fc6c9 --- /dev/null +++ b/gbac.py @@ -0,0 +1,168 @@ +#!/usr/bin/env python3 +import os +import sys +import time +import csv + +MZNR_HOME = os.getcwd() + "/software/install/minizinc/bin" +os.environ["PATH"] = MZNR_HOME + ":" + os.environ["PATH"] +os.environ["MZN_SOLVER_PATH"] = ( + os.getcwd() + "/software/install/gecode/share/minizinc/solvers" +) +import minizinc + +MZA_HOME = os.getcwd() + "/software/mza" +sys.path.append(MZA_HOME) + +mza_lib = os.getcwd() + "/software/install/mza/lib" +if sys.platform == "linux" or sys.platform == "linux2": + rerun = True + if not "LD_LIBRARY_PATH" in os.environ: + os.environ["LD_LIBRARY_PATH"] = mza_lib + elif not mza_lib in os.environ.get("LD_LIBRARY_PATH"): + os.environ["LD_LIBRARY_PATH"] += ":" + mza_lib + else: + rerun = False + if rerun: + os.execve(os.path.realpath(__file__), sys.argv, os.environ) + +import mza +from mza import Instance + +mza.DEBUG = False + +SOLVER = "gecode_presolver" +PROTO_MODEL = "gbac/proto.uzn" +RESTART_MODEL = "gbac/on_restart.mzn" +DATA = [ + "gbac/reduced_UD4-gbac.dzn", + "gbac/UD2-gbac.dzn", + "gbac/UD4-gbac.dzn", + "gbac/UD5-gbac.dzn", + "gbac/UD8-gbac.dzn", +] +FN_ID = "f_lex_obj_i" +N_NBH = 2 +ROUNDS = 1000 +RUNS = 1 + + +def gbac_restart(data_file): + os.environ["MZN_STDLIB_DIR"] = ( + os.getcwd() + "/software/install/minizinc/share/minizinc" + ) + gecode = minizinc.Solver.lookup("gecode") + inst = minizinc.Instance(gecode, minizinc.Model(RESTART_MODEL)) + inst.add_file(data_file) + + args = { + "--restart": "constant", + "--restart-scale": 500, + "--restart-limit": ROUNDS, + } + res = inst.solve(**args) + + return ( + res.statistics["flatTime"].total_seconds(), + (res.statistics["initTime"] + res.statistics["solveTime"]).total_seconds(), + ) + + +def gbac_incr(data_file): + os.environ["MZN_STDLIB_DIR"] = os.getcwd() + "/software/mza/share/minizinc" + compile_time = 0.0 + solve_time = 0.0 + + incumbent = None + start = time.perf_counter() + mza.set_rnd_seed(0) + inst = Instance(PROTO_MODEL, data_file, "gecode_presolver") + compile_time += time.perf_counter() - start + + start = time.perf_counter() + status, sol = inst.solve() + solve_time += time.perf_counter() - start + # print(f"{status}: {sol}") + assert status in ["SAT", "OPT"] + incumbent = sol + for i in range(1, ROUNDS): + mza.set_rnd_seed(i) + inst.set_limit(500) + with inst.branch() as child: + start = time.perf_counter() + child.add_call("f_LNS_i", i % 2) + compile_time += time.perf_counter() - start + + start = time.perf_counter() + status, sol = child.solve() + solve_time += time.perf_counter() - start + # print(f"{status}: {sol}") + if status == "SAT" or status == "OPT": + incumbent = sol + assert status != "ERROR" + return compile_time, solve_time + + +def gbac_redo(data_file): + os.environ["MZN_STDLIB_DIR"] = os.getcwd() + "/software/mza/share/minizinc" + compile_time = 0.0 + solve_time = 0.0 + + incumbent = None + for i in range(ROUNDS): + start = time.perf_counter() + mza.set_rnd_seed(i) + inst = Instance(PROTO_MODEL, data_file, "gecode_presolver") + inst.output_dict(True) + limit = 0 + if i > 0: + inst.set_limit(500) + assert incumbent is not None + limit = 500 + inst.set_incumbent(incumbent) + inst.add_call("f_LNS_i", i % 2) + compile_time += time.perf_counter() - start + + start = time.perf_counter() + status, sol = inst.solve() + solve_time += time.perf_counter() - start + # print( + # f"{i} {status}: [{ ', '.join([str(v) for k, v in sol.items()]) if isinstance(sol, dict) else sol}]" + # ) + if status == "SAT" or status == "OPT": + incumbent = sol + elif status == "ERROR": + print("ERROR!!!!") + exit(0) + return compile_time, solve_time + + +if __name__ == "__main__": + fieldnames = ["Configuration", "Data", "Compile Time (s)", "Solve Time (s)"] + writer = csv.writer(sys.stdout) + writer.writerow(fieldnames) + + # --- Run Restart based strategy + for d in DATA: + t1, t2 = 0, 0 + for i in range(RUNS): + ct, st = gbac_restart(d) + t1 += ct + t2 += st + writer.writerow(["RBS", d, t1 / RUNS, t2 / RUNS]) + # --- Run incremental rewriting + for d in DATA: + t1, t2 = 0, 0 + for i in range(RUNS): + ct, st = gbac_incr(d) + t1 += ct + t2 += st + writer.writerow(["Incr.", d, t1 / RUNS, t2 / RUNS]) + # --- Run baseline + for d in DATA: + t1, t2 = 0, 0 + for i in range(RUNS): + ct, st = gbac_redo(d) + t1 += ct * 10 + t2 += st * 10 + writer.writerow(["Base", d, t1 / RUNS, t2 / RUNS]) diff --git a/gbac/UD2-gbac.dzn b/gbac/UD2-gbac.dzn index 8ecf908..fa8a355 100644 --- a/gbac/UD2-gbac.dzn +++ b/gbac/UD2-gbac.dzn @@ -15,6 +15,6 @@ w1 = 1; w2 = 1; course_load = [6, 6, 6, 6, 6, 5, 5, 6, 6, 6, 6, 16, 5, 6, 6, 6, 5, 5, 5, 6, 5, 5, 6, 5, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 7, 7, 5, 5, 7, 7, 7, 5, 5, 5, 6, 6, 6, 5, 7, 7, 5, 5, 7, 7, 6, 6, 7, 5, 5, 15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 7, 5, 7, 7, 5, 5, 5, 7, 7, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 5, 6, 5, 5, 5, 6, 6, 5, 15, 17, 5, 5, 7, 7, 5, 6, 5, 6, 5, 5, 6, 6, 16, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 5, 6, 5, 5, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 10, 5, 5, 5, 6, 5, 5, 6, 6, 2, 1, 1, 1, 1, 3, 3, 3, 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 5, 5, 6, 16, 6, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 3, 15, 6, 6, 6, 6, 6, 6, 6, 6, 5, 6, 5, 6, 5, 5, 5, 5, 5, 6, 5, 5, 6, 5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5, 5, 5, 5, 6, 5] ; courses_of = [{267, 268, 35, 39, 40, 45, 46, 47, 48, 49, 53, 189, 61, 62, 67, 103, 104, 105, 107, 108, 110, 115, 123}, {267, 268, 35, 38, 39, 40, 45, 46, 47, 48, 49, 53, 58, 62, 64, 67, 103, 104, 105, 107, 108, 109, 115}, {268, 16, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 47, 48, 190, 191, 79, 98, 99, 103, 106, 115, 117}, {136, 268, 35, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48, 190, 191, 100, 101, 102, 103, 115, 117}, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 147, 19, 22, 23, 24, 25, 31, 160, 186, 213, 215, 238, 111, 112, 239, 240, 241}, {2, 7, 8, 9, 10, 11, 13, 14, 16, 17, 147, 19, 20, 21, 23, 24, 25, 26, 27, 28, 29, 30, 32, 33, 34, 160, 186, 187, 214, 216, 238, 111, 239, 240, 241, 116}, {41, 49, 50, 51, 52, 53, 54, 55, 56, 185, 57, 58, 59, 60, 184, 201, 210, 113, 120, 121, 122, 123, 124}, {49, 50, 52, 53, 54, 55, 56, 185, 57, 184, 60, 61, 62, 63, 64, 201, 202, 209, 210, 211, 108, 113, 121, 122, 123}, {41, 49, 50, 51, 53, 54, 55, 56, 185, 57, 184, 60, 65, 66, 67, 68, 69, 202, 210, 82, 113, 121, 123}, {188, 192, 193, 194, 195, 196, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 96, 97, 114, 118, 119}, {16, 17, 192, 193, 194, 195, 196, 70, 71, 72, 73, 74, 203, 78, 79, 80, 83, 85, 86, 87, 88, 89, 96, 97, 114, 118, 119}, {188, 192, 193, 194, 195, 196, 70, 71, 72, 73, 74, 77, 78, 79, 80, 90, 91, 92, 93, 94, 95, 96, 97, 114, 118, 119}, {128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 267, 139, 140, 141, 142, 155, 156, 158, 159, 197, 198, 199, 200, 85, 89, 243, 244, 249, 250, 251, 252}, {128, 2, 267, 140, 142, 143, 144, 145, 146, 147, 14, 148, 149, 150, 151, 153, 152, 154, 155, 27, 157, 159, 160, 242, 243, 244, 245, 246, 247, 248, 125, 127}, {128, 2, 131, 258, 5, 267, 140, 142, 143, 144, 14, 148, 149, 151, 152, 153, 154, 27, 155, 157, 159, 160, 33, 242, 243, 244, 245, 246, 247, 248, 125, 126}, {259, 260, 261, 262, 263, 264, 265, 266, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 177, 182, 183, 205, 207, 212, 253, 254, 255}, {259, 260, 261, 262, 263, 264, 265, 266, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 175, 176, 182, 183, 205, 207, 212, 253, 254, 255}, {259, 260, 261, 262, 263, 264, 265, 266, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 178, 179, 183, 204, 205, 206, 207, 212, 253, 254, 255}, {259, 260, 261, 262, 263, 264, 265, 266, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 175, 180, 181, 183, 204, 207, 208, 212, 253, 254, 255}, {256, 257, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237}] ; -precedes = array2d(precedences,1..2, [213, 15, 7, 33, 7, 215, 7, 216, 10, 11, 16, 17, 20, 33, 20, 215, 20, 216, 24, 33, 24, 215, 24, 216, 25, 33, 25, 215, 25, 216, 26, 33, 26, 215, 26, 216, 28, 33, 28, 215, 28, 216, 31, 147, 35, 48, 35, 64, 36, 48, 36, 64, 16, 48, 16, 64, 43, 48, 43, 64, 49, 58, 49, 59, 49, 64, 49, 65, 49, 122, 49, 41, 50, 58, 50, 59, 50, 64, 50, 65, 50, 122, 50, 41, 51, 58, 51, 59, 51, 64, 51, 65, 51, 122, 51, 41, 52, 58, 52, 59, 52, 64, 52, 108, 52, 65, 52, 122, 52, 41, 53, 58, 61, 58, 61, 59, 61, 63, 61, 64, 61, 65, 61, 122, 61, 41, 66, 69, 97, 70, 104, 105, 104, 191, 107, 48, 107, 64, 108, 48, 108, 64, 49, 48, 109, 48, 109, 64, 117, 48, 117, 108, 117, 64, 121, 59, 125, 5, 127, 150, 129, 125, 129, 85, 129, 142, 129, 5, 129, 154, 131, 126, 134, 133, 135, 125, 135, 85, 135, 142, 135, 5, 135, 154, 143, 144, 147, 125, 147, 85, 147, 142, 147, 5, 147, 154, 160, 125, 160, 85, 160, 142, 160, 2, 160, 5, 160, 154, 14, 125, 14, 85, 14, 142, 14, 5, 14, 154, 148, 125, 148, 85, 148, 142, 148, 5, 148, 154, 149, 152, 151, 153, 154, 258, 155, 125, 155, 85, 155, 142, 155, 5, 155, 154, 160, 33, 160, 215, 160, 216, 166, 212, 184, 185, 190, 105, 190, 191, 197, 125, 197, 85, 197, 142, 197, 5, 197, 154, 199, 125, 199, 85, 199, 142, 199, 5, 199, 154, 213, 33, 213, 215, 213, 216, 222, 227, 222, 229, 222, 236, 223, 227, 223, 229, 223, 236, 225, 227, 225, 229, 225, 236, 239, 24, 242, 125, 242, 85, 242, 142, 242, 5, 242, 154, 246, 125, 246, 85, 246, 142, 246, 5, 246, 154, 249, 125, 249, 85, 249, 142, 249, 5, 249, 154, 252, 125, 252, 85, 252, 142, 252, 5, 252, 154, 268, 48, 268, 64] ); -undesirable = array2d(undesirables,1..2, [226, 2, 226, 5, 210, 3, 210, 6, 245, 1, 245, 4, 90, 3, 90, 6, 75, 2, 75, 5, 128, 2, 128, 5, 98, 2, 98, 5, 256, 3, 256, 6, 171, 3, 171, 6, 38, 2, 38, 5, 5, 1, 5, 4, 37, 3, 37, 6, 42, 2, 42, 5, 35, 1, 35, 4, 268, 1, 268, 4, 138, 3, 138, 6, 165, 1, 165, 4, 171, 2, 171, 5, 133, 3, 133, 6, 79, 3, 79, 6, 142, 3, 142, 6, 108, 3, 108, 6, 76, 2, 76, 5, 217, 3, 217, 6, 19, 3, 19, 6, 141, 1, 141, 4, 52, 2, 52, 5, 239, 2, 239, 5, 18, 1, 18, 4, 123, 1, 123, 4, 64, 3, 64, 6, 242, 3, 242, 6, 72, 2, 72, 5, 101, 3, 101, 6, 143, 1, 143, 4, 118, 3, 118, 6, 250, 3, 250, 6, 77, 3, 77, 6, 172, 2, 172, 5, 185, 1, 185, 4, 223, 1, 223, 4, 62, 3, 62, 6, 94, 3, 94, 6, 257, 2, 257, 5, 177, 3, 177, 6, 107, 3, 107, 6, 184, 3, 184, 6, 130, 1, 130, 4, 255, 3, 255, 6, 40, 3, 40, 6, 167, 1, 167, 4, 211, 1, 211, 4, 120, 1, 120, 4, 51, 1, 51, 4, 150, 2, 150, 5, 46, 3, 46, 6, 28, 1, 28, 4, 264, 3, 264, 6, 184, 2, 184, 5, 201, 2, 201, 5, 79, 1, 79, 4, 157, 1, 157, 4, 41, 3, 41, 6, 34, 3, 34, 6, 44, 3, 44, 6, 20, 3, 20, 6, 15, 2, 15, 5, 48, 1, 48, 4, 214, 3, 214, 6, 176, 3, 176, 6, 172, 3, 172, 6, 26, 1, 26, 4, 140, 1, 140, 4, 19, 1, 19, 4, 124, 3, 124, 6, 154, 3, 154, 6, 14, 1, 14, 4, 239, 1, 239, 4, 234, 1, 234, 4] ); +precedes = array2d(1..n_precedences,1..2, [213, 15, 7, 33, 7, 215, 7, 216, 10, 11, 16, 17, 20, 33, 20, 215, 20, 216, 24, 33, 24, 215, 24, 216, 25, 33, 25, 215, 25, 216, 26, 33, 26, 215, 26, 216, 28, 33, 28, 215, 28, 216, 31, 147, 35, 48, 35, 64, 36, 48, 36, 64, 16, 48, 16, 64, 43, 48, 43, 64, 49, 58, 49, 59, 49, 64, 49, 65, 49, 122, 49, 41, 50, 58, 50, 59, 50, 64, 50, 65, 50, 122, 50, 41, 51, 58, 51, 59, 51, 64, 51, 65, 51, 122, 51, 41, 52, 58, 52, 59, 52, 64, 52, 108, 52, 65, 52, 122, 52, 41, 53, 58, 61, 58, 61, 59, 61, 63, 61, 64, 61, 65, 61, 122, 61, 41, 66, 69, 97, 70, 104, 105, 104, 191, 107, 48, 107, 64, 108, 48, 108, 64, 49, 48, 109, 48, 109, 64, 117, 48, 117, 108, 117, 64, 121, 59, 125, 5, 127, 150, 129, 125, 129, 85, 129, 142, 129, 5, 129, 154, 131, 126, 134, 133, 135, 125, 135, 85, 135, 142, 135, 5, 135, 154, 143, 144, 147, 125, 147, 85, 147, 142, 147, 5, 147, 154, 160, 125, 160, 85, 160, 142, 160, 2, 160, 5, 160, 154, 14, 125, 14, 85, 14, 142, 14, 5, 14, 154, 148, 125, 148, 85, 148, 142, 148, 5, 148, 154, 149, 152, 151, 153, 154, 258, 155, 125, 155, 85, 155, 142, 155, 5, 155, 154, 160, 33, 160, 215, 160, 216, 166, 212, 184, 185, 190, 105, 190, 191, 197, 125, 197, 85, 197, 142, 197, 5, 197, 154, 199, 125, 199, 85, 199, 142, 199, 5, 199, 154, 213, 33, 213, 215, 213, 216, 222, 227, 222, 229, 222, 236, 223, 227, 223, 229, 223, 236, 225, 227, 225, 229, 225, 236, 239, 24, 242, 125, 242, 85, 242, 142, 242, 5, 242, 154, 246, 125, 246, 85, 246, 142, 246, 5, 246, 154, 249, 125, 249, 85, 249, 142, 249, 5, 249, 154, 252, 125, 252, 85, 252, 142, 252, 5, 252, 154, 268, 48, 268, 64] ); +undesirable = array2d(1..n_undesirables,1..2, [226, 2, 226, 5, 210, 3, 210, 6, 245, 1, 245, 4, 90, 3, 90, 6, 75, 2, 75, 5, 128, 2, 128, 5, 98, 2, 98, 5, 256, 3, 256, 6, 171, 3, 171, 6, 38, 2, 38, 5, 5, 1, 5, 4, 37, 3, 37, 6, 42, 2, 42, 5, 35, 1, 35, 4, 268, 1, 268, 4, 138, 3, 138, 6, 165, 1, 165, 4, 171, 2, 171, 5, 133, 3, 133, 6, 79, 3, 79, 6, 142, 3, 142, 6, 108, 3, 108, 6, 76, 2, 76, 5, 217, 3, 217, 6, 19, 3, 19, 6, 141, 1, 141, 4, 52, 2, 52, 5, 239, 2, 239, 5, 18, 1, 18, 4, 123, 1, 123, 4, 64, 3, 64, 6, 242, 3, 242, 6, 72, 2, 72, 5, 101, 3, 101, 6, 143, 1, 143, 4, 118, 3, 118, 6, 250, 3, 250, 6, 77, 3, 77, 6, 172, 2, 172, 5, 185, 1, 185, 4, 223, 1, 223, 4, 62, 3, 62, 6, 94, 3, 94, 6, 257, 2, 257, 5, 177, 3, 177, 6, 107, 3, 107, 6, 184, 3, 184, 6, 130, 1, 130, 4, 255, 3, 255, 6, 40, 3, 40, 6, 167, 1, 167, 4, 211, 1, 211, 4, 120, 1, 120, 4, 51, 1, 51, 4, 150, 2, 150, 5, 46, 3, 46, 6, 28, 1, 28, 4, 264, 3, 264, 6, 184, 2, 184, 5, 201, 2, 201, 5, 79, 1, 79, 4, 157, 1, 157, 4, 41, 3, 41, 6, 34, 3, 34, 6, 44, 3, 44, 6, 20, 3, 20, 6, 15, 2, 15, 5, 48, 1, 48, 4, 214, 3, 214, 6, 176, 3, 176, 6, 172, 3, 172, 6, 26, 1, 26, 4, 140, 1, 140, 4, 19, 1, 19, 4, 124, 3, 124, 6, 154, 3, 154, 6, 14, 1, 14, 4, 239, 1, 239, 4, 234, 1, 234, 4] ); % {'c1079': 214, 'c412': 3, 'c1101': 223, 'c816': 147, 'c478': 53, 'c537': 93, 'c1146': 256, 'c676': 113, 'c489': 58, 'c527': 85, 'c420': 8, 'c526': 84, 'c446': 32, 'c431': 18, 'c922': 185, 'c1178': 265, 'c415': 4, 'c856': 173, 'c514': 75, 'c821': 149, 'c495': 61, 'c831': 156, 'c476': 51, 'c498': 64, 'c513': 74, 'c833': 157, 'c839': 161, 'c428': 15, 'c479': 54, 'c504': 68, 'c1072': 212, 'c1003': 194, 'c1105': 227, 'c455': 39, 'c828': 154, 'c865': 178, 'c532': 88, 'c1131': 245, 'c533': 89, 'c1137': 251, 'c1106': 228, 'c803': 136, 'c1065': 207, 'c1123': 238, 'c546': 100, 'c1179': 266, 'c519': 78, 'c474': 49, 'c718': 116, 'c598': 106, 'c1004': 195, 'c606': 109, 'c501': 65, 'c539': 95, 'c647': 111, 'c536': 92, 'c1062': 204, 'c812': 143, 'c848': 168, 'c1135': 249, 'c862': 177, 'c491': 59, 'c835': 159, 'c1096': 218, 'c798': 134, 'c1134': 248, 'c860': 175, 'c814': 145, 'c440': 26, 'c447': 33, 'c1185': 268, 'c871': 182, 'c419': 7, 'c1067': 209, 'c1097': 219, 'c806': 138, 'c1021': 197, 'c435': 21, 'c872': 183, 'c1127': 242, 'c1120': 236, 'c724': 118, 'c737': 121, 'c1063': 205, 'c502': 66, 'c1081': 215, 'c452': 36, 'c841': 163, 'c861': 176, 'c520': 79, 'c425': 12, 'c566': 105, 'c840': 162, 'c460': 43, 'c830': 155, 'c437': 23, 'c1132': 246, 'c1005': 196, 'c815': 146, 'c800': 135, 'c453': 37, 'c523': 81, 'c444': 30, 'c747': 124, 'c515': 76, 'c1122': 237, 'c852': 171, 'c738': 122, 'c510': 71, 'c1053': 201, 'c1099': 221, 'c426': 13, 'c795': 131, 'c721': 117, 'c409': 1, 'c487': 57, 'c1107': 229, 'c788': 125, 'c670': 112, 'c813': 144, 'c1102': 224, 'c599': 107, 'c461': 44, 'c1126': 241, 'c857': 174, 'c1125': 240, 'c869': 181, 'c450': 35, 'c429': 16, 'c1055': 202, 'c1147': 257, 'c506': 69, 'c1110': 231, 'c464': 47, 'c477': 52, 'c462': 45, 'c423': 11, 'c540': 96, 'c496': 62, 'c1142': 255, 'c1095': 217, 'c730': 120, 'c1047': 200, 'c422': 10, 'c1103': 225, 'c427': 14, 'c436': 22, 'c1071': 211, 'c1068': 210, 'c791': 128, 'c507': 70, 'c416': 5, 'c600': 108, 'c561': 103, 'c1001': 192, 'c449': 34, 'c1174': 261, 'c441': 27, 'c866': 179, 'c725': 119, 'c845': 165, 'c538': 94, 'c1184': 267, 'c1111': 232, 'c521': 80, 'c1064': 206, 'c853': 172, 'c432': 19, 'c933': 187, 'c524': 82, 'c454': 38, 'c475': 50, 'c810': 141, 'c849': 169, 'c1119': 235, 'c445': 31, 'c793': 129, 'c745': 123, 'c1066': 208, 'c1002': 193, 'c551': 101, 'c1138': 252, 'c834': 158, 'c804': 137, 'c531': 87, 'c921': 184, 'c534': 90, 'c1166': 259, 'c1140': 253, 'c1124': 239, 'c457': 41, 'c794': 130, 'c456': 40, 'c789': 126, 'c807': 139, 'c417': 6, 'c790': 127, 'c535': 91, 'c820': 148, 'c811': 142, 'c486': 56, 'c433': 20, 'c439': 25, 'c836': 160, 'c1057': 203, 'c868': 180, 'c421': 9, 'c997': 191, 'c1074': 213, 'c1104': 226, 'c544': 99, 'c541': 97, 'c463': 46, 'c1136': 250, 'c824': 152, 'c511': 72, 'c826': 153, 'c1022': 198, 'c458': 42, 'c1118': 234, 'c850': 170, 'c465': 48, 'c932': 186, 'c438': 24, 'c564': 104, 'c1129': 244, 'c494': 60, 'c822': 150, 'c516': 77, 'c1176': 263, 'c530': 86, 'c847': 167, 'c430': 17, 'c525': 83, 'c996': 190, 'c797': 133, 'c1128': 243, 'c1177': 264, 'c1175': 262, 'c1167': 260, 'c846': 166, 'c993': 189, 'c823': 151, 'c796': 132, 'c1133': 247, 'c808': 140, 'c1141': 254, 'c716': 115, 'c1046': 199, 'c607': 110, 'c543': 98, 'c443': 29, 'c1100': 222, 'c936': 188, 'c442': 28, 'c484': 55, 'c512': 73, 'c1109': 230, 'c1112': 233, 'c1148': 258, 'c411': 2, 'c844': 164, 'c678': 114, 'c497': 63, 'c503': 67, 'c1082': 216, 'c1098': 220, 'c554': 102} diff --git a/gbac/UD4-gbac.dzn b/gbac/UD4-gbac.dzn index 317585a..8b3930d 100644 --- a/gbac/UD4-gbac.dzn +++ b/gbac/UD4-gbac.dzn @@ -15,6 +15,6 @@ w1 = 1; w2 = 1; course_load = [6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 12, 6, 6, 6, 6, 6, 6, 6, 12, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 12, 6, 6, 12, 6, 6, 6, 6, 12, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 12, 12, 6, 12, 6, 12, 12, 6, 6, 12, 6, 6, 6, 6, 6, 6, 6, 12, 12, 6, 6, 6, 6, 12, 6, 6, 6, 12, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 12, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6] ; courses_of = [{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 131, 12, 13, 14, 135, 16, 136, 137, 132, 29, 30, 31, 32, 33, 34, 133, 36, 105, 107, 112, 113, 115, 116, 117, 118, 119}, {1, 2, 3, 4, 5, 6, 7, 131, 132, 10, 11, 133, 134, 135, 15, 136, 17, 18, 19, 20, 21, 29, 32, 35, 36, 137, 105, 107, 112, 113, 114, 115, 116, 117, 118, 119}, {1, 2, 3, 4, 5, 6, 7, 131, 132, 133, 135, 136, 13, 137, 16, 22, 23, 24, 25, 29, 34, 36, 105, 106, 107, 112, 113, 115, 116, 117, 118, 119}, {1, 2, 3, 4, 5, 6, 7, 131, 132, 133, 135, 136, 137, 19, 22, 24, 25, 26, 27, 28, 29, 35, 36, 105, 106, 107, 112, 113, 115, 116, 117, 118, 119}, {128, 130, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 111, 53, 54, 55, 58, 60, 61, 62}, {128, 129, 130, 37, 38, 39, 40, 41, 42, 43, 47, 48, 49, 50, 51, 53, 54, 55, 57, 58, 59, 62}, {128, 37, 38, 39, 40, 41, 42, 43, 44, 46, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 61, 62}, {138, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 76, 84, 86, 87, 88, 90, 94, 108, 109, 120, 121, 122, 126, 127}, {138, 63, 64, 65, 66, 67, 68, 69, 70, 73, 77, 78, 79, 82, 84, 86, 87, 88, 90, 94, 108, 109, 111, 120, 121, 122, 126, 127}, {138, 19, 35, 63, 64, 65, 66, 67, 68, 69, 70, 80, 84, 86, 87, 88, 90, 94, 98, 104, 108, 109, 111, 120, 121, 122, 126, 127}, {138, 63, 64, 65, 66, 67, 68, 69, 70, 81, 84, 86, 87, 88, 89, 90, 94, 108, 109, 111, 120, 121, 122, 126, 127}, {138, 47, 63, 64, 65, 66, 67, 68, 69, 70, 74, 75, 83, 84, 85, 86, 87, 88, 94, 108, 109, 111, 120, 121, 122, 126, 127}, {64, 96, 97, 99, 102, 103, 123, 139, 111, 124, 125, 120, 89, 90, 91, 92, 93, 94, 95}, {64, 96, 100, 101, 102, 73, 123, 139, 110, 124, 125, 120, 89, 90, 91, 92, 93, 94, 95}, {64, 96, 98, 35, 102, 104, 123, 139, 124, 81, 19, 125, 120, 89, 90, 91, 92, 93, 94, 95}, {64, 96, 102, 73, 123, 139, 77, 78, 124, 125, 120, 89, 90, 91, 92, 93, 94, 95}] ; -precedes = array2d(precedences,1..2, [1, 5, 1, 18, 1, 20, 1, 27, 1, 28, 1, 36, 1, 114, 1, 117, 1, 118, 1, 134, 2, 5, 2, 18, 2, 20, 2, 27, 2, 28, 2, 36, 2, 114, 2, 117, 2, 118, 2, 134, 8, 5, 8, 18, 8, 20, 8, 27, 8, 28, 8, 36, 8, 114, 8, 117, 8, 118, 8, 134, 9, 5, 9, 18, 9, 20, 9, 27, 9, 28, 9, 36, 9, 114, 9, 117, 9, 118, 9, 134, 11, 5, 11, 18, 11, 20, 11, 27, 11, 28, 11, 36, 11, 114, 11, 117, 11, 118, 11, 134, 37, 111, 37, 49, 37, 60, 37, 61, 37, 62, 38, 111, 38, 49, 38, 60, 38, 61, 38, 62, 39, 111, 39, 49, 39, 60, 39, 61, 39, 62, 63, 66, 63, 69, 63, 70, 63, 76, 63, 77, 63, 78, 63, 81, 63, 87, 63, 127, 63, 138, 65, 66, 65, 69, 65, 70, 65, 76, 65, 77, 65, 78, 65, 81, 65, 87, 65, 127, 65, 138, 90, 66, 90, 69, 90, 70, 90, 76, 90, 77, 90, 78, 90, 81, 90, 87, 90, 127, 90, 138, 71, 66, 71, 69, 71, 70, 71, 76, 71, 77, 71, 78, 71, 81, 71, 87, 71, 127, 71, 138, 74, 66, 74, 69, 74, 70, 74, 76, 74, 77, 74, 78, 74, 81, 74, 87, 74, 127, 74, 138, 90, 111, 90, 99, 90, 100, 90, 101, 90, 110, 90, 139, 91, 111, 91, 99, 91, 100, 91, 101, 91, 81, 91, 77, 91, 78, 91, 110, 91, 139, 92, 111, 92, 99, 92, 100, 92, 101, 92, 81, 92, 77, 92, 78, 92, 110, 92, 139, 105, 5, 105, 18, 105, 20, 105, 27, 105, 28, 105, 36, 105, 114, 105, 117, 105, 118, 105, 134, 108, 66, 108, 69, 108, 70, 108, 76, 108, 77, 108, 78, 108, 81, 108, 87, 108, 127, 108, 138, 124, 111, 124, 99, 124, 100, 124, 101, 124, 81, 124, 77, 124, 78, 124, 110, 124, 139, 126, 66, 126, 69, 126, 70, 126, 76, 126, 77, 126, 78, 126, 81, 126, 87, 126, 127, 126, 138, 131, 5, 131, 18, 131, 20, 131, 27, 131, 28, 131, 36, 131, 114, 131, 117, 131, 118, 131, 134] ); -undesirable = array2d(undesirables,1..2, [117, 2, 117, 5, 109, 3, 109, 6, 127, 1, 127, 4, 47, 3, 47, 6, 39, 2, 39, 5, 67, 2, 67, 5, 51, 2, 51, 5, 133, 3, 133, 6, 89, 3, 89, 6, 20, 2, 20, 5, 3, 1, 3, 4, 20, 3, 20, 6, 22, 2, 22, 5, 19, 1, 19, 4, 139, 1, 139, 4, 72, 3, 72, 6, 86, 1, 86, 4, 89, 2, 89, 5, 69, 3, 69, 6, 41, 3, 41, 6, 74, 3, 74, 6, 56, 3, 56, 6, 40, 2, 40, 5, 113, 3, 113, 6, 10, 3, 10, 6, 74, 1, 74, 4, 27, 2, 27, 5, 124, 2, 124, 5, 9, 1, 9, 4, 64, 1, 64, 4, 34, 3, 34, 6, 126, 3, 126, 6, 38, 2, 38, 5, 53, 3, 53, 6, 61, 3, 61, 6, 130, 3, 130, 6, 40, 3, 40, 6, 96, 1, 96, 4, 62, 3, 62, 6, 116, 1, 116, 4] ); +precedes = array2d(1..n_precedences,1..2, [1, 5, 1, 18, 1, 20, 1, 27, 1, 28, 1, 36, 1, 114, 1, 117, 1, 118, 1, 134, 2, 5, 2, 18, 2, 20, 2, 27, 2, 28, 2, 36, 2, 114, 2, 117, 2, 118, 2, 134, 8, 5, 8, 18, 8, 20, 8, 27, 8, 28, 8, 36, 8, 114, 8, 117, 8, 118, 8, 134, 9, 5, 9, 18, 9, 20, 9, 27, 9, 28, 9, 36, 9, 114, 9, 117, 9, 118, 9, 134, 11, 5, 11, 18, 11, 20, 11, 27, 11, 28, 11, 36, 11, 114, 11, 117, 11, 118, 11, 134, 37, 111, 37, 49, 37, 60, 37, 61, 37, 62, 38, 111, 38, 49, 38, 60, 38, 61, 38, 62, 39, 111, 39, 49, 39, 60, 39, 61, 39, 62, 63, 66, 63, 69, 63, 70, 63, 76, 63, 77, 63, 78, 63, 81, 63, 87, 63, 127, 63, 138, 65, 66, 65, 69, 65, 70, 65, 76, 65, 77, 65, 78, 65, 81, 65, 87, 65, 127, 65, 138, 90, 66, 90, 69, 90, 70, 90, 76, 90, 77, 90, 78, 90, 81, 90, 87, 90, 127, 90, 138, 71, 66, 71, 69, 71, 70, 71, 76, 71, 77, 71, 78, 71, 81, 71, 87, 71, 127, 71, 138, 74, 66, 74, 69, 74, 70, 74, 76, 74, 77, 74, 78, 74, 81, 74, 87, 74, 127, 74, 138, 90, 111, 90, 99, 90, 100, 90, 101, 90, 110, 90, 139, 91, 111, 91, 99, 91, 100, 91, 101, 91, 81, 91, 77, 91, 78, 91, 110, 91, 139, 92, 111, 92, 99, 92, 100, 92, 101, 92, 81, 92, 77, 92, 78, 92, 110, 92, 139, 105, 5, 105, 18, 105, 20, 105, 27, 105, 28, 105, 36, 105, 114, 105, 117, 105, 118, 105, 134, 108, 66, 108, 69, 108, 70, 108, 76, 108, 77, 108, 78, 108, 81, 108, 87, 108, 127, 108, 138, 124, 111, 124, 99, 124, 100, 124, 101, 124, 81, 124, 77, 124, 78, 124, 110, 124, 139, 126, 66, 126, 69, 126, 70, 126, 76, 126, 77, 126, 78, 126, 81, 126, 87, 126, 127, 126, 138, 131, 5, 131, 18, 131, 20, 131, 27, 131, 28, 131, 36, 131, 114, 131, 117, 131, 118, 131, 134] ); +undesirable = array2d(1..n_undesirables,1..2, [117, 2, 117, 5, 109, 3, 109, 6, 127, 1, 127, 4, 47, 3, 47, 6, 39, 2, 39, 5, 67, 2, 67, 5, 51, 2, 51, 5, 133, 3, 133, 6, 89, 3, 89, 6, 20, 2, 20, 5, 3, 1, 3, 4, 20, 3, 20, 6, 22, 2, 22, 5, 19, 1, 19, 4, 139, 1, 139, 4, 72, 3, 72, 6, 86, 1, 86, 4, 89, 2, 89, 5, 69, 3, 69, 6, 41, 3, 41, 6, 74, 3, 74, 6, 56, 3, 56, 6, 40, 2, 40, 5, 113, 3, 113, 6, 10, 3, 10, 6, 74, 1, 74, 4, 27, 2, 27, 5, 124, 2, 124, 5, 9, 1, 9, 4, 64, 1, 64, 4, 34, 3, 34, 6, 126, 3, 126, 6, 38, 2, 38, 5, 53, 3, 53, 6, 61, 3, 61, 6, 130, 3, 130, 6, 40, 3, 40, 6, 96, 1, 96, 4, 62, 3, 62, 6, 116, 1, 116, 4] ); % {'c365': 78, 'c346': 64, 'c635': 117, 'c652': 128, 'c313': 32, 'c640': 121, 'c664': 139, 'c356': 72, 'c655': 130, 'c401': 103, 'c353': 70, 'c312': 31, 'c651': 127, 'c384': 92, 'c305': 24, 'c309': 28, 'c388': 96, 'c345': 63, 'c393': 99, 'c310': 29, 'c625': 111, 'c289': 8, 'c649': 125, 'c379': 88, 'c292': 11, 'c332': 50, 'c285': 4, 'c333': 51, 'c300': 19, 'c294': 13, 'c339': 57, 'c297': 16, 'c632': 114, 'c661': 136, 'c284': 3, 'c378': 87, 'c319': 38, 'c656': 131, 'c283': 2, 'c286': 5, 'c299': 18, 'c657': 132, 'c347': 65, 'c395': 101, 'c624': 110, 'c322': 41, 'c368': 80, 'c348': 66, 'c307': 26, 'c287': 6, 'c317': 36, 'c373': 84, 'c374': 85, 'c338': 56, 'c370': 82, 'c662': 137, 'c663': 138, 'c296': 15, 'c636': 118, 'c336': 54, 'c351': 68, 'c381': 89, 'c637': 119, 'c337': 55, 'c634': 116, 'c386': 94, 'c316': 35, 'c659': 134, 'c369': 81, 'c350': 67, 'c302': 21, 'c619': 107, 'c617': 105, 'c306': 25, 'c355': 71, 'c642': 123, 'c638': 120, 'c391': 98, 'c376': 86, 'c323': 42, 'c331': 49, 'c330': 48, 'c334': 52, 'c363': 76, 'c311': 30, 'c372': 83, 'c308': 27, 'c290': 9, 'c648': 124, 'c315': 34, 'c318': 37, 'c291': 10, 'c658': 133, 'c653': 129, 'c326': 45, 'c382': 90, 'c618': 106, 'c282': 1, 'c633': 115, 'c361': 74, 'c358': 73, 'c303': 22, 'c402': 104, 'c387': 95, 'c288': 7, 'c400': 102, 'c298': 17, 'c364': 77, 'c325': 44, 'c366': 79, 'c324': 43, 'c620': 108, 'c295': 14, 'c389': 97, 'c328': 47, 'c321': 40, 'c335': 53, 'c630': 112, 'c320': 39, 'c385': 93, 'c623': 109, 'c301': 20, 'c342': 60, 'c344': 62, 'c327': 46, 'c293': 12, 'c352': 69, 'c641': 122, 'c631': 113, 'c383': 91, 'c660': 135, 'c650': 126, 'c394': 100, 'c314': 33, 'c362': 75, 'c341': 59, 'c340': 58, 'c304': 23, 'c343': 61} diff --git a/gbac/UD5-gbac.dzn b/gbac/UD5-gbac.dzn index 3b16b9b..94fcea9 100644 --- a/gbac/UD5-gbac.dzn +++ b/gbac/UD5-gbac.dzn @@ -15,6 +15,6 @@ w1 = 1; w2 = 1; course_load = [5, 5, 6, 5, 5, 6, 5, 6, 6, 5, 6, 5, 5, 5, 3, 6, 1, 1, 12, 6, 6, 6, 5, 6, 5, 5, 6, 5, 5, 6, 5, 6, 5, 6, 6, 6, 1, 1, 5, 5, 5, 3, 10, 6, 5, 5, 5, 5, 6, 6, 5, 5, 5, 6, 5, 5, 5, 6, 5, 6, 5, 5, 5, 5, 5, 5, 5, 3, 6, 1, 1, 10, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 1, 1, 5, 6, 6, 5, 6, 5, 5, 6, 6, 5, 5, 5, 5, 5, 3, 6, 1, 1, 6, 6, 6, 5, 5, 5, 5, 6, 6, 6, 5, 6, 6, 6, 5, 5, 6, 3, 6, 12, 5, 5, 6, 5, 5, 5, 12, 6, 5, 5, 6, 5, 5, 5, 6, 6, 5, 6, 5, 5, 5, 5, 5, 6, 1, 1, 3, 5, 5, 5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 31, 5, 5, 5, 5, 5, 5, 5, 5, 11, 4, 1, 5, 5, 5, 5, 5, 6, 5, 3, 5, 20, 2, 6, 1, 1, 1, 5, 1, 10, 5, 1, 4, 5, 5, 5, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 1, 12, 12, 9, 6, 6, 6, 3, 12, 12, 9, 6, 3, 6, 6, 3, 6, 12, 12, 9, 3, 6, 6, 6, 6, 3, 6, 9, 9, 9, 9, 9, 3, 9, 30, 6, 5, 5, 6, 5, 6, 7, 3, 6, 12, 1, 1, 5, 5, 5, 12, 5, 5, 12, 6, 9, 6, 3, 3, 3, 2, 6, 6, 6, 6, 30] ; courses_of = [{178, 273, 152, 184, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 233, 234, 235, 236, 237, 252}, {178, 273, 152, 184, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 67, 68, 69, 70, 71, 202, 233, 234, 235, 236, 237, 252}, {178, 273, 152, 184, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 67, 68, 69, 70, 71, 202, 233, 234, 235, 236, 237, 252}, {178, 273, 152, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 184, 66, 67, 68, 69, 70, 71, 72, 233, 234, 235, 236, 237, 252}, {178, 273, 152, 153, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 184, 67, 68, 69, 70, 71, 72, 233, 234, 235, 236, 237, 252}, {178, 273, 152, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 184, 67, 68, 69, 70, 71, 72, 202, 233, 234, 235, 236, 237, 252}, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 188, 191, 225, 226, 227, 230, 231, 232, 105, 106, 108, 115, 118}, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 21, 188, 191, 225, 226, 227, 230, 231, 232, 105, 106, 108, 115, 118}, {128, 4, 9, 11, 15, 16, 17, 18, 19, 22, 44, 45, 46, 47, 48, 225, 226, 227, 230, 231, 232, 105, 106, 108, 109, 110, 112, 113, 114, 115, 118, 119}, {128, 4, 6, 9, 11, 15, 16, 17, 18, 22, 44, 45, 46, 47, 48, 49, 225, 226, 227, 230, 231, 232, 105, 106, 108, 109, 110, 112, 113, 114, 115, 118, 119}, {2, 3, 5, 6, 7, 11, 15, 16, 17, 21, 161, 163, 164, 165, 166, 167, 168, 169, 170, 175, 192, 193, 225, 226, 227, 230, 231, 232, 105, 106, 108, 115, 118}, {256, 158, 31, 23, 24, 25, 26, 27, 28, 157, 29, 30, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 159, 176, 186, 187, 196, 197, 199, 216, 217, 218, 219, 220, 221, 222, 223, 224}, {128, 11, 276, 277, 282, 160, 161, 162, 163, 164, 45, 46, 177, 194, 195, 225, 226, 227, 228, 229, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 125, 126, 127}, {128, 11, 275, 276, 160, 161, 162, 163, 164, 45, 46, 177, 194, 195, 225, 226, 227, 228, 229, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127}, {128, 11, 275, 276, 277, 160, 161, 162, 163, 164, 45, 46, 177, 194, 195, 225, 226, 227, 228, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127}, {257, 258, 261, 270, 271, 272, 273, 278, 56, 215, 60, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 253, 255}, {257, 258, 129, 131, 261, 8, 270, 271, 272, 273, 278, 56, 60, 87, 88, 89, 90, 91, 92, 93, 96, 97, 98, 99, 101, 102, 103, 104, 253, 255}, {257, 258, 130, 131, 261, 270, 271, 272, 273, 278, 56, 57, 60, 87, 88, 89, 90, 91, 92, 93, 96, 97, 98, 99, 101, 102, 103, 104, 253, 255}, {171, 172, 173, 174, 189, 190, 200, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 207, 208, 209, 210, 211, 212, 213, 214, 247, 243, 201, 244, 245, 246, 248, 249, 250}, {171, 174, 182, 183, 189, 190, 200, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 207, 208, 209, 210, 211, 212, 213, 214, 247, 243, 201, 244, 245, 246, 248, 249, 250}, {161, 163, 174, 175, 181, 200, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 207, 208, 213, 214, 247, 243, 201, 244, 245, 246, 248, 249, 250, 251}, {171, 174, 181, 189, 190, 200, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 207, 208, 209, 210, 211, 212, 213, 214, 247, 243, 201, 244, 245, 246, 248, 249, 250}, {256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 278, 23, 24, 26, 27, 157, 31, 32, 33, 159, 39, 176, 88, 89, 99, 100, 253, 254, 255}, {256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 278, 23, 24, 26, 27, 157, 31, 32, 33, 159, 39, 176, 88, 89, 99, 100, 253, 254, 255}, {132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 274, 279, 154, 155, 156, 280, 281, 179, 180, 185, 205, 206, 238, 239, 240, 241, 242}, {132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 274, 147, 148, 149, 150, 151, 279, 280, 154, 155, 156, 281, 179, 180, 185, 204, 205, 206, 238, 239, 240, 241, 242}, {132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 274, 147, 148, 149, 150, 151, 279, 280, 154, 155, 156, 281, 179, 180, 185, 203, 205, 206, 238, 239, 240, 241, 242}, {132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 146, 147, 148, 149, 150, 151, 274, 279, 154, 155, 156, 280, 281, 185, 198, 238, 239, 240, 241, 242}, {132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 274, 147, 148, 149, 150, 151, 279, 280, 154, 155, 156, 281, 185, 198, 204, 238, 239, 240, 241, 242}, {132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 274, 147, 148, 149, 150, 151, 279, 280, 154, 155, 156, 281, 185, 198, 203, 238, 239, 240, 241, 242}, {132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 148, 149, 150, 151, 155, 179, 180, 185, 198, 205, 206, 238, 239, 240, 241, 242}] ; -precedes = array2d(precedences,1..2, [105, 3, 105, 6, 105, 7, 105, 8, 105, 9, 105, 10, 105, 12, 105, 13, 105, 14, 105, 20, 105, 21, 105, 22, 105, 44, 105, 119, 105, 46, 105, 47, 105, 128, 105, 48, 105, 49, 105, 112, 105, 113, 105, 188, 29, 199, 30, 25, 30, 34, 30, 35, 30, 36, 30, 39, 30, 40, 30, 41, 30, 157, 30, 158, 30, 176, 30, 256, 30, 187, 30, 196, 30, 197, 32, 25, 32, 34, 32, 35, 32, 36, 32, 39, 32, 40, 32, 41, 32, 157, 32, 158, 32, 176, 32, 256, 32, 196, 58, 52, 58, 56, 58, 57, 58, 63, 58, 64, 58, 65, 58, 66, 58, 178, 58, 184, 257, 88, 257, 89, 257, 255, 257, 56, 257, 90, 257, 94, 257, 95, 257, 99, 257, 100, 257, 8, 257, 129, 257, 130, 257, 57, 257, 215, 105, 116, 105, 117, 105, 120, 105, 121, 105, 125, 105, 126, 105, 127, 105, 160, 105, 45, 105, 177, 139, 133, 139, 137, 139, 138, 139, 143, 139, 144, 139, 145, 139, 146, 139, 185, 139, 203, 140, 133, 140, 137, 140, 138, 140, 143, 140, 144, 140, 145, 140, 146, 140, 185, 140, 203, 159, 199, 187, 199, 230, 3, 230, 6, 230, 7, 230, 8, 230, 9, 230, 10, 230, 12, 230, 13, 230, 14, 230, 20, 230, 21, 230, 22, 230, 44, 230, 119, 230, 46, 230, 47, 230, 128, 230, 48, 230, 49, 230, 112, 230, 113, 230, 188, 233, 52, 233, 56, 233, 57, 233, 63, 233, 64, 233, 65, 233, 66, 233, 178, 233, 184, 238, 133, 238, 137, 238, 138, 238, 143, 238, 144, 238, 145, 238, 146, 238, 185, 238, 203, 252, 52, 252, 56, 252, 57, 252, 63, 252, 64, 252, 65, 252, 66, 252, 178, 252, 184, 257, 256, 257, 39, 257, 157, 257, 176, 257, 264, 257, 265, 257, 266, 257, 268, 257, 269, 261, 88, 261, 89, 261, 255, 261, 99, 261, 256, 261, 39, 261, 157, 261, 176, 261, 100, 261, 264, 261, 265, 261, 266, 261, 268, 261, 269, 261, 56, 261, 90, 261, 94, 261, 95, 261, 8, 261, 129, 261, 130, 261, 57, 261, 215, 271, 273, 271, 253, 271, 87, 271, 88, 271, 89, 271, 255, 271, 56, 271, 90, 271, 91, 271, 92, 271, 60, 271, 93, 271, 258, 271, 94, 271, 95, 271, 96, 271, 97, 271, 98, 271, 99, 271, 100, 271, 8, 271, 129, 271, 130, 271, 57, 271, 215, 16, 2, 16, 4, 16, 5, 16, 6, 16, 9, 16, 118, 16, 12, 16, 19, 16, 20, 16, 21, 16, 114, 16, 109, 16, 110, 16, 45, 16, 46, 16, 47, 16, 128, 16, 49, 16, 164, 16, 175, 16, 167, 16, 169, 16, 192, 24, 33, 26, 27, 36, 41, 114, 119, 109, 110, 46, 47, 56, 63, 69, 51, 69, 54, 69, 55, 69, 57, 69, 61, 69, 63, 69, 64, 69, 65, 69, 66, 69, 152, 69, 153, 69, 202, 70, 57, 70, 63, 70, 64, 70, 65, 70, 66, 70, 153, 70, 202, 84, 75, 84, 78, 84, 79, 84, 80, 84, 81, 84, 82, 84, 173, 84, 175, 84, 181, 84, 182, 84, 190, 84, 200, 84, 211, 84, 212, 84, 213, 84, 214, 84, 251, 85, 75, 85, 78, 85, 79, 85, 80, 85, 81, 85, 82, 85, 173, 85, 175, 85, 181, 85, 182, 85, 190, 85, 200, 85, 211, 85, 212, 85, 213, 85, 214, 85, 251, 86, 75, 86, 78, 86, 79, 86, 80, 86, 81, 86, 82, 86, 173, 86, 175, 86, 181, 86, 182, 86, 190, 86, 200, 86, 211, 86, 212, 86, 213, 86, 214, 86, 251, 94, 95, 102, 253, 102, 90, 102, 92, 102, 93, 102, 94, 102, 95, 102, 96, 102, 97, 102, 98, 102, 100, 102, 129, 102, 57, 112, 113, 123, 109, 123, 110, 123, 111, 123, 114, 123, 117, 123, 118, 123, 120, 123, 121, 123, 46, 123, 124, 123, 126, 123, 127, 123, 128, 123, 45, 123, 164, 123, 282, 137, 143, 148, 135, 148, 136, 148, 138, 148, 143, 148, 144, 148, 145, 148, 146, 148, 154, 148, 156, 148, 179, 148, 180, 148, 203, 148, 204, 149, 138, 149, 143, 149, 144, 149, 145, 149, 146, 149, 203, 149, 204, 165, 166, 186, 24, 186, 25, 186, 26, 186, 27, 186, 29, 186, 33, 186, 35, 186, 39, 186, 40, 186, 41, 186, 43, 186, 157, 186, 159, 186, 176, 186, 256, 186, 199, 193, 9, 193, 12, 193, 19, 193, 20, 193, 21, 193, 46, 193, 47, 193, 128, 193, 49, 193, 175, 193, 167, 193, 169, 193, 118, 193, 6, 205, 206, 218, 220, 225, 227, 234, 236, 250, 74, 157, 176, 270, 272] ); -undesirable = array2d(undesirables,1..2, [5, 1, 5, 3, 5, 5, 19, 1, 19, 3, 19, 5, 20, 2, 20, 4, 20, 6, 37, 1, 37, 3, 37, 5, 39, 2, 39, 4, 39, 6, 40, 2, 40, 4, 40, 6, 42, 2, 42, 4, 42, 6, 45, 1, 45, 3, 45, 5, 48, 2, 48, 4, 48, 6, 53, 1, 53, 3, 53, 5, 55, 2, 55, 4, 55, 6, 65, 2, 65, 4, 65, 6, 68, 2, 68, 4, 68, 6, 76, 2, 76, 4, 76, 6, 79, 2, 79, 4, 79, 6, 80, 1, 80, 3, 80, 5, 81, 2, 81, 4, 81, 6, 83, 2, 83, 4, 83, 6, 95, 2, 95, 4, 95, 6, 99, 2, 99, 4, 99, 6, 103, 2, 103, 4, 103, 6, 106, 2, 106, 4, 106, 6, 113, 2, 113, 4, 113, 6, 124, 2, 124, 4, 124, 6, 125, 2, 125, 4, 125, 6, 127, 1, 127, 3, 127, 5, 130, 1, 130, 3, 130, 5, 135, 2, 135, 4, 135, 6, 137, 1, 137, 3, 137, 5, 140, 2, 140, 4, 140, 6, 145, 2, 145, 4, 145, 6, 149, 2, 149, 4, 149, 6, 150, 1, 150, 3, 150, 5, 157, 1, 157, 3, 157, 5, 173, 1, 173, 3, 173, 5, 175, 1, 175, 3, 175, 5, 180, 2, 180, 4, 180, 6, 181, 1, 181, 3, 181, 5, 186, 2, 186, 4, 186, 6, 193, 2, 193, 4, 193, 6, 194, 1, 194, 3, 194, 5, 221, 2, 221, 4, 221, 6, 222, 1, 222, 3, 222, 5, 228, 2, 228, 4, 228, 6, 234, 1, 234, 3, 234, 5, 237, 1, 237, 3, 237, 5, 252, 1, 252, 3, 252, 5, 255, 2, 255, 4, 255, 6, 258, 1, 258, 3, 258, 5, 263, 2, 263, 4, 263, 6, 268, 2, 268, 4, 268, 6, 269, 2, 269, 4, 269, 6, 270, 2, 270, 4, 270, 6, 282, 1, 282, 3, 282, 5] ); +precedes = array2d(1..n_precedences,1..2, [105, 3, 105, 6, 105, 7, 105, 8, 105, 9, 105, 10, 105, 12, 105, 13, 105, 14, 105, 20, 105, 21, 105, 22, 105, 44, 105, 119, 105, 46, 105, 47, 105, 128, 105, 48, 105, 49, 105, 112, 105, 113, 105, 188, 29, 199, 30, 25, 30, 34, 30, 35, 30, 36, 30, 39, 30, 40, 30, 41, 30, 157, 30, 158, 30, 176, 30, 256, 30, 187, 30, 196, 30, 197, 32, 25, 32, 34, 32, 35, 32, 36, 32, 39, 32, 40, 32, 41, 32, 157, 32, 158, 32, 176, 32, 256, 32, 196, 58, 52, 58, 56, 58, 57, 58, 63, 58, 64, 58, 65, 58, 66, 58, 178, 58, 184, 257, 88, 257, 89, 257, 255, 257, 56, 257, 90, 257, 94, 257, 95, 257, 99, 257, 100, 257, 8, 257, 129, 257, 130, 257, 57, 257, 215, 105, 116, 105, 117, 105, 120, 105, 121, 105, 125, 105, 126, 105, 127, 105, 160, 105, 45, 105, 177, 139, 133, 139, 137, 139, 138, 139, 143, 139, 144, 139, 145, 139, 146, 139, 185, 139, 203, 140, 133, 140, 137, 140, 138, 140, 143, 140, 144, 140, 145, 140, 146, 140, 185, 140, 203, 159, 199, 187, 199, 230, 3, 230, 6, 230, 7, 230, 8, 230, 9, 230, 10, 230, 12, 230, 13, 230, 14, 230, 20, 230, 21, 230, 22, 230, 44, 230, 119, 230, 46, 230, 47, 230, 128, 230, 48, 230, 49, 230, 112, 230, 113, 230, 188, 233, 52, 233, 56, 233, 57, 233, 63, 233, 64, 233, 65, 233, 66, 233, 178, 233, 184, 238, 133, 238, 137, 238, 138, 238, 143, 238, 144, 238, 145, 238, 146, 238, 185, 238, 203, 252, 52, 252, 56, 252, 57, 252, 63, 252, 64, 252, 65, 252, 66, 252, 178, 252, 184, 257, 256, 257, 39, 257, 157, 257, 176, 257, 264, 257, 265, 257, 266, 257, 268, 257, 269, 261, 88, 261, 89, 261, 255, 261, 99, 261, 256, 261, 39, 261, 157, 261, 176, 261, 100, 261, 264, 261, 265, 261, 266, 261, 268, 261, 269, 261, 56, 261, 90, 261, 94, 261, 95, 261, 8, 261, 129, 261, 130, 261, 57, 261, 215, 271, 273, 271, 253, 271, 87, 271, 88, 271, 89, 271, 255, 271, 56, 271, 90, 271, 91, 271, 92, 271, 60, 271, 93, 271, 258, 271, 94, 271, 95, 271, 96, 271, 97, 271, 98, 271, 99, 271, 100, 271, 8, 271, 129, 271, 130, 271, 57, 271, 215, 16, 2, 16, 4, 16, 5, 16, 6, 16, 9, 16, 118, 16, 12, 16, 19, 16, 20, 16, 21, 16, 114, 16, 109, 16, 110, 16, 45, 16, 46, 16, 47, 16, 128, 16, 49, 16, 164, 16, 175, 16, 167, 16, 169, 16, 192, 24, 33, 26, 27, 36, 41, 114, 119, 109, 110, 46, 47, 56, 63, 69, 51, 69, 54, 69, 55, 69, 57, 69, 61, 69, 63, 69, 64, 69, 65, 69, 66, 69, 152, 69, 153, 69, 202, 70, 57, 70, 63, 70, 64, 70, 65, 70, 66, 70, 153, 70, 202, 84, 75, 84, 78, 84, 79, 84, 80, 84, 81, 84, 82, 84, 173, 84, 175, 84, 181, 84, 182, 84, 190, 84, 200, 84, 211, 84, 212, 84, 213, 84, 214, 84, 251, 85, 75, 85, 78, 85, 79, 85, 80, 85, 81, 85, 82, 85, 173, 85, 175, 85, 181, 85, 182, 85, 190, 85, 200, 85, 211, 85, 212, 85, 213, 85, 214, 85, 251, 86, 75, 86, 78, 86, 79, 86, 80, 86, 81, 86, 82, 86, 173, 86, 175, 86, 181, 86, 182, 86, 190, 86, 200, 86, 211, 86, 212, 86, 213, 86, 214, 86, 251, 94, 95, 102, 253, 102, 90, 102, 92, 102, 93, 102, 94, 102, 95, 102, 96, 102, 97, 102, 98, 102, 100, 102, 129, 102, 57, 112, 113, 123, 109, 123, 110, 123, 111, 123, 114, 123, 117, 123, 118, 123, 120, 123, 121, 123, 46, 123, 124, 123, 126, 123, 127, 123, 128, 123, 45, 123, 164, 123, 282, 137, 143, 148, 135, 148, 136, 148, 138, 148, 143, 148, 144, 148, 145, 148, 146, 148, 154, 148, 156, 148, 179, 148, 180, 148, 203, 148, 204, 149, 138, 149, 143, 149, 144, 149, 145, 149, 146, 149, 203, 149, 204, 165, 166, 186, 24, 186, 25, 186, 26, 186, 27, 186, 29, 186, 33, 186, 35, 186, 39, 186, 40, 186, 41, 186, 43, 186, 157, 186, 159, 186, 176, 186, 256, 186, 199, 193, 9, 193, 12, 193, 19, 193, 20, 193, 21, 193, 46, 193, 47, 193, 128, 193, 49, 193, 175, 193, 167, 193, 169, 193, 118, 193, 6, 205, 206, 218, 220, 225, 227, 234, 236, 250, 74, 157, 176, 270, 272] ); +undesirable = array2d(1..n_undesirables,1..2, [5, 1, 5, 3, 5, 5, 19, 1, 19, 3, 19, 5, 20, 2, 20, 4, 20, 6, 37, 1, 37, 3, 37, 5, 39, 2, 39, 4, 39, 6, 40, 2, 40, 4, 40, 6, 42, 2, 42, 4, 42, 6, 45, 1, 45, 3, 45, 5, 48, 2, 48, 4, 48, 6, 53, 1, 53, 3, 53, 5, 55, 2, 55, 4, 55, 6, 65, 2, 65, 4, 65, 6, 68, 2, 68, 4, 68, 6, 76, 2, 76, 4, 76, 6, 79, 2, 79, 4, 79, 6, 80, 1, 80, 3, 80, 5, 81, 2, 81, 4, 81, 6, 83, 2, 83, 4, 83, 6, 95, 2, 95, 4, 95, 6, 99, 2, 99, 4, 99, 6, 103, 2, 103, 4, 103, 6, 106, 2, 106, 4, 106, 6, 113, 2, 113, 4, 113, 6, 124, 2, 124, 4, 124, 6, 125, 2, 125, 4, 125, 6, 127, 1, 127, 3, 127, 5, 130, 1, 130, 3, 130, 5, 135, 2, 135, 4, 135, 6, 137, 1, 137, 3, 137, 5, 140, 2, 140, 4, 140, 6, 145, 2, 145, 4, 145, 6, 149, 2, 149, 4, 149, 6, 150, 1, 150, 3, 150, 5, 157, 1, 157, 3, 157, 5, 173, 1, 173, 3, 173, 5, 175, 1, 175, 3, 175, 5, 180, 2, 180, 4, 180, 6, 181, 1, 181, 3, 181, 5, 186, 2, 186, 4, 186, 6, 193, 2, 193, 4, 193, 6, 194, 1, 194, 3, 194, 5, 221, 2, 221, 4, 221, 6, 222, 1, 222, 3, 222, 5, 228, 2, 228, 4, 228, 6, 234, 1, 234, 3, 234, 5, 237, 1, 237, 3, 237, 5, 252, 1, 252, 3, 252, 5, 255, 2, 255, 4, 255, 6, 258, 1, 258, 3, 258, 5, 263, 2, 263, 4, 263, 6, 268, 2, 268, 4, 268, 6, 269, 2, 269, 4, 269, 6, 270, 2, 270, 4, 270, 6, 282, 1, 282, 3, 282, 5] ); % {'c685': 133, 'c64': 36, 'c232': 120, 'c473': 131, 'c1239': 233, 'c188': 90, 'c217': 109, 'c58': 31, 'c61': 34, 'c118': 66, 'c73': 40, 'c980': 183, 'c695': 141, 'c253': 128, 'c104': 55, 'c1155': 207, 'c687': 134, 'c1298': 264, 'c770': 162, 'c1309': 273, 'c199': 97, 'c1278': 255, 'c1049': 192, 'c1249': 241, 'c207': 103, 'c162': 82, 'c935': 178, 'c1331': 278, 'c77': 42, 'c24': 12, 'c113': 61, 'c1077': 202, 'c1219': 221, 'c1274': 253, 'c33': 18, 'c1296': 262, 'c9': 2, 'c13': 5, 'c1233': 230, 'c219': 111, 'c88': 46, 'c216': 108, 'c89': 47, 'c150': 80, 'c223': 114, 'c1293': 259, 'c689': 135, 'c53': 28, 'c218': 110, 'c98': 51, 'c690': 136, 'c1059': 197, 'c208': 104, 'c1162': 212, 'c122': 68, 'c698': 143, 'c1328': 277, 'c1156': 208, 'c700': 145, 'c884': 174, 'c200': 98, 'c1264': 250, 'c468': 130, 'c52': 27, 'c198': 96, 'c1051': 194, 'c249': 127, 'c237': 123, 'c875': 170, 'c85': 45, 'c56': 30, 'c117': 65, 'c1291': 258, 'c1076': 201, 'c1226': 227, 'c1326': 275, 'c184': 88, 'c1157': 209, 'c1308': 272, 'c780': 167, 'c105': 56, 'c778': 166, 'c694': 140, 'c693': 139, 'c205': 102, 'c1220': 222, 'c189': 91, 'c51': 26, 'c704': 148, 'c247': 126, 'c1286': 257, 'c26': 13, 'c1307': 271, 'c691': 137, 'c946': 180, 'c125': 71, 'c910': 176, 'c945': 179, 'c1020': 188, 'c1246': 239, 'c1341': 282, 'c772': 163, 'c20': 10, 'c1230': 229, 'c1263': 249, 'c203': 100, 'c133': 75, 'c706': 150, 'c149': 79, 'c101': 53, 'c710': 151, 'c230': 118, 'c37': 22, 'c1266': 252, 'c72': 39, 'c696': 142, 'c1180': 215, 'c969': 182, 'c35': 20, 'c1237': 232, 'c124': 70, 'c59': 32, 'c1050': 193, 'c30': 16, 'c7': 1, 'c1224': 225, 'c143': 77, 'c110': 60, 'c1052': 195, 'c1241': 235, 'c1229': 228, 'c171': 84, 'c1301': 267, 'c123': 69, 'c71': 38, 'c1327': 276, 'c62': 35, 'c204': 101, 'c838': 169, 'c103': 54, 'c211': 105, 'c221': 113, 'c1305': 269, 'c137': 76, 'c14': 6, 'c99': 52, 'c163': 83, 'c734': 156, 'c767': 160, 'c60': 33, 'c742': 158, 'c732': 154, 'c705': 149, 'c49': 25, 'c19': 9, 'c1333': 280, 'c881': 171, 'c236': 122, 'c1043': 190, 'c108': 58, 'c193': 93, 'c1297': 263, 'c174': 86, 'c1257': 245, 'c23': 11, 'c1240': 234, 'c898': 175, 'c15': 7, 'c1306': 270, 'c233': 121, 'c148': 78, 'c29': 15, 'c1255': 243, 'c1078': 203, 'c97': 50, 'c106': 57, 'c1265': 251, 'c931': 177, 'c173': 85, 'c70': 37, 'c1260': 248, 'c115': 63, 'c1294': 260, 'c1325': 274, 'c683': 132, 'c153': 81, 'c1248': 240, 'c191': 92, 'c1299': 265, 'c220': 112, 'c1008': 186, 'c34': 19, 'c1223': 224, 'c201': 99, 'c231': 119, 'c1258': 246, 'c1144': 205, 'c883': 173, 'c225': 116, 'c999': 185, 'c769': 161, 'c197': 95, 'c183': 87, 'c185': 89, 'c55': 29, 'c1161': 211, 'c47': 24, 'c1282': 256, 'c1164': 214, 'c467': 129, 'c1235': 231, 'c27': 14, 'c1334': 281, 'c1250': 242, 'c116': 64, 'c746': 159, 'c701': 146, 'c114': 62, 'c91': 48, 'c722': 152, 'c1145': 206, 'c32': 17, 'c1217': 219, 'c1069': 199, 'c1256': 244, 'c196': 94, 'c1221': 223, 'c1300': 266, 'c126': 72, 'c1042': 189, 'c1225': 226, 'c781': 168, 'c227': 117, 'c80': 44, 'c1192': 217, 'c1295': 261, 'c1084': 204, 'c1061': 198, 'c109': 59, 'c243': 125, 'c773': 164, 'c1191': 216, 'c741': 157, 'c36': 21, 'c1275': 254, 'c1013': 187, 'c1075': 200, 'c777': 165, 'c1058': 196, 'c11': 3, 'c1244': 237, 'c74': 41, 'c1303': 268, 'c723': 153, 'c703': 147, 'c998': 184, 'c1163': 213, 'c733': 155, 'c92': 49, 'c1259': 247, 'c1332': 279, 'c12': 4, 'c1245': 238, 'c963': 181, 'c128': 73, 'c224': 115, 'c699': 144, 'c46': 23, 'c18': 8, 'c1218': 220, 'c212': 106, 'c1045': 191, 'c241': 124, 'c882': 172, 'c78': 43, 'c1216': 218, 'c132': 74, 'c1158': 210, 'c121': 67, 'c215': 107, 'c1242': 236, 'c692': 138} diff --git a/gbac/UD8-gbac.dzn b/gbac/UD8-gbac.dzn index 9775bb1..5e447c6 100644 --- a/gbac/UD8-gbac.dzn +++ b/gbac/UD8-gbac.dzn @@ -15,6 +15,6 @@ w1 = 1; w2 = 1; course_load = [6, 6, 6, 6, 6, 5, 5, 6, 6, 6, 6, 16, 5, 6, 6, 6, 5, 5, 5, 6, 5, 5, 6, 5, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 7, 7, 5, 5, 7, 7, 7, 5, 5, 5, 6, 6, 6, 5, 7, 7, 5, 5, 7, 7, 6, 6, 7, 5, 5, 15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 7, 5, 7, 7, 5, 5, 5, 7, 7, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 5, 6, 5, 6, 5, 5, 6, 6, 5, 15, 17, 5, 5, 7, 7, 5, 6, 5, 6, 5, 5, 6, 6, 16, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 5, 6, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 5, 5, 6, 6, 2, 1, 1, 1, 1, 5, 3, 3, 3, 3, 5, 5, 5, 5, 5, 5, 5, 6, 5, 5, 6, 16, 6, 7, 5] ; courses_of = [{35, 39, 40, 45, 46, 47, 48, 49, 53, 181, 61, 62, 67, 102, 103, 104, 105, 107, 108, 109, 111, 116, 124}, {35, 38, 39, 40, 45, 46, 47, 48, 49, 53, 58, 62, 64, 67, 102, 103, 104, 105, 107, 108, 109, 110, 116}, {16, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 47, 48, 182, 183, 78, 97, 98, 102, 103, 106, 116, 118}, {138, 35, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48, 182, 183, 99, 100, 101, 102, 103, 116, 118}, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 149, 23, 25, 163, 178, 204, 206, 112, 113}, {2, 8, 9, 10, 11, 14, 16, 17, 19, 20, 149, 21, 22, 23, 24, 26, 27, 28, 29, 30, 25, 31, 32, 33, 34, 163, 179, 205, 207, 112, 117}, {41, 176, 177, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 189, 60, 194, 201, 114, 121, 122, 123, 124, 125}, {176, 177, 49, 50, 52, 53, 54, 55, 56, 57, 60, 189, 61, 62, 64, 63, 194, 195, 200, 201, 202, 108, 114, 122, 123, 124}, {41, 176, 177, 49, 50, 51, 53, 54, 55, 56, 57, 60, 189, 65, 66, 67, 68, 195, 201, 208, 81, 114, 122, 124}, {180, 184, 185, 186, 187, 188, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 95, 96, 115, 119, 120}, {16, 17, 184, 185, 186, 187, 188, 196, 69, 70, 71, 72, 73, 77, 78, 79, 82, 84, 85, 86, 87, 88, 95, 96, 115, 119, 120}, {180, 184, 185, 186, 187, 188, 69, 70, 71, 72, 73, 76, 77, 78, 79, 89, 90, 91, 92, 93, 94, 95, 96, 115, 119, 120}, {129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 158, 159, 161, 162, 190, 191, 192, 193, 84, 88, 109}, {128, 129, 2, 142, 14, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 27, 156, 157, 158, 160, 162, 163, 109, 126}, {129, 2, 132, 5, 142, 14, 144, 145, 146, 150, 151, 153, 154, 27, 155, 156, 158, 157, 160, 33, 162, 163, 109, 126, 127}, {164, 165, 166, 167, 168, 169, 170, 171, 172, 198, 203, 175}, {164, 165, 166, 167, 168, 169, 170, 171, 172, 198, 203, 175}, {164, 165, 166, 167, 168, 169, 170, 171, 197, 173, 198, 203}, {164, 165, 166, 167, 168, 169, 170, 171, 197, 199, 174, 203}] ; -precedes = array2d(precedences,1..2, [6, 33, 6, 206, 6, 207, 7, 33, 7, 206, 7, 207, 10, 11, 16, 17, 20, 33, 20, 206, 20, 207, 24, 33, 24, 206, 24, 207, 25, 33, 25, 206, 25, 207, 26, 33, 26, 206, 26, 207, 28, 33, 28, 206, 28, 207, 31, 149, 35, 48, 35, 64, 36, 48, 36, 64, 16, 48, 16, 64, 43, 48, 43, 64, 49, 59, 49, 64, 49, 65, 49, 123, 49, 41, 50, 59, 50, 64, 50, 65, 50, 123, 50, 41, 51, 59, 51, 64, 51, 65, 51, 123, 51, 41, 52, 59, 52, 64, 52, 108, 52, 65, 52, 123, 52, 41, 53, 58, 61, 59, 61, 63, 61, 64, 61, 65, 61, 123, 61, 41, 66, 68, 96, 69, 102, 48, 102, 64, 104, 105, 104, 183, 107, 48, 107, 64, 108, 48, 108, 64, 49, 48, 110, 48, 110, 64, 118, 48, 118, 108, 118, 64, 122, 59, 126, 5, 128, 152, 130, 126, 130, 84, 130, 144, 130, 5, 130, 157, 132, 127, 135, 134, 136, 126, 136, 84, 136, 144, 136, 5, 136, 157, 137, 126, 137, 84, 137, 144, 137, 5, 137, 157, 145, 146, 149, 126, 149, 84, 149, 144, 149, 5, 149, 157, 163, 126, 163, 84, 163, 144, 163, 2, 163, 5, 163, 157, 14, 126, 14, 84, 14, 144, 14, 5, 14, 157, 150, 126, 150, 84, 150, 144, 150, 5, 150, 157, 151, 154, 153, 156, 157, 155, 158, 126, 158, 84, 158, 144, 158, 5, 158, 157, 163, 33, 163, 206, 163, 207, 166, 203, 176, 177, 182, 105, 182, 183, 189, 59, 189, 64, 189, 65, 189, 123, 189, 41, 190, 126, 190, 84, 190, 144, 190, 5, 190, 157, 192, 126, 192, 84, 192, 144, 192, 5, 192, 157, 204, 15] ); -undesirable = array2d(undesirables,1..2, [4, 1, 4, 4, 14, 1, 14, 4, 15, 3, 15, 6, 22, 1, 22, 4, 27, 1, 27, 4, 29, 3, 29, 6, 30, 2, 30, 5, 31, 3, 31, 6, 33, 2, 33, 5, 36, 3, 36, 6, 40, 1, 40, 4, 40, 2, 40, 5, 48, 3, 48, 6, 50, 3, 50, 6, 56, 2, 56, 5, 58, 2, 58, 5, 59, 2, 59, 5, 60, 3, 60, 6, 61, 3, 61, 6, 70, 3, 70, 6, 73, 3, 73, 6, 76, 2, 76, 5, 79, 3, 79, 6, 83, 3, 83, 6, 84, 3, 84, 6, 92, 3, 92, 6, 93, 1, 93, 4, 96, 1, 96, 4, 100, 2, 100, 5, 101, 1, 101, 4, 103, 3, 103, 6, 104, 3, 104, 6, 107, 3, 107, 6, 110, 1, 110, 4, 110, 3, 110, 6, 111, 1, 111, 4, 116, 2, 116, 5, 128, 1, 128, 4, 129, 1, 129, 4, 133, 2, 133, 5, 133, 3, 133, 6, 134, 2, 134, 5, 137, 3, 137, 6, 143, 2, 143, 5, 143, 3, 143, 6, 144, 1, 144, 4, 163, 3, 163, 6, 164, 1, 164, 4, 169, 3, 169, 6, 173, 1, 173, 4, 175, 2, 175, 5, 186, 2, 186, 5, 188, 3, 188, 6, 190, 1, 190, 4, 194, 3, 194, 6, 198, 3, 198, 6, 199, 2, 199, 5, 199, 3, 199, 6, 205, 3, 205, 6, 208, 1, 208, 4] ); +precedes = array2d(1..n_precedences,1..2, [6, 33, 6, 206, 6, 207, 7, 33, 7, 206, 7, 207, 10, 11, 16, 17, 20, 33, 20, 206, 20, 207, 24, 33, 24, 206, 24, 207, 25, 33, 25, 206, 25, 207, 26, 33, 26, 206, 26, 207, 28, 33, 28, 206, 28, 207, 31, 149, 35, 48, 35, 64, 36, 48, 36, 64, 16, 48, 16, 64, 43, 48, 43, 64, 49, 59, 49, 64, 49, 65, 49, 123, 49, 41, 50, 59, 50, 64, 50, 65, 50, 123, 50, 41, 51, 59, 51, 64, 51, 65, 51, 123, 51, 41, 52, 59, 52, 64, 52, 108, 52, 65, 52, 123, 52, 41, 53, 58, 61, 59, 61, 63, 61, 64, 61, 65, 61, 123, 61, 41, 66, 68, 96, 69, 102, 48, 102, 64, 104, 105, 104, 183, 107, 48, 107, 64, 108, 48, 108, 64, 49, 48, 110, 48, 110, 64, 118, 48, 118, 108, 118, 64, 122, 59, 126, 5, 128, 152, 130, 126, 130, 84, 130, 144, 130, 5, 130, 157, 132, 127, 135, 134, 136, 126, 136, 84, 136, 144, 136, 5, 136, 157, 137, 126, 137, 84, 137, 144, 137, 5, 137, 157, 145, 146, 149, 126, 149, 84, 149, 144, 149, 5, 149, 157, 163, 126, 163, 84, 163, 144, 163, 2, 163, 5, 163, 157, 14, 126, 14, 84, 14, 144, 14, 5, 14, 157, 150, 126, 150, 84, 150, 144, 150, 5, 150, 157, 151, 154, 153, 156, 157, 155, 158, 126, 158, 84, 158, 144, 158, 5, 158, 157, 163, 33, 163, 206, 163, 207, 166, 203, 176, 177, 182, 105, 182, 183, 189, 59, 189, 64, 189, 65, 189, 123, 189, 41, 190, 126, 190, 84, 190, 144, 190, 5, 190, 157, 192, 126, 192, 84, 192, 144, 192, 5, 192, 157, 204, 15] ); +undesirable = array2d(1..n_undesirables,1..2, [4, 1, 4, 4, 14, 1, 14, 4, 15, 3, 15, 6, 22, 1, 22, 4, 27, 1, 27, 4, 29, 3, 29, 6, 30, 2, 30, 5, 31, 3, 31, 6, 33, 2, 33, 5, 36, 3, 36, 6, 40, 1, 40, 4, 40, 2, 40, 5, 48, 3, 48, 6, 50, 3, 50, 6, 56, 2, 56, 5, 58, 2, 58, 5, 59, 2, 59, 5, 60, 3, 60, 6, 61, 3, 61, 6, 70, 3, 70, 6, 73, 3, 73, 6, 76, 2, 76, 5, 79, 3, 79, 6, 83, 3, 83, 6, 84, 3, 84, 6, 92, 3, 92, 6, 93, 1, 93, 4, 96, 1, 96, 4, 100, 2, 100, 5, 101, 1, 101, 4, 103, 3, 103, 6, 104, 3, 104, 6, 107, 3, 107, 6, 110, 1, 110, 4, 110, 3, 110, 6, 111, 1, 111, 4, 116, 2, 116, 5, 128, 1, 128, 4, 129, 1, 129, 4, 133, 2, 133, 5, 133, 3, 133, 6, 134, 2, 134, 5, 137, 3, 137, 6, 143, 2, 143, 5, 143, 3, 143, 6, 144, 1, 144, 4, 163, 3, 163, 6, 164, 1, 164, 4, 169, 3, 169, 6, 173, 1, 173, 4, 175, 2, 175, 5, 186, 2, 186, 5, 188, 3, 188, 6, 190, 1, 190, 4, 194, 3, 194, 6, 198, 3, 198, 6, 199, 2, 199, 5, 199, 3, 199, 6, 205, 3, 205, 6, 208, 1, 208, 4] ); % {'c824': 154, 'c543': 97, 'c825': 155, 'c433': 20, 'c417': 6, 'c527': 84, 'c546': 99, 'c415': 4, 'c993': 181, 'c501': 65, 'c1063': 198, 'c1002': 185, 'c478': 53, 'c833': 160, 'c794': 131, 'c456': 40, 'c1068': 201, 'c427': 14, 'c834': 161, 'c462': 45, 'c1057': 196, 'c454': 38, 'c512': 72, 'c820': 150, 'c1055': 195, 'c422': 10, 'c1046': 192, 'c441': 27, 'c1021': 190, 'c457': 41, 'c429': 16, 'c852': 169, 'c738': 123, 'c516': 76, 'c513': 73, 'c847': 167, 'c502': 66, 'c426': 13, 'c830': 158, 'c534': 89, 'c450': 35, 'c538': 93, 'c745': 124, 'c871': 175, 'c461': 44, 'c442': 28, 'c853': 170, 'c458': 42, 'c474': 49, 'c476': 51, 'c855': 171, 'c525': 82, 'c541': 96, 'c1047': 193, 'c793': 130, 'c411': 2, 'c465': 48, 'c533': 88, 'c599': 107, 'c475': 50, 'c484': 55, 'c437': 23, 'c1079': 205, 'c932': 178, 'c495': 61, 'c816': 149, 'c856': 172, 'c846': 166, 'c561': 103, 'c730': 121, 'c449': 34, 'c607': 111, 'c430': 17, 'c566': 105, 'c438': 24, 'c790': 128, 'c507': 69, 'c455': 39, 'c718': 117, 'c789': 127, 'c536': 91, 'c443': 29, 'c835': 162, 'c845': 165, 'c445': 31, 'c1001': 184, 'c747': 125, 'c724': 119, 'c600': 108, 'c869': 174, 'c598': 106, 'c826': 156, 'c489': 58, 'c812': 145, 'c412': 3, 'c670': 113, 'c796': 133, 'c866': 173, 'c540': 95, 'c463': 46, 'c814': 147, 'c440': 26, 'c409': 1, 'c464': 47, 'c800': 136, 'c423': 11, 'c850': 168, 'c806': 140, 'c804': 139, 'c997': 183, 'c840': 164, 'c996': 182, 'c431': 18, 'c1074': 204, 'c460': 43, 'c1067': 200, 'c531': 86, 'c797': 134, 'c606': 110, 'c788': 126, 'c421': 9, 'c487': 57, 'c498': 64, 'c564': 104, 'c922': 177, 'c444': 30, 'c416': 5, 'c1014': 189, 'c503': 67, 'c1094': 208, 'c801': 137, 'c535': 90, 'c808': 142, 'c676': 114, 'c725': 120, 'c1053': 194, 'c530': 85, 'c491': 59, 'c479': 54, 'c537': 92, 'c1003': 186, 'c1082': 207, 'c836': 163, 'c477': 52, 'c795': 132, 'c496': 62, 'c936': 180, 'c544': 98, 'c737': 122, 'c1071': 202, 'c828': 157, 'c494': 60, 'c716': 116, 'c506': 68, 'c446': 32, 'c511': 71, 'c1066': 199, 'c524': 81, 'c497': 63, 'c1005': 188, 'c532': 87, 'c523': 80, 'c791': 129, 'c831': 159, 'c419': 7, 'c554': 101, 'c425': 12, 'c807': 141, 'c435': 21, 'c436': 22, 'c447': 33, 'c1062': 197, 'c823': 153, 'c1022': 191, 'c602': 109, 'c678': 115, 'c822': 152, 'c798': 135, 'c1072': 203, 'c813': 146, 'c515': 75, 'c428': 15, 'c811': 144, 'c510': 70, 'c721': 118, 'c486': 56, 'c432': 19, 'c1081': 206, 'c539': 94, 'c452': 36, 'c520': 78, 'c439': 25, 'c933': 179, 'c1004': 187, 'c921': 176, 'c526': 83, 'c514': 74, 'c560': 102, 'c519': 77, 'c803': 138, 'c453': 37, 'c647': 112, 'c521': 79, 'c810': 143, 'c551': 100, 'c420': 8, 'c815': 148, 'c821': 151} diff --git a/gbac/gbac.mzn b/gbac/gbac.mzn index c98642d..42b81c7 100644 --- a/gbac/gbac.mzn +++ b/gbac/gbac.mzn @@ -22,7 +22,8 @@ % %------------------------------------------------------------------------------% % Includes -include "globals.mzn"; +include "global_cardinality_low_up_closed.mzn"; +include "bin_packing_load.mzn"; %------------------------------------------------------------------------------% % Parameters @@ -119,4 +120,4 @@ constraint objective = w1 * norm + w2 * undesirable_violation; constraint trace("% init_area = \(ub(objective));\n", true); output ["objective = ", show(objective)] ++[";\n"] ++ -["period_of = ", show(period_of)] ++ [";\n"]; + ["period_of = ", show(period_of)] ++ [";\n"]; diff --git a/gbac/proto.mzn b/gbac/proto.mzn new file mode 100644 index 0000000..4e19d02 --- /dev/null +++ b/gbac/proto.mzn @@ -0,0 +1,35 @@ +include "gbac.mzn"; +%-----------------------------------------------------------------------------% +% Objective +%-----------------------------------------------------------------------------% + +function int: uniform_set(set of int: S) = + if card(S) == max(S) - min(S) + 1 then + uniform(min(S),max(S)) + else + [ i | i in S ][uniform(1,card(S))] + endif; + + +predicate random_allocation() = + forall(i in courses) ( + (uniform(1,100) < 80) -> (period_of[i] == sol(period_of[i])) + ); + +predicate free_period() = + let { + int: period = uniform_set(periods); + } in forall(i in courses) ( + (sol(period_of[i]) != period) -> (period_of[i] == sol(period_of[i])) + ); + +predicate LNS(int: choice) ::export = + objective < sol(objective) /\ + if choice == 0 then + free_period() + else + random_allocation() + endif; + +constraint output_this([objective] ++ period_of); +solve :: int_search(period_of,first_fail,indomain_min,complete) satisfy; diff --git a/gbac/proto.uzn b/gbac/proto.uzn new file mode 100644 index 0000000..fe17834 --- /dev/null +++ b/gbac/proto.uzn @@ -0,0 +1,1397 @@ +int: w1:: global_register(11); +array [int] of set of int: courses_of:: global_register(3); +int: n_precedences:: global_register(4); +int: max_courses:: global_register(7); +int: w2:: global_register(12); +array [int,int] of int: undesirable:: global_register(10); +int: n_curricula:: global_register(2); +array [int,int] of int: precedes:: global_register(5); +array [int] of int: course_load:: global_register(8); +int: n_undesirables:: global_register(9); +int: n_periods:: global_register(1); +int: min_courses:: global_register(6); +int: n_courses:: global_register(0); +predicate solve_this(int: mode,var int: objective,array [int] of var int: x,int: varsel,int: valsel); +predicate int_plus(var int: a,var int: b,var int: c); +predicate int_max(var int: a,var int: b,var int: c); +predicate int_minus(var int: x,var int: y,var int: z); +predicate gecode_bin_packing_load(array [int] of var int: l,array [int] of var int: bin,array [int] of int: w,int: minIndex); +predicate array_int_minimum(var int: m,array [int] of var int: x); +predicate int_min(var int: a,var int: b,var int: c); +predicate int_lin_le(array [int] of int: as,array [int] of var int: bs,int: c); +predicate fzn_global_cardinality_low_up_closed(array [int] of var int: x,array [int] of int: cover,array [int] of int: lbound,array [int] of int: ubound); +predicate output_this(array [int] of var int: arr); +predicate int_lin_eq_reif(array [int] of int: as,array [int] of var int: bs,int: c,var bool: r); +predicate array_int_maximum(var int: m,array [int] of var int: x); +predicate int_times(var int: a,var int: b,var int: c); +predicate int_sum(array [int] of var int: xs,var int: x); +predicate int_lin_eq(array [int] of int: as,array [int] of var int: bs,int: c); +predicate clause(array [$T] of var bool: x,array [$T] of var bool: y); +predicate clause(array [$T] of bool: x,array [$T] of bool: y); +predicate bool_clause(array [int] of var bool: as,array [int] of var bool: bs); +predicate bool_not(var bool: a,var bool: b); +@@@@@@@@@@ +:mk_intvar: 1 +:absent: 1 +:infinity: 1 +:boolean_domain: 0 +:infinite_domain: 0 +:uniform: 2 +:sol: 1 +:sort_by: 2 +:floor: 1 +:ceil: 1 +:slice_Xd: 3 +:array_Xd: 2 +:index_set: 2 +:internal_sort: 1 +:f_op_not_b:FUN 1 +NOT R0 R1 +PUSH R1 +RET +:f_op_not_vb:FUN 1 +OPEN_AGGREGATION OTHER + BUILTIN boolean_domain + POP R1 + CALL ROOT mk_intvar 0 R1 + POP R2 + CALL ROOT bool_not 1 R0 R2 + PUSH R2 + CLEAR R1 R2 +CLOSE_AGGREGATION +POP R1 +PUSH R1 +RET +:d_op_not_b:FUN 1 +ISPAR R0 R1 +JMPIF R1 l0 +JMP l1 +l0: TCALL FUN f_op_not_b 0 +l1: TCALL FUN f_op_not_vb 1 +:bool_clause:ROOT 2 +:bool_clause_reif:ROOT 3 +CALL FUN d_op_not_b 0 R2 +POP R3 +OPEN_AGGREGATION VEC + PUSH R3 +CLOSE_AGGREGATION +POP R4 +OPEN_AGGREGATION VEC + ITER_ARRAY R1 l217 + l216: ITER_NEXT R6 + PUSH R6 + JMP l216 + l217: ITER_ARRAY R4 l219 + l218: ITER_NEXT R7 + PUSH R7 + JMP l218 + l219: CLEAR R6 R7 +CLOSE_AGGREGATION +POP R5 +IMMI 1 R6 +BUILTIN index_set R0 R6 +POP R7 +ITER_ARRAY R7 l221 +l220: ITER_NEXT R8 +ITER_NEXT R9 +ITER_RANGE R8 R9 l223 +l222: ITER_NEXT R10 +GET_ARRAY 1 R0 R10 R11 R12 +OPEN_AGGREGATION OR + IMMI 0 R14 + JMPIFNOT R12 l224 + MOV R11 R14 + l224: PUSH R14 + PUSH R3 + CLEAR R14 R14 +CLOSE_AGGREGATION +POP R13 +POST R13 +JMP l222 +l223: JMP l220 +l221: IMMI 1 R14 +BUILTIN index_set R1 R14 +POP R15 +ITER_ARRAY R15 l226 +l225: ITER_NEXT R16 +ITER_NEXT R17 +ITER_RANGE R16 R17 l228 +l227: ITER_NEXT R18 +GET_ARRAY 1 R1 R18 R19 R20 +IMMI 1 R21 +NOT R20 R22 +JMPIF R22 l229 +OPEN_AGGREGATION OR + CALL FUN d_op_not_b 0 R19 + POP R23 + PUSH R23 + PUSH R3 + CLEAR R23 R23 +CLOSE_AGGREGATION +POP R21 +l229: POST R21 +JMP l227 +l228: JMP l225 +l226: CALL ROOT d_clause_d1b_d1b 1 R0 R5 +RET +:int_lin_eq:ROOT 3 +:int_lin_eq:FUN 3 +OPEN_AGGREGATION OTHER + BUILTIN boolean_domain + POP R3 + CALL ROOT mk_intvar 0 R3 + POP R4 + CALL ROOT int_lin_eq_reif 1 R0 R1 R2 R4 + PUSH R4 + CLEAR R3 R4 +CLOSE_AGGREGATION +POP R3 +PUSH R3 +RET +:f_pre_int_lin_eq_d1i_d1vi_i:ROOT 3 +LENGTH R0 R4 +IMMI 0 R5 +EQI R4 R5 R6 +JMPIFNOT R6 l148 +EQI R2 R5 R7 +MOV R7 R3 +JMP l147 +l148: CALL ROOT int_lin_eq 1 R0 R1 R2 +IMMI 1 R8 +MOV R8 R3 +l147: POST R3 +RET +:f_pre_int_lin_eq_d1i_d1vi_i:FUN 3 +LENGTH R0 R4 +IMMI 0 R5 +EQI R4 R5 R6 +JMPIFNOT R6 l215 +EQI R2 R5 R7 +MOV R7 R3 +JMP l214 +l215: CALL FUN int_lin_eq 1 R0 R1 R2 +POP R8 +MOV R8 R3 +l214: PUSH R3 +RET +:f_pre_int_lin_eq_d1i_d1vi_i:IMP 3 +LENGTH R0 R4 +IMMI 0 R5 +EQI R4 R5 R6 +JMPIFNOT R6 l183 +EQI R2 R5 R7 +MOV R7 R3 +JMP l182 +l183: CALL FUN int_lin_eq 1 R0 R1 R2 +POP R8 +MOV R8 R3 +l182: PUSH R3 +RET +:f_sum_cc_dTvi:FUN 1 +OPEN_AGGREGATION OTHER + IMMI 0 R2 + BUILTIN array_Xd R0 R2 + POP R1 + BUILTIN infinite_domain + POP R3 + CALL ROOT mk_intvar 0 R3 + POP R4 + CALL ROOT int_sum 1 R1 R4 + PUSH R4 + CLEAR R1 R4 +CLOSE_AGGREGATION +POP R1 +PUSH R1 +RET +:f_op_times_i_i:FUN 2 +MULI R0 R1 R2 +PUSH R2 +RET +:f_op_times_i_vi:FUN 2 +IMMI 1 R2 +IMMI 1 R4 +EQI R0 R2 R5 +JMPIFNOT R5 l213 +IMMI 0 R4 +MOV R1 R3 +JMP l212 +l213: OPEN_AGGREGATION OTHER + BUILTIN infinite_domain + POP R6 + CALL ROOT mk_intvar 0 R6 + POP R7 + CALL ROOT int_times 1 R0 R1 R7 + PUSH R7 + CLEAR R6 R7 +CLOSE_AGGREGATION +POP R6 +IMMI 0 R4 +MOV R6 R3 +l212: PUSH R3 +RET +:f_op_times_vi_i:FUN 2 +CALL FUN d_op_times_i_i 0 R1 R0 +POP R2 +PUSH R2 +RET +:f_op_times_vi_vi:FUN 2 +OPEN_AGGREGATION OTHER + BUILTIN infinite_domain + POP R2 + CALL ROOT mk_intvar 0 R2 + POP R3 + CALL ROOT int_times 1 R0 R1 R3 + PUSH R3 + CLEAR R2 R3 +CLOSE_AGGREGATION +POP R2 +PUSH R2 +RET +:d_op_times_i_i:FUN 2 +ISPAR R0 R2 +JMPIF R2 l69 +JMP l70 +l69: ISPAR R1 R2 +JMPIF R2 l71 +JMP l72 +l70: ISPAR R1 R2 +JMPIF R2 l73 +JMP l74 +l71: TCALL FUN f_op_times_i_i 0 +l72: TCALL FUN f_op_times_i_vi 1 +l73: TCALL FUN f_op_times_vi_i 1 +l74: TCALL FUN f_op_times_vi_vi 1 +:f_LNS_i:ROOT 1 +LOAD_GLOBAL 16 R1 +BUILTIN sol R1 +POP R2 +LB R1 R3 +UB R2 R4 +LTI R3 R4 R3 +SIMPLIFY_LIN R1 R2 1 R5 R6 R7 +IMMI 0 R9 +EQI R0 R9 R10 +JMPIFNOT R10 l176 +CALL ROOT f_free_period 1 +IMMI 1 R11 +MOV R11 R8 +JMP l175 +l176: CALL ROOT f_random_allocation 1 +IMMI 1 R12 +MOV R12 R8 +l175: POST R3 +CALL ROOT f_pre_int_lin_le_d1i_d1vi_i 1 R5 R6 R7 +POST R8 +RET +:output_this:ROOT 1 +:f_global_cardinality_low_up_closed_d1vi_d1i_d1i_d1i:ROOT 4 +CALL ROOT fzn_global_cardinality_low_up_closed 1 R0 R1 R2 R3 +RET +:f_pre_int_lin_le_d1i_d1vi_i:ROOT 3 +LENGTH R0 R4 +IMMI 0 R5 +EQI R4 R5 R6 +JMPIFNOT R6 l174 +LEI R5 R2 R7 +MOV R7 R3 +JMP l173 +l174: CALL ROOT int_lin_le 1 R0 R1 R2 +IMMI 1 R8 +MOV R8 R3 +l173: POST R3 +RET +:f_bin_packing_load_d1vi_d1vi_d1i:ROOT 3 +CALL ROOT f_fzn_bin_packing_load_d1vi_d1vi_d1i 1 R0 R1 R2 +RET +:f_op_minus_i_i:FUN 2 +SUBI R0 R1 R2 +PUSH R2 +RET +:f_op_minus_vi_i:FUN 2 +IMMI 1 R2 +IMMI 1 R4 +IMMI 0 R5 +EQI R1 R5 R6 +JMPIFNOT R6 l152 +IMMI 0 R4 +MOV R0 R3 +JMP l151 +l152: OPEN_AGGREGATION OTHER + BUILTIN infinite_domain + POP R7 + CALL ROOT mk_intvar 0 R7 + POP R8 + CALL ROOT int_minus 1 R0 R1 R8 + PUSH R8 + CLEAR R7 R8 +CLOSE_AGGREGATION +POP R7 +IMMI 0 R4 +MOV R7 R3 +l151: PUSH R3 +RET +:f_op_minus_vi_vi:FUN 2 +OPEN_AGGREGATION OTHER + BUILTIN infinite_domain + POP R2 + CALL ROOT mk_intvar 0 R2 + POP R3 + CALL ROOT int_minus 1 R0 R1 R3 + PUSH R3 + CLEAR R2 R3 +CLOSE_AGGREGATION +POP R2 +PUSH R2 +RET +:d_op_minus_i_i:FUN 2 +ISPAR R0 R2 +JMPIF R2 l130 +JMP l131 +l130: ISPAR R1 R2 +JMPIF R2 l132 +JMP l133 +l131: ISPAR R1 R2 +JMPIF R2 l134 +JMP l133 +l132: TCALL FUN f_op_minus_i_i 0 +l133: TCALL FUN f_op_minus_vi_vi 1 +l134: TCALL FUN f_op_minus_vi_i 1 +:f_max_t_t:FUN 2 +IMMI 1 R2 +IMMI 1 R4 +LTI R1 R0 R5 +JMPIFNOT R5 l150 +IMMI 0 R4 +MOV R0 R3 +JMP l149 +l150: IMMI 0 R4 +MOV R1 R3 +l149: PUSH R3 +RET +:f_max_vi_vi:FUN 2 +OPEN_AGGREGATION OTHER + LB R0 R2 + LB R1 R3 + CALL FUN d_max_i_i 0 R2 R3 + POP R4 + UB R0 R5 + UB R1 R6 + CALL FUN d_max_i_i 0 R5 R6 + POP R7 + OPEN_AGGREGATION VEC + PUSH R4 + PUSH R7 + CLOSE_AGGREGATION + POP R8 + CALL ROOT mk_intvar 0 R8 + POP R9 + CALL ROOT int_max 1 R0 R1 R9 + PUSH R9 + CLEAR R2 R9 +CLOSE_AGGREGATION +POP R2 +PUSH R2 +RET +:d_max_i_i:FUN 2 +ISPAR R0 R2 +JMPIF R2 l135 +JMP l136 +l135: ISPAR R1 R2 +JMPIF R2 l137 +JMP l138 +l136: JMP l138 +l137: TCALL FUN f_max_t_t 0 +l138: TCALL FUN f_max_vi_vi 1 +:f_op_plus_i_i:FUN 2 +ADDI R0 R1 R2 +PUSH R2 +RET +:f_op_plus_i_vi:FUN 2 +IMMI 1 R2 +IMMI 1 R4 +IMMI 0 R5 +EQI R0 R5 R6 +JMPIFNOT R6 l146 +IMMI 0 R4 +MOV R1 R3 +JMP l145 +l146: OPEN_AGGREGATION OTHER + BUILTIN infinite_domain + POP R7 + CALL ROOT mk_intvar 0 R7 + POP R8 + CALL ROOT int_plus 1 R0 R1 R8 + PUSH R8 + CLEAR R7 R8 +CLOSE_AGGREGATION +POP R7 +IMMI 0 R4 +MOV R7 R3 +l145: PUSH R3 +RET +:f_op_plus_vi_i:FUN 2 +CALL FUN d_op_plus_i_i 0 R1 R0 +POP R2 +PUSH R2 +RET +:f_op_plus_vi_vi:FUN 2 +OPEN_AGGREGATION OTHER + BUILTIN infinite_domain + POP R2 + CALL ROOT mk_intvar 0 R2 + POP R3 + CALL ROOT int_plus 1 R0 R1 R3 + PUSH R3 + CLEAR R2 R3 +CLOSE_AGGREGATION +POP R2 +PUSH R2 +RET +:d_op_plus_i_i:FUN 2 +ISPAR R0 R2 +JMPIF R2 l139 +JMP l140 +l139: ISPAR R1 R2 +JMPIF R2 l141 +JMP l142 +l140: ISPAR R1 R2 +JMPIF R2 l143 +JMP l144 +l141: TCALL FUN f_op_plus_i_i 0 +l142: TCALL FUN f_op_plus_i_vi 1 +l143: TCALL FUN f_op_plus_vi_i 1 +l144: TCALL FUN f_op_plus_vi_vi 1 +:solve_this:ROOT 5 +:int_plus:ROOT 3 +:int_max:ROOT 3 +:int_minus:ROOT 3 +:f_fzn_bin_packing_load_d1vi_d1vi_d1i:ROOT 3 +IMMI 1 R3 +BUILTIN index_set R0 R3 +POP R4 +CALL FUN d_min_si 0 R4 +POP R5 +CALL ROOT gecode_bin_packing_load 1 R0 R1 R2 R5 +RET +:f_min_si:FUN 1 +LENGTH R0 R2 +IMMI 1 R3 +LEI R3 R2 R1 +JMPIF R1 l172 +ABORT +l172: GET_VEC R0 R3 R1 +PUSH R1 +RET +:f_min_dTvi:FUN 1 +IMMI 0 R2 +BUILTIN array_Xd R0 R2 +POP R1 +LENGTH R0 R3 +IMMI 1 R4 +LEI R4 R3 R5 +CALL FUN f_min_t_d1vi 1 R1 +POP R6 +PUSH R6 +RET +:d_min_si:FUN 1 +ISPAR R0 R1 +JMPIF R1 l153 +JMP l154 +l153: TCALL FUN f_min_si 0 +l154: TCALL FUN f_min_dTvi 1 +:gecode_bin_packing_load:ROOT 4 +:f_min_t_d1vi:FUN 1 +IMMI 1 R1 +IMMI 1 R3 +LENGTH R0 R4 +IMMI 0 R5 +EQI R4 R5 R6 +JMPIFNOT R6 l156 +IMMI 0 R3 +MOV R5 R2 +JMP l155 +l156: EQI R4 R1 R7 +JMPIFNOT R7 l157 +GET_ARRAY 1 R0 R1 R8 R9 +MOV R9 R3 +MOV R8 R2 +JMP l155 +l157: IMMI 2 R10 +EQI R4 R10 R11 +JMPIFNOT R11 l158 +GET_ARRAY 1 R0 R1 R12 R13 +GET_ARRAY 1 R0 R10 R14 R15 +CALL FUN d_min_i_i 1 R12 R14 +POP R16 +IMMI 0 R17 +JMPIFNOT R13 l163 +MOV R15 R17 +l163: MOV R17 R3 +MOV R16 R2 +JMP l155 +l158: OPEN_AGGREGATION OTHER + BUILTIN infinity R1 + POP R18 + ITER_ARRAY R0 l166 + l165: ITER_NEXT R21 + LB R21 R19 + LTI R19 R18 R20 + JMPIFNOT R20 l164 + MOV R19 R18 + l164: JMP l165 + l166: BUILTIN infinity R5 + POP R22 + ITER_ARRAY R0 l169 + l168: ITER_NEXT R25 + UB R25 R23 + LTI R22 R23 R24 + JMPIFNOT R24 l167 + MOV R23 R22 + l167: JMP l168 + l169: OPEN_AGGREGATION VEC + PUSH R18 + PUSH R22 + CLOSE_AGGREGATION + POP R26 + CALL ROOT mk_intvar 0 R26 + POP R27 + CALL ROOT array_int_minimum 1 R27 R0 + PUSH R27 + CLEAR R18 R27 +CLOSE_AGGREGATION +POP R18 +IMMI 0 R3 +MOV R18 R2 +l155: PUSH R2 +RET +:f_min_t_t:FUN 2 +IMMI 1 R2 +IMMI 1 R4 +LTI R0 R1 R5 +JMPIFNOT R5 l171 +IMMI 0 R4 +MOV R0 R3 +JMP l170 +l171: IMMI 0 R4 +MOV R1 R3 +l170: PUSH R3 +RET +:f_min_vi_vi:FUN 2 +OPEN_AGGREGATION OTHER + LB R0 R2 + LB R1 R3 + CALL FUN d_min_i_i 0 R2 R3 + POP R4 + UB R0 R5 + UB R1 R6 + CALL FUN d_min_i_i 0 R5 R6 + POP R7 + OPEN_AGGREGATION VEC + PUSH R4 + PUSH R7 + CLOSE_AGGREGATION + POP R8 + CALL ROOT mk_intvar 0 R8 + POP R9 + CALL ROOT int_min 1 R0 R1 R9 + PUSH R9 + CLEAR R2 R9 +CLOSE_AGGREGATION +POP R2 +PUSH R2 +RET +:d_min_i_i:FUN 2 +ISPAR R0 R2 +JMPIF R2 l159 +JMP l160 +l159: ISPAR R1 R2 +JMPIF R2 l161 +JMP l162 +l160: JMP l162 +l161: TCALL FUN f_min_t_t 0 +l162: TCALL FUN f_min_vi_vi 1 +:array_int_minimum:ROOT 2 +:int_min:ROOT 3 +:int_lin_le:ROOT 3 +:fzn_global_cardinality_low_up_closed:ROOT 4 +:f_free_period:ROOT 0 +LOAD_GLOBAL 14 R0 +CALL FUN f_uniform_set_si 0 R0 +POP R1 +LOAD_GLOBAL 13 R2 +ITER_ARRAY R2 l185 +l184: ITER_NEXT R3 +ITER_NEXT R4 +ITER_RANGE R3 R4 l187 +l186: ITER_NEXT R5 +LOAD_GLOBAL 15 R7 +GET_ARRAY 1 R7 R5 R8 R9 +BUILTIN sol R8 +POP R6 +EQI R6 R1 R10 +NOT R10 R10 +IMMI 0 R11 +JMPIFNOT R9 l188 +MOV R10 R11 +l188: DOM R8 R12 +DOM R6 R13 +INTERSECTION R12 R13 R12 +ISEMPTY R12 R13 +NOT R13 R13 +SIMPLIFY_LIN R8 R6 0 R15 R16 R14 +IMMI 1 R17 +JMPIF R11 l189 +NOT R9 R18 +JMPIF R18 l189 +NOT R13 R19 +JMPIF R19 l189 +CALL IMP f_pre_int_lin_eq_d1i_d1vi_i 1 R15 R16 R14 +POP R20 +MOV R20 R17 +l189: POST R17 +JMP l186 +l187: JMP l184 +l185: RET +:f_random_allocation:ROOT 0 +LOAD_GLOBAL 13 R0 +ITER_ARRAY R0 l178 +l177: ITER_NEXT R1 +ITER_NEXT R2 +ITER_RANGE R1 R2 l180 +l179: ITER_NEXT R3 +IMMI 1 R5 +IMMI 100 R6 +BUILTIN uniform R5 R6 +POP R4 +IMMI 80 R7 +LTI R4 R7 R8 +LOAD_GLOBAL 15 R9 +GET_ARRAY 1 R9 R3 R10 R11 +BUILTIN sol R10 +POP R12 +DOM R10 R13 +DOM R12 R14 +INTERSECTION R13 R14 R13 +ISEMPTY R13 R14 +NOT R14 R14 +SIMPLIFY_LIN R10 R12 0 R16 R17 R15 +IMMI 1 R18 +JMPIF R8 l181 +NOT R11 R19 +JMPIF R19 l181 +NOT R14 R20 +JMPIF R20 l181 +CALL IMP f_pre_int_lin_eq_d1i_d1vi_i 1 R16 R17 R15 +POP R21 +MOV R21 R18 +l181: POST R18 +JMP l179 +l180: JMP l177 +l178: RET +:int_lin_eq_reif:ROOT 4 +:f_uniform_set_si:FUN 1 +IMMI 1 R1 +IMMI 1 R3 +IMMI 0 R4 +IMMI 1 R5 +LENGTH R0 R6 +LTI R5 R6 R7 +JMPIFNOT R7 l192 +l191: INCI R4 +GET_VEC R0 R5 R7 +SUBI R4 R7 R4 +INCI R5 +GET_VEC R0 R5 R7 +INCI R5 +ADDI R4 R7 R4 +LTI R5 R6 R7 +JMPIF R7 l191 +l192: CALL FUN d_max_si 0 R0 +POP R8 +CALL FUN d_min_si 0 R0 +POP R9 +SUBI R8 R9 R10 +ADDI R10 R1 R11 +EQI R4 R11 R12 +JMPIFNOT R12 l195 +BUILTIN uniform R9 R8 +POP R13 +IMMI 0 R3 +MOV R13 R2 +JMP l190 +l195: BUILTIN uniform R1 R4 +POP R14 +OPEN_AGGREGATION VEC + ITER_ARRAY R0 l197 + l196: ITER_NEXT R15 + ITER_NEXT R16 + ITER_RANGE R15 R16 l199 + l198: ITER_NEXT R17 + PUSH R17 + JMP l198 + l199: JMP l196 + l197: CLEAR R15 R17 +CLOSE_AGGREGATION +POP R15 +GET_ARRAY 1 R15 R14 R16 R17 +MOV R17 R3 +MOV R16 R2 +l190: PUSH R2 +RET +:f_max_si:FUN 1 +LENGTH R0 R2 +IMMI 0 R3 +LEI R3 R2 R1 +JMPIF R1 l211 +ABORT +l211: GET_VEC R0 R2 R1 +PUSH R1 +RET +:f_max_dTvi:FUN 1 +IMMI 0 R2 +BUILTIN array_Xd R0 R2 +POP R1 +LENGTH R0 R3 +IMMI 1 R4 +LEI R4 R3 R5 +CALL FUN f_max_t_d1vi 1 R1 +POP R6 +PUSH R6 +RET +:d_max_si:FUN 1 +ISPAR R0 R1 +JMPIF R1 l193 +JMP l194 +l193: TCALL FUN f_max_si 0 +l194: TCALL FUN f_max_dTvi 1 +:f_max_t_d1vi:FUN 1 +IMMI 1 R1 +IMMI 1 R3 +LENGTH R0 R4 +IMMI 0 R5 +EQI R4 R5 R6 +JMPIFNOT R6 l201 +IMMI 0 R3 +MOV R5 R2 +JMP l200 +l201: EQI R4 R1 R7 +JMPIFNOT R7 l202 +BUILTIN index_set R0 R1 +POP R8 +CALL FUN d_min_si 0 R8 +POP R9 +GET_ARRAY 1 R0 R9 R10 R11 +MOV R11 R3 +MOV R10 R2 +JMP l200 +l202: IMMI 2 R12 +EQI R4 R12 R13 +JMPIFNOT R13 l203 +GET_ARRAY 1 R0 R1 R14 R15 +GET_ARRAY 1 R0 R12 R16 R17 +CALL FUN d_max_i_i 0 R14 R16 +POP R18 +IMMI 0 R19 +JMPIFNOT R15 l204 +MOV R17 R19 +l204: MOV R19 R3 +MOV R18 R2 +JMP l200 +l203: OPEN_AGGREGATION OTHER + BUILTIN infinity R1 + POP R20 + ITER_ARRAY R0 l207 + l206: ITER_NEXT R23 + LB R23 R21 + LTI R21 R20 R22 + JMPIFNOT R22 l205 + MOV R21 R20 + l205: JMP l206 + l207: BUILTIN infinity R5 + POP R24 + ITER_ARRAY R0 l210 + l209: ITER_NEXT R27 + UB R27 R25 + LTI R24 R25 R26 + JMPIFNOT R26 l208 + MOV R25 R24 + l208: JMP l209 + l210: OPEN_AGGREGATION VEC + PUSH R20 + PUSH R24 + CLOSE_AGGREGATION + POP R28 + CALL ROOT mk_intvar 0 R28 + POP R29 + CALL ROOT array_int_maximum 1 R29 R0 + PUSH R29 + CLEAR R20 R29 +CLOSE_AGGREGATION +POP R20 +IMMI 0 R3 +MOV R20 R2 +l200: PUSH R2 +RET +:array_int_maximum:ROOT 2 +:int_times:ROOT 3 +:int_sum:ROOT 2 +:clause:ROOT 2 +:clause:ROOT 2 +:d_clause_d1b_d1b:ROOT 2 +ISPAR R0 R2 +JMPIF R2 l230 +JMP l231 +l230: ISPAR R1 R2 +JMPIF R2 l232 +JMP l233 +l231: JMP l233 +l232: TCALL ROOT clause 1 +l233: TCALL ROOT clause 1 +:bool_not:ROOT 2 +:main:ROOT 0 +OPEN_AGGREGATION OTHER + IMMI 1 R0 + LOAD_GLOBAL 0 R1 + OPEN_AGGREGATION VEC + PUSH R0 + PUSH R1 + CLOSE_AGGREGATION + POP R2 + STORE_GLOBAL R2 13 + LOAD_GLOBAL 1 R3 + OPEN_AGGREGATION VEC + PUSH R0 + PUSH R3 + CLOSE_AGGREGATION + POP R4 + STORE_GLOBAL R4 14 + OPEN_AGGREGATION VEC + ITER_ARRAY R2 l3 + l2: ITER_NEXT R7 + ITER_NEXT R8 + ITER_RANGE R7 R8 l5 + l4: ITER_NEXT R9 + CALL ROOT mk_intvar 0 R4 + JMP l4 + l5: JMP l2 + l3: CLEAR R7 R9 + CLOSE_AGGREGATION + POP R5 + OPEN_AGGREGATION VEC + GET_VEC R2 R0 R6 + PUSH R6 + IMMI 2 R7 + GET_VEC R2 R7 R6 + PUSH R6 + CLEAR R7 R7 + CLOSE_AGGREGATION + POP R6 + BUILTIN array_Xd R5 R6 + POP R5 + STORE_GLOBAL R5 15 + BUILTIN infinite_domain + POP R7 + CALL ROOT mk_intvar 0 R7 + POP R8 + STORE_GLOBAL R8 16 + LOAD_GLOBAL 2 R9 + OPEN_AGGREGATION VEC + PUSH R0 + PUSH R9 + CLOSE_AGGREGATION + POP R10 + STORE_GLOBAL R10 17 + LOAD_GLOBAL 4 R11 + OPEN_AGGREGATION VEC + PUSH R0 + PUSH R11 + CLOSE_AGGREGATION + POP R12 + STORE_GLOBAL R12 18 + OPEN_AGGREGATION VEC + ITER_ARRAY R2 l7 + l6: ITER_NEXT R13 + ITER_NEXT R14 + ITER_RANGE R13 R14 l9 + l8: ITER_NEXT R15 + LOAD_GLOBAL 8 R16 + GET_ARRAY 1 R16 R15 R17 R18 + PUSH R17 + JMP l8 + l9: JMP l6 + l7: CLEAR R13 R18 + CLOSE_AGGREGATION + POP R13 + IMMI 0 R14 + ITER_ARRAY R13 l11 + l10: ITER_NEXT R15 + ADDI R14 R15 R14 + JMP l10 + l11: STORE_GLOBAL R14 19 + OPEN_AGGREGATION VEC + ITER_ARRAY R10 l13 + l12: ITER_NEXT R16 + ITER_NEXT R17 + ITER_RANGE R16 R17 l15 + l14: ITER_NEXT R18 + LOAD_GLOBAL 3 R19 + GET_ARRAY 1 R19 R18 R20 R21 + OPEN_AGGREGATION VEC + ITER_ARRAY R20 l17 + l16: ITER_NEXT R22 + ITER_NEXT R23 + ITER_RANGE R22 R23 l19 + l18: ITER_NEXT R24 + LOAD_GLOBAL 8 R25 + GET_ARRAY 1 R25 R24 R26 R27 + PUSH R26 + JMP l18 + l19: JMP l16 + l17: CLEAR R22 R27 + CLOSE_AGGREGATION + POP R22 + IMMI 0 R23 + ITER_ARRAY R22 l21 + l20: ITER_NEXT R24 + ADDI R23 R24 R23 + JMP l20 + l21: PUSH R23 + JMP l14 + l15: JMP l12 + l13: CLEAR R16 R24 + CLOSE_AGGREGATION + POP R16 + STORE_GLOBAL R16 20 + OPEN_AGGREGATION VEC + ITER_ARRAY R10 l23 + l22: ITER_NEXT R17 + ITER_NEXT R18 + ITER_RANGE R17 R18 l25 + l24: ITER_NEXT R19 + GET_ARRAY 1 R16 R19 R20 R21 + IMMI 0 R23 + EQI R3 R23 R22 + NOT R22 R22 + JMPIFNOT R22 l26 + DIVI R20 R3 R24 + MOV R24 R23 + l26: PUSH R23 + JMP l24 + l25: JMP l22 + l23: CLEAR R17 R24 + CLOSE_AGGREGATION + POP R17 + STORE_GLOBAL R17 21 + OPEN_AGGREGATION VEC + ITER_ARRAY R10 l28 + l27: ITER_NEXT R18 + ITER_NEXT R19 + ITER_RANGE R18 R19 l30 + l29: ITER_NEXT R20 + GET_ARRAY 1 R16 R20 R21 R22 + IMMI 0 R24 + EQI R3 R24 R23 + NOT R23 R23 + JMPIFNOT R23 l31 + DIVI R21 R3 R25 + MOV R25 R24 + l31: IMMI 1 R27 + IMMI 0 R29 + EQI R3 R29 R28 + NOT R28 R28 + JMPIFNOT R28 l33 + MODI R21 R3 R30 + MOV R30 R29 + l33: IMMI 0 R31 + IMMI 0 R32 + JMPIFNOT R22 l34 + MOV R28 R32 + l34: EQI R29 R31 R33 + IMMI 0 R34 + JMPIFNOT R32 l35 + MOV R33 R34 + l35: JMPIFNOT R34 l36 + IMMI 0 R27 + MOV R31 R26 + JMP l32 + l36: IMMI 0 R27 + MOV R0 R26 + l32: ADDI R24 R26 R35 + PUSH R35 + JMP l29 + l30: JMP l27 + l28: CLEAR R18 R35 +CLOSE_AGGREGATION +POP R18 +STORE_GLOBAL R18 22 +LOAD_GLOBAL 9 R19 +OPEN_AGGREGATION VEC + PUSH R0 + PUSH R19 +CLOSE_AGGREGATION +POP R20 +STORE_GLOBAL R20 23 +IMMI 0 R21 +OPEN_AGGREGATION VEC + PUSH R21 + PUSH R14 +CLOSE_AGGREGATION +POP R22 +OPEN_AGGREGATION VEC + ITER_ARRAY R10 l38 + l37: ITER_NEXT R25 + ITER_NEXT R26 + ITER_RANGE R25 R26 l40 + l39: ITER_NEXT R27 + ITER_ARRAY R4 l42 + l41: ITER_NEXT R28 + ITER_NEXT R29 + ITER_RANGE R28 R29 l44 + l43: ITER_NEXT R30 + CALL ROOT mk_intvar 0 R22 + JMP l43 + l44: JMP l41 + l42: JMP l39 + l40: JMP l37 + l38: CLEAR R25 R30 +CLOSE_AGGREGATION +POP R23 +OPEN_AGGREGATION VEC + GET_VEC R10 R0 R24 + PUSH R24 + IMMI 2 R25 + GET_VEC R10 R25 R24 + PUSH R24 + GET_VEC R4 R0 R24 + PUSH R24 + GET_VEC R4 R25 R24 + PUSH R24 + CLEAR R25 R25 +CLOSE_AGGREGATION +POP R24 +BUILTIN array_Xd R23 R24 +POP R23 +STORE_GLOBAL R23 24 +OPEN_AGGREGATION VEC + ITER_ARRAY R20 l46 + l45: ITER_NEXT R25 + ITER_NEXT R26 + ITER_RANGE R25 R26 l48 + l47: ITER_NEXT R27 + LOAD_GLOBAL 10 R28 + GET_ARRAY 2 R28 R27 R0 R29 R30 + GET_ARRAY 1 R5 R29 R31 R32 + IMMI 2 R33 + GET_ARRAY 2 R28 R27 R33 R34 R35 + DOM R31 R36 + DOM R34 R37 + INTERSECTION R36 R37 R36 + ISEMPTY R36 R37 + NOT R37 R37 + SIMPLIFY_LIN R31 R34 0 R39 R40 R38 + IMMI 0 R41 + JMPIFNOT R30 l49 + JMPIFNOT R32 l49 + JMPIFNOT R35 l49 + JMPIFNOT R37 l49 + CALL FUN f_pre_int_lin_eq_d1i_d1vi_i 1 R39 R40 R38 + POP R42 + MOV R42 R41 + l49: PUSH R41 + JMP l47 + l48: JMP l45 + l46: CLEAR R25 R42 +CLOSE_AGGREGATION +POP R25 +LENGTH R25 R26 +JMPIFNOT R26 l50 +EQI R0 R26 R27 +JMPIF R27 l51 +CALL FUN f_sum_cc_dTvi 1 R25 +POP R27 +JMP l52 +l50: IMMI 0 R27 +JMP l52 +l51: GET_VEC R25 R0 R27 +l52: OPEN_AGGREGATION VEC + PUSH R21 + PUSH R19 +CLOSE_AGGREGATION +POP R28 +INTERSECT_DOMAIN R27 R28 R29 +STORE_GLOBAL R27 25 +OPEN_AGGREGATION VEC + ITER_ARRAY R10 l54 + l53: ITER_NEXT R32 + ITER_NEXT R33 + ITER_RANGE R32 R33 l56 + l55: ITER_NEXT R34 + ITER_ARRAY R4 l58 + l57: ITER_NEXT R35 + ITER_NEXT R36 + ITER_RANGE R35 R36 l60 + l59: ITER_NEXT R37 + CALL ROOT mk_intvar 0 R22 + JMP l59 + l60: JMP l57 + l58: JMP l55 + l56: JMP l53 + l54: CLEAR R32 R37 +CLOSE_AGGREGATION +POP R30 +OPEN_AGGREGATION VEC + GET_VEC R10 R0 R31 + PUSH R31 + IMMI 2 R32 + GET_VEC R10 R32 R31 + PUSH R31 + GET_VEC R4 R0 R31 + PUSH R31 + GET_VEC R4 R32 R31 + PUSH R31 + CLEAR R32 R32 +CLOSE_AGGREGATION +POP R31 +BUILTIN array_Xd R30 R31 +POP R30 +STORE_GLOBAL R30 26 +OPEN_AGGREGATION VEC + ITER_ARRAY R10 l62 + l61: ITER_NEXT R32 + ITER_NEXT R33 + ITER_RANGE R32 R33 l64 + l63: ITER_NEXT R34 + ITER_ARRAY R4 l66 + l65: ITER_NEXT R35 + ITER_NEXT R36 + ITER_RANGE R35 R36 l68 + l67: ITER_NEXT R37 + GET_ARRAY 2 R30 R34 R37 R38 R39 + CALL FUN d_op_times_i_i 1 R38 R38 + POP R40 + PUSH R40 + JMP l67 + l68: JMP l65 + l66: JMP l63 + l64: JMP l61 + l62: CLEAR R32 R40 +CLOSE_AGGREGATION +POP R32 +LENGTH R32 R33 +JMPIFNOT R33 l75 +EQI R0 R33 R34 +JMPIF R34 l76 +CALL FUN f_sum_cc_dTvi 1 R32 +POP R34 +JMP l77 +l75: IMMI 0 R34 +JMP l77 +l76: GET_VEC R32 R0 R34 +l77: STORE_GLOBAL R34 27 +OPEN_AGGREGATION VEC + PUSH R8 +CLOSE_AGGREGATION +POP R35 +OPEN_AGGREGATION VEC + ITER_ARRAY R35 l79 + l78: ITER_NEXT R37 + PUSH R37 + JMP l78 + l79: ITER_ARRAY R5 l81 + l80: ITER_NEXT R38 + PUSH R38 + JMP l80 + l81: CLEAR R37 R38 +CLOSE_AGGREGATION +POP R36 +CALL ROOT output_this 1 R36 +ITER_ARRAY R10 l83 +l82: ITER_NEXT R37 +ITER_NEXT R38 +ITER_RANGE R37 R38 l85 +l84: ITER_NEXT R39 +LOAD_GLOBAL 3 R40 +GET_ARRAY 1 R40 R39 R41 R42 +OPEN_AGGREGATION VEC + ITER_ARRAY R41 l87 + l86: ITER_NEXT R43 + ITER_NEXT R44 + ITER_RANGE R43 R44 l89 + l88: ITER_NEXT R45 + GET_ARRAY 1 R5 R45 R46 R47 + PUSH R46 + JMP l88 + l89: JMP l86 + l87: CLEAR R43 R47 +CLOSE_AGGREGATION +POP R43 +OPEN_AGGREGATION VEC + ITER_ARRAY R4 l91 + l90: ITER_NEXT R44 + ITER_NEXT R45 + ITER_RANGE R44 R45 l93 + l92: ITER_NEXT R46 + PUSH R46 + JMP l92 + l93: JMP l90 + l91: CLEAR R44 R46 +CLOSE_AGGREGATION +POP R44 +OPEN_AGGREGATION VEC + ITER_ARRAY R4 l95 + l94: ITER_NEXT R45 + ITER_NEXT R46 + ITER_RANGE R45 R46 l97 + l96: ITER_NEXT R47 + LOAD_GLOBAL 6 R48 + PUSH R48 + JMP l96 + l97: JMP l94 + l95: CLEAR R45 R48 +CLOSE_AGGREGATION +POP R45 +OPEN_AGGREGATION VEC + ITER_ARRAY R4 l99 + l98: ITER_NEXT R46 + ITER_NEXT R47 + ITER_RANGE R46 R47 l101 + l100: ITER_NEXT R48 + LOAD_GLOBAL 7 R49 + PUSH R49 + JMP l100 + l101: JMP l98 + l99: CLEAR R46 R49 +CLOSE_AGGREGATION +POP R46 +CALL ROOT f_global_cardinality_low_up_closed_d1vi_d1i_d1i_d1i 1 R43 R44 R45 R46 +JMP l84 +l85: JMP l82 +l83: ITER_ARRAY R12 l103 +l102: ITER_NEXT R47 +ITER_NEXT R48 +ITER_RANGE R47 R48 l105 +l104: ITER_NEXT R49 +LOAD_GLOBAL 5 R50 +GET_ARRAY 2 R50 R49 R0 R51 R52 +GET_ARRAY 1 R5 R51 R53 R54 +IMMI 2 R55 +GET_ARRAY 2 R50 R49 R55 R56 R57 +GET_ARRAY 1 R5 R56 R58 R59 +LB R53 R60 +UB R58 R61 +LTI R60 R61 R60 +SIMPLIFY_LIN R53 R58 1 R62 R63 R64 +POST R52 +POST R54 +POST R57 +POST R59 +POST R60 +CALL ROOT f_pre_int_lin_le_d1i_d1vi_i 1 R62 R63 R64 +JMP l104 +l105: JMP l102 +l103: ITER_ARRAY R10 l107 +l106: ITER_NEXT R65 +ITER_NEXT R66 +ITER_RANGE R65 R66 l109 +l108: ITER_NEXT R67 +OPEN_AGGREGATION VEC + ITER_ARRAY R4 l111 + l110: ITER_NEXT R68 + ITER_NEXT R69 + ITER_RANGE R68 R69 l113 + l112: ITER_NEXT R70 + GET_ARRAY 2 R23 R67 R70 R71 R72 + PUSH R71 + JMP l112 + l113: JMP l110 + l111: CLEAR R68 R72 +CLOSE_AGGREGATION +POP R68 +LOAD_GLOBAL 3 R69 +GET_ARRAY 1 R69 R67 R70 R71 +OPEN_AGGREGATION VEC + ITER_ARRAY R70 l115 + l114: ITER_NEXT R72 + ITER_NEXT R73 + ITER_RANGE R72 R73 l117 + l116: ITER_NEXT R74 + GET_ARRAY 1 R5 R74 R75 R76 + PUSH R75 + JMP l116 + l117: JMP l114 + l115: CLEAR R72 R76 +CLOSE_AGGREGATION +POP R72 +OPEN_AGGREGATION VEC + ITER_ARRAY R70 l119 + l118: ITER_NEXT R73 + ITER_NEXT R74 + ITER_RANGE R73 R74 l121 + l120: ITER_NEXT R75 + LOAD_GLOBAL 8 R76 + GET_ARRAY 1 R76 R75 R77 R78 + PUSH R77 + JMP l120 + l121: JMP l118 + l119: CLEAR R73 R78 +CLOSE_AGGREGATION +POP R73 +CALL ROOT f_bin_packing_load_d1vi_d1vi_d1i 1 R68 R72 R73 +JMP l108 +l109: JMP l106 +l107: ITER_ARRAY R10 l123 +l122: ITER_NEXT R74 +ITER_NEXT R75 +ITER_RANGE R74 R75 l125 +l124: ITER_NEXT R76 +ITER_ARRAY R4 l127 +l126: ITER_NEXT R77 +ITER_NEXT R78 +ITER_RANGE R77 R78 l129 +l128: ITER_NEXT R79 +GET_ARRAY 2 R30 R76 R79 R80 R81 +GET_ARRAY 2 R23 R76 R79 R82 R83 +GET_ARRAY 1 R18 R76 R84 R85 +CALL FUN d_op_minus_i_i 1 R82 R84 +POP R86 +GET_ARRAY 1 R17 R76 R87 R88 +CALL FUN d_op_minus_i_i 0 R87 R82 +POP R89 +CALL FUN d_max_i_i 1 R86 R89 +POP R90 +DOM R80 R91 +DOM R90 R92 +INTERSECTION R91 R92 R91 +ISEMPTY R91 R92 +NOT R92 R92 +SIMPLIFY_LIN R80 R90 0 R94 R95 R93 +POST R81 +POST R83 +POST R85 +POST R88 +POST R92 +CALL ROOT f_pre_int_lin_eq_d1i_d1vi_i 1 R94 R95 R93 +JMP l128 +l129: JMP l126 +l127: JMP l124 +l125: JMP l122 +l123: LOAD_GLOBAL 11 R96 +CALL FUN d_op_times_i_i 0 R96 R34 +POP R97 +LOAD_GLOBAL 12 R98 +CALL FUN d_op_times_i_i 0 R98 R27 +POP R99 +CALL FUN d_op_plus_i_i 1 R97 R99 +POP R100 +DOM R8 R101 +DOM R100 R102 +INTERSECTION R101 R102 R101 +ISEMPTY R101 R102 +NOT R102 R102 +SIMPLIFY_LIN R8 R100 0 R104 R105 R103 +POST R102 +CALL ROOT f_pre_int_lin_eq_d1i_d1vi_i 1 R104 R105 R103 +IMMI 2 R106 +CALL ROOT solve_this 1 R21 R21 R5 R106 R0 +CLEAR R0 R106 +RET diff --git a/gbac/reduced_UD4-gbac.dzn b/gbac/reduced_UD4-gbac.dzn index c42de21..0387be5 100644 --- a/gbac/reduced_UD4-gbac.dzn +++ b/gbac/reduced_UD4-gbac.dzn @@ -19,6 +19,6 @@ w1 = 1; w2 = 1; course_load = [6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 12, 6, 6, 6, 6, 6, 6, 6, 6, 6, 12, 6, 6, 12, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6] ; courses_of = [{1, 2, 3, 35, 8, 28, 29, 30}, {1, 3, 4, 5, 35, 28, 29, 30}, {1, 35, 6, 8, 28, 29, 30}, {1, 35, 4, 6, 7, 28, 29, 30}, {34, 9, 10, 11, 12, 13, 15, 17, 18}, {34, 9, 10, 11, 12, 13, 14, 15, 18}, {9, 10, 11, 12, 14, 15, 16, 17, 18}, {32, 33, 19, 20, 21, 22, 24, 27}, {32, 33, 19, 20, 21, 24, 27}, {32, 33, 4, 19, 20, 21, 24, 27}, {32, 33, 19, 20, 21, 24, 25, 27}, {32, 33, 13, 19, 20, 21, 23, 24, 27}, {25, 26, 19, 36, 31}, {25, 26, 19, 36, 31}, {4, 36, 19, 25, 26, 31}, {25, 26, 19, 36, 31}] ; -precedes = array2d(precedences,1..2, [2, 5, 2, 7, 2, 30, 9, 17, 9, 18, 10, 17, 10, 18, 23, 21, 23, 33, 31, 36, 32, 21, 32, 33] ); -undesirable = array2d(undesirables,1..2, [1, 1, 1, 4, 2, 1, 2, 4, 3, 3, 3, 6, 4, 1, 4, 4, 5, 2, 5, 5, 5, 3, 5, 6, 6, 2, 6, 5, 7, 2, 7, 5, 8, 3, 8, 6, 9, 2, 9, 5, 10, 2, 10, 5, 11, 2, 11, 5, 11, 3, 11, 6, 12, 3, 12, 6, 13, 3, 13, 6, 14, 2, 14, 5, 15, 3, 15, 6, 16, 3, 16, 6, 17, 3, 17, 6, 18, 3, 18, 6, 19, 1, 19, 4, 20, 2, 20, 5, 21, 3, 21, 6, 22, 3, 22, 6, 23, 3, 23, 6, 23, 1, 23, 4, 24, 1, 24, 4, 25, 3, 25, 6, 25, 2, 25, 5, 26, 1, 26, 4, 27, 3, 27, 6, 28, 3, 28, 6, 29, 1, 29, 4, 30, 2, 30, 5, 31, 2, 31, 5, 32, 3, 32, 6, 33, 1, 33, 4, 34, 3, 34, 6, 35, 3, 35, 6, 36, 1, 36, 4] ); +precedes = array2d(1..n_precedences,1..2, [2, 5, 2, 7, 2, 30, 9, 17, 9, 18, 10, 17, 10, 18, 23, 21, 23, 33, 31, 36, 32, 21, 32, 33] ); +undesirable = array2d(1..n_undesirables,1..2, [1, 1, 1, 4, 2, 1, 2, 4, 3, 3, 3, 6, 4, 1, 4, 4, 5, 2, 5, 5, 5, 3, 5, 6, 6, 2, 6, 5, 7, 2, 7, 5, 8, 3, 8, 6, 9, 2, 9, 5, 10, 2, 10, 5, 11, 2, 11, 5, 11, 3, 11, 6, 12, 3, 12, 6, 13, 3, 13, 6, 14, 2, 14, 5, 15, 3, 15, 6, 16, 3, 16, 6, 17, 3, 17, 6, 18, 3, 18, 6, 19, 1, 19, 4, 20, 2, 20, 5, 21, 3, 21, 6, 22, 3, 22, 6, 23, 3, 23, 6, 23, 1, 23, 4, 24, 1, 24, 4, 25, 3, 25, 6, 25, 2, 25, 5, 26, 1, 26, 4, 27, 3, 27, 6, 28, 3, 28, 6, 29, 1, 29, 4, 30, 2, 30, 5, 31, 2, 31, 5, 32, 3, 32, 6, 33, 1, 33, 4, 34, 3, 34, 6, 35, 3, 35, 6, 36, 1, 36, 4] ); % {'c308': 7, 'c335': 15, 'c648': 31, 'c655': 34, 'c344': 18, 'c303': 6, 'c320': 10, 'c352': 21, 'c328': 13, 'c284': 1, 'c635': 30, 'c321': 11, 'c650': 32, 'c361': 23, 'c634': 29, 'c338': 16, 'c333': 14, 'c381': 25, 'c319': 9, 'c356': 22, 'c350': 20, 'c376': 24, 'c346': 19, 'c322': 12, 'c664': 36, 'c651': 33, 'c623': 27, 'c301': 5, 'c388': 26, 'c343': 17, 'c658': 35, 'c315': 8, 'c631': 28, 'c291': 3, 'c290': 2, 'c300': 4} diff --git a/install.sh b/install.sh index 64e4054..bb3a56f 100755 --- a/install.sh +++ b/install.sh @@ -7,12 +7,15 @@ module load flex mkdir -p software/{build,install} -# Build Chuffed -for dir in "chuffed" "gecode" "gecode_on_record" "gecode_on_replay" "minizinc" +# Build +for dir in "chuffed" "gecode" "gecode_base" "gecode_on_record" "gecode_on_replay" "minizinc" do - cmake -S software/${dir} -B software/build/${dir} -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=`pwd`/software/install/${dir} + cmake -S software/${dir} -B software/build/${dir} -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=`pwd`/software/install/${dir} -DCMAKE_POSITION_INDEPENDENT_CODE=ON cmake --build software/build/${dir} --config Release --target install -- -j4 done +cmake -S software/mza -B software/build/mza -DGECODE_ROOT=`pwd`/software/install/gecode_base/ -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=`pwd`/software/install/mza -DCMAKE_POSITION_INDEPENDENT_CODE=ON +cmake --build software/build/mza --config Release --target install -- -j4 + ln -s `pwd`/software/install/gecode/share/minizinc/gecode/mznlib `pwd`/software/install/minizinc/share/minizinc/gecode ln -s `pwd`/software/install/chuffed/share/minizinc/chuffed `pwd`/software/install/minizinc/share/minizinc/chuffed diff --git a/output/gbac.csv b/output/gbac.csv new file mode 100644 index 0000000..1d30048 --- /dev/null +++ b/output/gbac.csv @@ -0,0 +1,16 @@ +Configuration,Data,Compile Time (s),Solve Time (s) +Base,gbac/UD2-gbac.dzn,25.458818981423974,17.341287191957235 +Base,gbac/UD4-gbac.dzn,25.138776898384094,14.327164655551314 +Base,gbac/UD5-gbac.dzn,28.67881595157087,19.71248783171177 +Base,gbac/UD8-gbac.dzn,27.21088409423828,25.1462098434567 +Base,gbac/reduced_UD4-gbac.dzn,22.770592607557774,6.444738935679197 +Incremental Rewriting,gbac/UD2-gbac.dzn,0.44289878150448203,16.619278862606734 +Incremental Rewriting,gbac/UD4-gbac.dzn,0.2829281724989414,14.927907383069396 +Incremental Rewriting,gbac/UD5-gbac.dzn,0.5103892032057047,18.957355537917465 +Incremental Rewriting,gbac/UD8-gbac.dzn,0.39341115299612284,24.45117470016703 +Incremental Rewriting,gbac/reduced_UD4-gbac.dzn,0.13793163280934095,7.798715312965214 +Restart Based Search,gbac/UD2-gbac.dzn,0.24477300000000002,10.421576 +Restart Based Search,gbac/UD4-gbac.dzn,0.1655035,5.5756935 +Restart Based Search,gbac/UD5-gbac.dzn,0.35128000000000004,19.6692045 +Restart Based Search,gbac/UD8-gbac.dzn,0.18578899999999998,22.257126 +Restart Based Search,gbac/reduced_UD4-gbac.dzn,0.076363,5.0173045 diff --git a/output/radiation.csv b/output/radiation.csv new file mode 100644 index 0000000..bd8fc0b --- /dev/null +++ b/output/radiation.csv @@ -0,0 +1,28 @@ +Configuration,Data,Compile Time (s),Solve Time (s) +Base,radiation/01.dzn,0.24510734984651208,0.023913082107901572 +Base,radiation/02.dzn,0.30582690900191667,0.028090783022344114 +Base,radiation/03.dzn,0.3193663267418742,0.031867857277393344 +Base,radiation/04.dzn,0.39944209847599266,0.06285300282761455 +Base,radiation/05.dzn,0.3814492827281356,0.07408921113237739 +Base,radiation/06.dzn,0.42284395741298797,0.0830705595202744 +Base,radiation/07.dzn,0.3188631976954639,0.03759916163980961 +Base,radiation/08.dzn,0.41931043174117805,0.16300638895481825 +Base,radiation/09.dzn,0.4676839098334312,0.2566952796652913 +Incremental Rewriting,radiation/01.dzn,0.01925070183351636,0.01717325309291482 +Incremental Rewriting,radiation/02.dzn,0.020097369328141212,0.014758218824863435 +Incremental Rewriting,radiation/03.dzn,0.019597070664167403,0.03506866861134768 +Incremental Rewriting,radiation/04.dzn,0.020147585589438678,0.046414986718446016 +Incremental Rewriting,radiation/05.dzn,0.020718697272241116,0.07127303797751665 +Incremental Rewriting,radiation/06.dzn,0.020426739938557148,0.0479787765070796 +Incremental Rewriting,radiation/07.dzn,0.020852961204946042,0.031166965235024692 +Incremental Rewriting,radiation/08.dzn,0.020653770212084054,0.240933208912611 +Incremental Rewriting,radiation/09.dzn,0.020874314848333596,0.23791785333305598 +Restart Based Search,radiation/01.dzn,0.0397587,0.0156963 +Restart Based Search,radiation/02.dzn,0.03960400000000001,0.012639799999999998 +Restart Based Search,radiation/03.dzn,0.039819400000000005,0.018935200000000003 +Restart Based Search,radiation/04.dzn,0.044984100000000006,0.03167359999999999 +Restart Based Search,radiation/05.dzn,0.045806799999999995, 0.068683 +Restart Based Search,radiation/06.dzn,0.0460396,0.0317119 +Restart Based Search,radiation/07.dzn,0.048206399999999996,0.016760999999999998 +Restart Based Search,radiation/08.dzn,0.048394900000000005,0.1321796 +Restart Based Search,radiation/09.dzn,0.048275,0.1422641 diff --git a/pyflow.lock b/pyflow.lock new file mode 100644 index 0000000..5cecbd2 --- /dev/null +++ b/pyflow.lock @@ -0,0 +1,106 @@ +[[package]] +id = 12 +name = "six" +version = "1.16.0" +source = "pypi+https://pypi.org/pypi/six/1.16.0/json" +dependencies = [] + +[[package]] +id = 17 +name = "scipy" +version = "1.7.0" +source = "pypi+https://pypi.org/pypi/scipy/1.7.0/json" +dependencies = [] + +[[package]] +id = 13 +name = "pandas" +version = "1.3.0" +source = "pypi+https://pypi.org/pypi/pandas/1.3.0/json" +dependencies = ["python-dateutil 2.8.1 pypi+https://pypi.org/pypi/python-dateutil/2.8.1/json", "pytz 2018.4 pypi+https://pypi.org/pypi/pytz/2018.4/json"] + +[[package]] +id = 20 +name = "numpy" +version = "1.21.0" +source = "pypi+https://pypi.org/pypi/numpy/1.21.0/json" +dependencies = [] + +[[package]] +id = 10 +name = "kiwisolver" +version = "1.3.1" +source = "pypi+https://pypi.org/pypi/kiwisolver/1.3.1/json" +dependencies = [] + +[[package]] +id = 7 +name = "pyparsing" +version = "3.0.0b2" +source = "pypi+https://pypi.org/pypi/pyparsing/3.0.0b2/json" +dependencies = [] + +[[package]] +id = 2 +name = "pycparser" +version = "2.20" +source = "pypi+https://pypi.org/pypi/pycparser/2.20/json" +dependencies = [] + +[[package]] +id = 8 +name = "Pillow" +version = "8.3.1" +source = "pypi+https://pypi.org/pypi/Pillow/8.3.1/json" +dependencies = [] + +[[package]] +id = 15 +name = "python-dateutil" +version = "2.8.1" +source = "pypi+https://pypi.org/pypi/python-dateutil/2.8.1/json" +dependencies = [] + +[[package]] +id = 21 +name = "matplotlib" +version = "3.4.2" +source = "pypi+https://pypi.org/pypi/matplotlib/3.4.2/json" +dependencies = ["Cycler 0.10.0 pypi+https://pypi.org/pypi/Cycler/0.10.0/json", "Pillow 8.3.1 pypi+https://pypi.org/pypi/Pillow/8.3.1/json", "kiwisolver 1.3.1 pypi+https://pypi.org/pypi/kiwisolver/1.3.1/json", "pyparsing 3.0.0b2 pypi+https://pypi.org/pypi/pyparsing/3.0.0b2/json"] + +[[package]] +id = 3 +name = "seaborn" +version = "0.11.1" +source = "pypi+https://pypi.org/pypi/seaborn/0.11.1/json" +dependencies = ["pandas 1.3.0 pypi+https://pypi.org/pypi/pandas/1.3.0/json", "scipy 1.7.0 pypi+https://pypi.org/pypi/scipy/1.7.0/json"] + +[[package]] +id = 1 +name = "cffi" +version = "1.14.6" +source = "pypi+https://pypi.org/pypi/cffi/1.14.6/json" +dependencies = ["pycparser 2.20 pypi+https://pypi.org/pypi/pycparser/2.20/json"] + +[[package]] +id = 14 +name = "pytz" +version = "2018.4" +source = "pypi+https://pypi.org/pypi/pytz/2018.4/json" +dependencies = [] + +[[package]] +id = 11 +name = "Cycler" +version = "0.10.0" +source = "pypi+https://pypi.org/pypi/Cycler/0.10.0/json" +dependencies = ["six 1.16.0 pypi+https://pypi.org/pypi/six/1.16.0/json"] + +[[package]] +id = 15 +name = "minizinc" +version = "0.4.2" +source = "pypi+https://pypi.org/pypi/minizinc/0.4.2/json" +dependencies = [] + +[metadata] diff --git a/radiation.py b/radiation.py new file mode 100755 index 0000000..733c9e3 --- /dev/null +++ b/radiation.py @@ -0,0 +1,200 @@ +#!/usr/bin/env python3 +import os +import sys +import time +import csv + +import logging + +logging.basicConfig(filename="minizinc-python.log", level=logging.DEBUG) + +MZNR_HOME = os.getcwd() + "/software/install/minizinc/bin" +os.environ["PATH"] = MZNR_HOME + ":" + os.environ["PATH"] +os.environ["MZN_SOLVER_PATH"] = ( + os.getcwd() + "/software/install/gecode/share/minizinc/solvers" +) +import minizinc + +MZA_HOME = os.getcwd() + "/software/mza" +sys.path.append(MZA_HOME) + +mza_lib = os.getcwd() + "/software/install/mza/lib" +if sys.platform == "linux" or sys.platform == "linux2": + rerun = True + if not "LD_LIBRARY_PATH" in os.environ: + os.environ["LD_LIBRARY_PATH"] = mza_lib + elif not mza_lib in os.environ.get("LD_LIBRARY_PATH"): + os.environ["LD_LIBRARY_PATH"] += ":" + mza_lib + else: + rerun = False + if rerun: + os.execve(os.path.realpath(__file__), sys.argv, os.environ) + +import mza +from mza import Instance + +mza.DEBUG = False + +SOLVER = "gecode_presolver" +PROTO_MODEL = "radiation/proto.uzn" +RESTART_MODEL = "radiation/on_restart.mzn" +DATA = [ + "radiation/01.dzn", + "radiation/02.dzn", + "radiation/03.dzn", + "radiation/04.dzn", + "radiation/05.dzn", + "radiation/06.dzn", + "radiation/07.dzn", + "radiation/08.dzn", + "radiation/09.dzn", +] +FN_ID = "f_lex_obj_i" +N_OBJ = 2 + +RUNS = 10 + + +def radiation_restart(data_file): + os.environ["MZN_STDLIB_DIR"] = ( + os.getcwd() + "/software/install/minizinc/share/minizinc" + ) + gecode = minizinc.Solver.lookup("gecode") + inst = minizinc.Instance(gecode, minizinc.Model(RESTART_MODEL)) + inst.add_file(data_file) + + args = { + "all_solutions": True, + "--restart": "constant", + "--restart-scale": 100000000, + } + res = inst.solve(**args) + + # print(res.statistics) + return ( + res.statistics["flatTime"].total_seconds(), + (res.statistics["initTime"] + res.statistics["solveTime"]).total_seconds(), + ) + + +def radiation_incr(data_file): + os.environ["MZN_STDLIB_DIR"] = os.getcwd() + "/software/mza/share/minizinc" + compile_time = 0.0 + solve_time = 0.0 + + # --- Initial compilation of instance --- + start = time.perf_counter() + inst = Instance(PROTO_MODEL, data_file, SOLVER) + inst.output_dict(False) + compile_time += time.perf_counter() - start + # --- Solve initial instance --- + start = time.perf_counter() + (status, sol) = inst.solve() + solve_time += time.perf_counter() - start + # print(status + ": " + str(sol)) + + # --- Further Lexicographic Search --- + stage = 1 + while stage <= N_OBJ: + with inst.branch() as child: + # --- Compile instance --- + start = time.perf_counter() + inst.add_call(FN_ID, stage) + compile_time += time.perf_counter() - start + # inst.print() + + # --- Solve instance --- + start = time.perf_counter() + (status, sol) = inst.solve() + solve_time += time.perf_counter() - start + if status == "UNSAT": + stage += 1 + else: + assert status == "SAT" or status == "OPT" + # print(status + ": " + str(sol)) + + return compile_time, solve_time + + +def radiation_redo(data_file): + os.environ["MZN_STDLIB_DIR"] = os.getcwd() + "/software/mza/share/minizinc" + compile_time = 0.0 + solve_time = 0.0 + + incumbent = None + stage = 1 + status = None + inst = None + while stage <= N_OBJ: + # --- Compile instance --- + start = time.perf_counter() + + inst = Instance(PROTO_MODEL, data_file, SOLVER) + inst.output_dict(True) + if incumbent is not None: + inst.set_incumbent(incumbent) + inst.add_call(FN_ID, stage) + compile_time += time.perf_counter() - start + + # --- Solve instance --- + start = time.perf_counter() + (status, sol) = inst.solve() + solve_time += time.perf_counter() - start + if status == "UNSAT": + stage += 1 + else: + assert status == "SAT" or status == "OPT" + incumbent = sol + # print( + # status + ": [" + ", ".join([str(v) for k, v in incumbent.items()]) + "]" + # ) + + return compile_time, solve_time + + +if __name__ == "__main__": + fieldnames = ["Configuration", "Data", "Compile Time (s)", "Solve Time (s)"] + writer = csv.writer(sys.stdout) + + writer.writerow(fieldnames) + + for d in DATA: + # --- Run Restart based strategy + t1, t2 = 0, 0 + for i in range(RUNS): + ct, st = radiation_restart(d) + t1 += ct + t2 += st + writer.writerow(["RBS", d, t1 / RUNS, t2 / RUNS]) + # --- Run incremental rewriting + t1, t2 = 0, 0 + for i in range(RUNS): + ct, st = radiation_incr(d) + t1 += ct + t2 += st + writer.writerow(["Incr.", d, t1 / RUNS, t2 / RUNS]) + # --- Run baseline + t1, t2 = 0, 0 + for i in range(RUNS): + ct, st = radiation_redo(d) + t1 += ct + t2 += st + writer.writerow(["Base", d, t1 / RUNS, t2 / RUNS]) + +# df = pd.DataFrame( +# data={ +# "Compile Time (s)": compile_time, +# "Solve Time (s)": solve_time, +# "Data": cumulative, +# "Strategy": tag, +# } +# ) + +# plot = sns.scatterplot( +# data=df, +# x="Compile Time (s)", +# y="Solve Time (s)", +# hue="Strategy", +# style="Strategy", +# ) +# plot.figure.savefig("output.pdf") diff --git a/radiation/01.dzn b/radiation/01.dzn new file mode 100644 index 0000000..e62045f --- /dev/null +++ b/radiation/01.dzn @@ -0,0 +1,13 @@ + +m = 5; % rows +n = 5; % columns + +% max intensity = 8 +Intensity = [| +6, 7, 5, 6, 3 | +4, 2, 3, 1, 2 | +0, 1, 8, 0, 6 | +7, 5, 6, 4, 5 | +3, 4, 1, 3, 0 +|]; + diff --git a/radiation/02.dzn b/radiation/02.dzn new file mode 100644 index 0000000..9ea4611 --- /dev/null +++ b/radiation/02.dzn @@ -0,0 +1,13 @@ + +m = 5; % rows +n = 5; % columns + +% max intensity = 8 +Intensity = [| +6, 4, 5, 3, 4 | +2, 3, 0, 1, 8 | +0, 7, 5, 6, 3 | +5, 2, 3, 1, 2 | +0, 1, 8, 0, 6 +|]; + diff --git a/radiation/03.dzn b/radiation/03.dzn new file mode 100644 index 0000000..41fbc41 --- /dev/null +++ b/radiation/03.dzn @@ -0,0 +1,13 @@ + +m = 5; % rows +n = 5; % columns + +% max intensity = 8 +Intensity = [| +2, 0, 1, 8, 0 | +7, 8, 5, 6, 4 | +5, 3, 4, 2, 3 | +1, 2, 8, 0, 7 | +8, 6, 7, 5, 6 +|]; + diff --git a/radiation/04.dzn b/radiation/04.dzn new file mode 100644 index 0000000..6d8b836 --- /dev/null +++ b/radiation/04.dzn @@ -0,0 +1,14 @@ + +m = 6; % rows +n = 6; % columns + +% max intensity = 8 +Intensity = [| +2, 0, 1, 8, 0, 7 | +8, 6, 7, 4, 5, 3 | +4, 2, 3, 1, 2, 0 | +1, 7, 5, 6, 4, 5 | +3, 4, 1, 3, 0, 1 | +8, 0, 7, 8, 6, 7 +|]; + diff --git a/radiation/05.dzn b/radiation/05.dzn new file mode 100644 index 0000000..46ae55d --- /dev/null +++ b/radiation/05.dzn @@ -0,0 +1,14 @@ + +m = 6; % rows +n = 6; % columns + +% max intensity = 8 +Intensity = [| +1, 8, 0, 7, 8, 6 | +7, 4, 6, 3, 4, 2 | +3, 1, 2, 0, 1, 7 | +0, 6, 4, 5, 3, 4 | +2, 3, 0, 1, 8, 0 | +7, 8, 6, 7, 5, 6 +|]; + diff --git a/radiation/06.dzn b/radiation/06.dzn new file mode 100644 index 0000000..30c9040 --- /dev/null +++ b/radiation/06.dzn @@ -0,0 +1,14 @@ + +m = 6; % rows +n = 6; % columns + +% max intensity = 8 +Intensity = [| +6, 4, 5, 3, 4, 1 | +2, 0, 1, 8, 0, 7 | +8, 6, 7, 4, 5, 3 | +4, 2, 3, 1, 2, 0 | +1, 7, 8, 6, 7, 5 | +6, 4, 5, 3, 4, 1 +|]; + diff --git a/radiation/07.dzn b/radiation/07.dzn new file mode 100644 index 0000000..b31436f --- /dev/null +++ b/radiation/07.dzn @@ -0,0 +1,14 @@ + +m = 6; % rows +n = 6; % columns + +% max intensity = 9 +Intensity = [| +1, 8, 9, 7, 8, 5 | +7, 4, 5, 3, 4, 1 | +3, 0, 8, 9, 6, 7 | +5, 6, 4, 5, 2, 3 | +1, 2, 0, 1, 8, 9 | +7, 8, 5, 7, 4, 5 +|]; + diff --git a/radiation/08.dzn b/radiation/08.dzn new file mode 100644 index 0000000..268634c --- /dev/null +++ b/radiation/08.dzn @@ -0,0 +1,14 @@ + +m = 6; % rows +n = 6; % columns + +% max intensity = 9 +Intensity = [| +7, 5, 6, 3, 5, 2 | +3, 1, 2, 9, 1, 8 | +6, 7, 4, 5, 3, 4 | +2, 3, 0, 1, 9, 0 | +8, 9, 7, 5, 6, 4 | +5, 2, 3, 1, 2, 0 +|]; + diff --git a/radiation/09.dzn b/radiation/09.dzn new file mode 100644 index 0000000..eaff181 --- /dev/null +++ b/radiation/09.dzn @@ -0,0 +1,14 @@ + +m = 6; % rows +n = 6; % columns + +% max intensity = 9 +Intensity = [| +1, 9, 6, 7, 5, 6 | +3, 5, 2, 3, 1, 2 | +9, 1, 8, 9, 7, 8 | +5, 7, 4, 5, 3, 4 | +1, 3, 0, 1, 9, 0 | +7, 9, 6, 7, 5, 6 +|]; + diff --git a/radiation/on_restart.mzn b/radiation/on_restart.mzn new file mode 100644 index 0000000..7fb6f23 --- /dev/null +++ b/radiation/on_restart.mzn @@ -0,0 +1,32 @@ +include "radiation.mzn"; +include "restart.mzn"; + +%-----------------------------------------------------------------------------% +% Objective +%-----------------------------------------------------------------------------% + +predicate complete();% = abort("'complete' should be used in reified context"); +predicate complete_reif(var bool: marker); + +predicate lex_minimize(array[int] of var int: o) = + let { + var min(index_set(o))..max(index_set(o))+1: stage; + } in if status() = START then + stage = min(index_set(o)) + elseif status() = UNSAT then + stage = lastval(stage) + 1 + else /* status() = SAT */ + stage = lastval(stage) + /\ o[stage] < sol(o[stage]) + endif + /\ forall(i in min(index_set(o))..stage-1) ( + o[i] = sol(o[i]) + ) + /\ if stage > max(index_set(o)) then + complete() + endif; + +% var STATUS: status ::add_to_output = status(); +constraint lex_minimize([Beamtime, K]); + +solve :: int_search([Beamtime] ++ N ++ [Q[i,j,b] | i in Rows, j in Columns, b in BTimes ], input_order, indomain_split, complete) satisfy; diff --git a/radiation/proto.mzn b/radiation/proto.mzn new file mode 100644 index 0000000..b3a2973 --- /dev/null +++ b/radiation/proto.mzn @@ -0,0 +1,17 @@ +include "radiation.mzn"; +include "lex_less.mzn"; + +%-----------------------------------------------------------------------------% +% Objective +%-----------------------------------------------------------------------------% + +predicate lex_minimize(array[int] of var int: o, int: stage) = + forall(i in min(index_set(o))..stage-1) ( + o[i] = sol(o[i]) + ) + /\ o[stage] < sol(o[stage]); + +constraint output_this([Beamtime, K]); +predicate lex_obj(int: stage) ::export = lex_minimize([Beamtime, K], stage); + +solve :: int_search([Beamtime] ++ N ++ [Q[i,j,b] | i in Rows, j in Columns, b in BTimes ], input_order, indomain_min, complete) satisfy; diff --git a/radiation/proto.uzn b/radiation/proto.uzn new file mode 100644 index 0000000..ab77b51 --- /dev/null +++ b/radiation/proto.uzn @@ -0,0 +1,1113 @@ +int: n:: global_register(1); +int: m:: global_register(0); +array [int,int] of int: Intensity:: global_register(2); +predicate solve_this(int: mode,var int: objective,array [int] of var int: x,int: varsel,int: valsel); +predicate int_lin_le(array [int] of int: as,array [int] of var int: bs,int: c); +predicate int_plus(var int: a,var int: b,var int: c); +predicate int_max(var int: a,var int: b,var int: c); +predicate int_minus(var int: x,var int: y,var int: z); +predicate int_sum(array [int] of var int: xs,var int: x); +predicate int_times(var int: a,var int: b,var int: c); +predicate array_int_minimum(var int: m,array [int] of var int: x); +predicate int_min(var int: a,var int: b,var int: c); +predicate output_this(array [int] of var int: arr); +predicate array_int_maximum(var int: m,array [int] of var int: x); +predicate int_lin_eq(array [int] of int: as,array [int] of var int: bs,int: c); +predicate clause(array [$T] of var bool: x,array [$T] of var bool: y); +predicate clause(array [$T] of bool: x,array [$T] of bool: y); +predicate bool_clause(array [int] of var bool: as,array [int] of var bool: bs); +predicate bool_not(var bool: a,var bool: b); +@@@@@@@@@@ +:mk_intvar: 1 +:absent: 1 +:infinity: 1 +:boolean_domain: 0 +:infinite_domain: 0 +:uniform: 2 +:sol: 1 +:sort_by: 2 +:floor: 1 +:ceil: 1 +:slice_Xd: 3 +:array_Xd: 2 +:index_set: 2 +:internal_sort: 1 +:f_op_not_b:FUN 1 +NOT R0 R1 +PUSH R1 +RET +:f_op_not_vb:FUN 1 +OPEN_AGGREGATION OTHER + BUILTIN boolean_domain + POP R1 + CALL ROOT mk_intvar 0 R1 + POP R2 + CALL ROOT bool_not 1 R0 R2 + PUSH R2 + CLEAR R1 R2 +CLOSE_AGGREGATION +POP R1 +PUSH R1 +RET +:d_op_not_b:FUN 1 +ISPAR R0 R1 +JMPIF R1 l0 +JMP l1 +l0: TCALL FUN f_op_not_b 0 +l1: TCALL FUN f_op_not_vb 1 +:bool_clause:ROOT 2 +:bool_clause_reif:ROOT 3 +CALL FUN d_op_not_b 0 R2 +POP R3 +OPEN_AGGREGATION VEC + PUSH R3 +CLOSE_AGGREGATION +POP R4 +OPEN_AGGREGATION VEC + ITER_ARRAY R1 l178 + l177: ITER_NEXT R6 + PUSH R6 + JMP l177 + l178: ITER_ARRAY R4 l180 + l179: ITER_NEXT R7 + PUSH R7 + JMP l179 + l180: CLEAR R6 R7 +CLOSE_AGGREGATION +POP R5 +IMMI 1 R6 +BUILTIN index_set R0 R6 +POP R7 +ITER_ARRAY R7 l182 +l181: ITER_NEXT R8 +ITER_NEXT R9 +ITER_RANGE R8 R9 l184 +l183: ITER_NEXT R10 +GET_ARRAY 1 R0 R10 R11 R12 +OPEN_AGGREGATION OR + IMMI 0 R14 + JMPIFNOT R12 l185 + MOV R11 R14 + l185: PUSH R14 + PUSH R3 + CLEAR R14 R14 +CLOSE_AGGREGATION +POP R13 +POST R13 +JMP l183 +l184: JMP l181 +l182: IMMI 1 R14 +BUILTIN index_set R1 R14 +POP R15 +ITER_ARRAY R15 l187 +l186: ITER_NEXT R16 +ITER_NEXT R17 +ITER_RANGE R16 R17 l189 +l188: ITER_NEXT R18 +GET_ARRAY 1 R1 R18 R19 R20 +IMMI 1 R21 +NOT R20 R22 +JMPIF R22 l190 +OPEN_AGGREGATION OR + CALL FUN d_op_not_b 0 R19 + POP R23 + PUSH R23 + PUSH R3 + CLEAR R23 R23 +CLOSE_AGGREGATION +POP R21 +l190: POST R21 +JMP l188 +l189: JMP l186 +l187: CALL ROOT d_clause_d1b_d1b 1 R0 R5 +RET +:int_lin_eq:ROOT 3 +:f_max_dTi:FUN 1 +IMMI 0 R2 +BUILTIN array_Xd R0 R2 +POP R1 +BUILTIN infinity R2 +POP R3 +ITER_ARRAY R1 l176 +l175: ITER_NEXT R5 +LTI R3 R5 R4 +JMPIFNOT R4 l174 +MOV R5 R3 +l174: JMP l175 +l176: PUSH R3 +RET +:f_max_dTvi:FUN 1 +IMMI 0 R2 +BUILTIN array_Xd R0 R2 +POP R1 +LENGTH R0 R3 +IMMI 1 R4 +LEI R4 R3 R5 +CALL FUN f_max_t_d1vi 1 R1 +POP R6 +PUSH R6 +RET +:d_max_d1i:FUN 1 +ISPAR R0 R1 +JMPIF R1 l20 +JMP l21 +l20: TCALL FUN f_max_dTi 0 +l21: TCALL FUN f_max_dTvi 1 +:output_this:ROOT 1 +:f_lex_obj_i:ROOT 1 +LOAD_GLOBAL 6 R1 +LOAD_GLOBAL 7 R2 +OPEN_AGGREGATION VEC + PUSH R1 + PUSH R2 +CLOSE_AGGREGATION +POP R3 +CALL ROOT f_lex_minimize_d1vi_i 1 R3 R0 +RET +:f_op_times_i_i:FUN 2 +MULI R0 R1 R2 +PUSH R2 +RET +:f_op_times_i_vi:FUN 2 +IMMI 1 R2 +IMMI 1 R4 +EQI R0 R2 R5 +JMPIFNOT R5 l138 +IMMI 0 R4 +MOV R1 R3 +JMP l137 +l138: OPEN_AGGREGATION OTHER + BUILTIN infinite_domain + POP R6 + CALL ROOT mk_intvar 0 R6 + POP R7 + CALL ROOT int_times 1 R0 R1 R7 + PUSH R7 + CLEAR R6 R7 +CLOSE_AGGREGATION +POP R6 +IMMI 0 R4 +MOV R6 R3 +l137: PUSH R3 +RET +:f_op_times_vi_i:FUN 2 +CALL FUN d_op_times_i_i 0 R1 R0 +POP R2 +PUSH R2 +RET +:f_op_times_vi_vi:FUN 2 +OPEN_AGGREGATION OTHER + BUILTIN infinite_domain + POP R2 + CALL ROOT mk_intvar 0 R2 + POP R3 + CALL ROOT int_times 1 R0 R1 R3 + PUSH R3 + CLEAR R2 R3 +CLOSE_AGGREGATION +POP R2 +PUSH R2 +RET +:d_op_times_i_i:FUN 2 +ISPAR R0 R2 +JMPIF R2 l42 +JMP l43 +l42: ISPAR R1 R2 +JMPIF R2 l44 +JMP l45 +l43: ISPAR R1 R2 +JMPIF R2 l46 +JMP l47 +l44: TCALL FUN f_op_times_i_i 0 +l45: TCALL FUN f_op_times_i_vi 1 +l46: TCALL FUN f_op_times_vi_i 1 +l47: TCALL FUN f_op_times_vi_vi 1 +:f_sum_cc_dTvi:FUN 1 +OPEN_AGGREGATION OTHER + IMMI 0 R2 + BUILTIN array_Xd R0 R2 + POP R1 + BUILTIN infinite_domain + POP R3 + CALL ROOT mk_intvar 0 R3 + POP R4 + CALL ROOT int_sum 1 R1 R4 + PUSH R4 + CLEAR R1 R4 +CLOSE_AGGREGATION +POP R1 +PUSH R1 +RET +:f_pre_int_lin_eq_d1i_d1vi_i:ROOT 3 +LENGTH R0 R4 +IMMI 0 R5 +EQI R4 R5 R6 +JMPIFNOT R6 l136 +EQI R2 R5 R7 +MOV R7 R3 +JMP l135 +l136: CALL ROOT int_lin_eq 1 R0 R1 R2 +IMMI 1 R8 +MOV R8 R3 +l135: POST R3 +RET +:f_upper_bound_on_increments_vi_d1vi:ROOT 2 +IMMI 1 R2 +GET_ARRAY 1 R1 R2 R3 R4 +IMMI 2 R5 +LOAD_GLOBAL 1 R6 +OPEN_AGGREGATION VEC + PUSH R5 + PUSH R6 +CLOSE_AGGREGATION +POP R7 +OPEN_AGGREGATION VEC + ITER_ARRAY R7 l106 + l105: ITER_NEXT R8 + ITER_NEXT R9 + ITER_RANGE R8 R9 l108 + l107: ITER_NEXT R10 + GET_ARRAY 1 R1 R10 R11 R12 + SUBI R10 R2 R13 + GET_ARRAY 1 R1 R13 R14 R15 + CALL FUN d_op_minus_i_i 1 R11 R14 + POP R16 + IMMI 0 R17 + CALL FUN d_max_i_i 1 R16 R17 + POP R18 + PUSH R18 + JMP l107 + l108: JMP l105 + l106: CLEAR R8 R18 +CLOSE_AGGREGATION +POP R8 +LENGTH R8 R9 +JMPIFNOT R9 l118 +EQI R2 R9 R10 +JMPIF R10 l119 +CALL FUN f_sum_cc_dTvi 1 R8 +POP R10 +JMP l120 +l118: IMMI 0 R10 +JMP l120 +l119: GET_VEC R8 R2 R10 +l120: CALL FUN d_op_plus_i_i 1 R3 R10 +POP R11 +LB R11 R12 +UB R0 R13 +LEI R12 R13 R12 +SIMPLIFY_LIN R11 R0 0 R14 R15 R16 +POST R4 +POST R12 +CALL ROOT f_pre_int_lin_le_d1i_d1vi_i 1 R14 R15 R16 +RET +:solve_this:ROOT 5 +:f_op_minus_i_i:FUN 2 +SUBI R0 R1 R2 +PUSH R2 +RET +:f_op_minus_vi_i:FUN 2 +IMMI 1 R2 +IMMI 1 R4 +IMMI 0 R5 +EQI R1 R5 R6 +JMPIFNOT R6 l134 +IMMI 0 R4 +MOV R0 R3 +JMP l133 +l134: OPEN_AGGREGATION OTHER + BUILTIN infinite_domain + POP R7 + CALL ROOT mk_intvar 0 R7 + POP R8 + CALL ROOT int_minus 1 R0 R1 R8 + PUSH R8 + CLEAR R7 R8 +CLOSE_AGGREGATION +POP R7 +IMMI 0 R4 +MOV R7 R3 +l133: PUSH R3 +RET +:f_op_minus_vi_vi:FUN 2 +OPEN_AGGREGATION OTHER + BUILTIN infinite_domain + POP R2 + CALL ROOT mk_intvar 0 R2 + POP R3 + CALL ROOT int_minus 1 R0 R1 R3 + PUSH R3 + CLEAR R2 R3 +CLOSE_AGGREGATION +POP R2 +PUSH R2 +RET +:d_op_minus_i_i:FUN 2 +ISPAR R0 R2 +JMPIF R2 l109 +JMP l110 +l109: ISPAR R1 R2 +JMPIF R2 l111 +JMP l112 +l110: ISPAR R1 R2 +JMPIF R2 l113 +JMP l112 +l111: TCALL FUN f_op_minus_i_i 0 +l112: TCALL FUN f_op_minus_vi_vi 1 +l113: TCALL FUN f_op_minus_vi_i 1 +:f_max_t_t:FUN 2 +IMMI 1 R2 +IMMI 1 R4 +LTI R1 R0 R5 +JMPIFNOT R5 l132 +IMMI 0 R4 +MOV R0 R3 +JMP l131 +l132: IMMI 0 R4 +MOV R1 R3 +l131: PUSH R3 +RET +:f_max_vi_vi:FUN 2 +OPEN_AGGREGATION OTHER + LB R0 R2 + LB R1 R3 + CALL FUN d_max_i_i 0 R2 R3 + POP R4 + UB R0 R5 + UB R1 R6 + CALL FUN d_max_i_i 0 R5 R6 + POP R7 + OPEN_AGGREGATION VEC + PUSH R4 + PUSH R7 + CLOSE_AGGREGATION + POP R8 + CALL ROOT mk_intvar 0 R8 + POP R9 + CALL ROOT int_max 1 R0 R1 R9 + PUSH R9 + CLEAR R2 R9 +CLOSE_AGGREGATION +POP R2 +PUSH R2 +RET +:d_max_i_i:FUN 2 +ISPAR R0 R2 +JMPIF R2 l114 +JMP l115 +l114: ISPAR R1 R2 +JMPIF R2 l116 +JMP l117 +l115: JMP l117 +l116: TCALL FUN f_max_t_t 0 +l117: TCALL FUN f_max_vi_vi 1 +:f_op_plus_i_i:FUN 2 +ADDI R0 R1 R2 +PUSH R2 +RET +:f_op_plus_i_vi:FUN 2 +IMMI 1 R2 +IMMI 1 R4 +IMMI 0 R5 +EQI R0 R5 R6 +JMPIFNOT R6 l130 +IMMI 0 R4 +MOV R1 R3 +JMP l129 +l130: OPEN_AGGREGATION OTHER + BUILTIN infinite_domain + POP R7 + CALL ROOT mk_intvar 0 R7 + POP R8 + CALL ROOT int_plus 1 R0 R1 R8 + PUSH R8 + CLEAR R7 R8 +CLOSE_AGGREGATION +POP R7 +IMMI 0 R4 +MOV R7 R3 +l129: PUSH R3 +RET +:f_op_plus_vi_i:FUN 2 +CALL FUN d_op_plus_i_i 0 R1 R0 +POP R2 +PUSH R2 +RET +:f_op_plus_vi_vi:FUN 2 +OPEN_AGGREGATION OTHER + BUILTIN infinite_domain + POP R2 + CALL ROOT mk_intvar 0 R2 + POP R3 + CALL ROOT int_plus 1 R0 R1 R3 + PUSH R3 + CLEAR R2 R3 +CLOSE_AGGREGATION +POP R2 +PUSH R2 +RET +:d_op_plus_i_i:FUN 2 +ISPAR R0 R2 +JMPIF R2 l121 +JMP l122 +l121: ISPAR R1 R2 +JMPIF R2 l123 +JMP l124 +l122: ISPAR R1 R2 +JMPIF R2 l125 +JMP l126 +l123: TCALL FUN f_op_plus_i_i 0 +l124: TCALL FUN f_op_plus_i_vi 1 +l125: TCALL FUN f_op_plus_vi_i 1 +l126: TCALL FUN f_op_plus_vi_vi 1 +:f_pre_int_lin_le_d1i_d1vi_i:ROOT 3 +LENGTH R0 R4 +IMMI 0 R5 +EQI R4 R5 R6 +JMPIFNOT R6 l128 +LEI R5 R2 R7 +MOV R7 R3 +JMP l127 +l128: CALL ROOT int_lin_le 1 R0 R1 R2 +IMMI 1 R8 +MOV R8 R3 +l127: POST R3 +RET +:int_lin_le:ROOT 3 +:int_plus:ROOT 3 +:int_max:ROOT 3 +:int_minus:ROOT 3 +:int_sum:ROOT 2 +:int_times:ROOT 3 +:f_lex_minimize_d1vi_i:ROOT 2 +IMMI 1 R2 +BUILTIN index_set R0 R2 +POP R3 +CALL FUN d_min_si 0 R3 +POP R4 +SUBI R1 R2 R5 +OPEN_AGGREGATION VEC + PUSH R4 + PUSH R5 +CLOSE_AGGREGATION +POP R6 +ITER_ARRAY R6 l142 +l141: ITER_NEXT R7 +ITER_NEXT R8 +ITER_RANGE R7 R8 l144 +l143: ITER_NEXT R9 +GET_ARRAY 1 R0 R9 R10 R11 +BUILTIN sol R10 +POP R12 +DOM R10 R13 +DOM R12 R14 +INTERSECTION R13 R14 R13 +ISEMPTY R13 R14 +NOT R14 R14 +SIMPLIFY_LIN R10 R12 0 R16 R17 R15 +POST R11 +POST R14 +CALL ROOT f_pre_int_lin_eq_d1i_d1vi_i 1 R16 R17 R15 +JMP l143 +l144: JMP l141 +l142: GET_ARRAY 1 R0 R1 R18 R19 +BUILTIN sol R18 +POP R20 +LB R18 R21 +UB R20 R22 +LTI R21 R22 R21 +SIMPLIFY_LIN R18 R20 1 R23 R24 R25 +POST R19 +POST R21 +CALL ROOT f_pre_int_lin_le_d1i_d1vi_i 1 R23 R24 R25 +RET +:f_min_si:FUN 1 +LENGTH R0 R2 +IMMI 1 R3 +LEI R3 R2 R1 +JMPIF R1 l162 +ABORT +l162: GET_VEC R0 R3 R1 +PUSH R1 +RET +:f_min_dTvi:FUN 1 +IMMI 0 R2 +BUILTIN array_Xd R0 R2 +POP R1 +LENGTH R0 R3 +IMMI 1 R4 +LEI R4 R3 R5 +CALL FUN f_min_t_d1vi 1 R1 +POP R6 +PUSH R6 +RET +:d_min_si:FUN 1 +ISPAR R0 R1 +JMPIF R1 l139 +JMP l140 +l139: TCALL FUN f_min_si 0 +l140: TCALL FUN f_min_dTvi 1 +:f_min_t_d1vi:FUN 1 +IMMI 1 R1 +IMMI 1 R3 +LENGTH R0 R4 +IMMI 0 R5 +EQI R4 R5 R6 +JMPIFNOT R6 l146 +IMMI 0 R3 +MOV R5 R2 +JMP l145 +l146: EQI R4 R1 R7 +JMPIFNOT R7 l147 +GET_ARRAY 1 R0 R1 R8 R9 +MOV R9 R3 +MOV R8 R2 +JMP l145 +l147: IMMI 2 R10 +EQI R4 R10 R11 +JMPIFNOT R11 l148 +GET_ARRAY 1 R0 R1 R12 R13 +GET_ARRAY 1 R0 R10 R14 R15 +CALL FUN d_min_i_i 1 R12 R14 +POP R16 +IMMI 0 R17 +JMPIFNOT R13 l153 +MOV R15 R17 +l153: MOV R17 R3 +MOV R16 R2 +JMP l145 +l148: OPEN_AGGREGATION OTHER + BUILTIN infinity R1 + POP R18 + ITER_ARRAY R0 l156 + l155: ITER_NEXT R21 + LB R21 R19 + LTI R19 R18 R20 + JMPIFNOT R20 l154 + MOV R19 R18 + l154: JMP l155 + l156: BUILTIN infinity R5 + POP R22 + ITER_ARRAY R0 l159 + l158: ITER_NEXT R25 + UB R25 R23 + LTI R22 R23 R24 + JMPIFNOT R24 l157 + MOV R23 R22 + l157: JMP l158 + l159: OPEN_AGGREGATION VEC + PUSH R18 + PUSH R22 + CLOSE_AGGREGATION + POP R26 + CALL ROOT mk_intvar 0 R26 + POP R27 + CALL ROOT array_int_minimum 1 R27 R0 + PUSH R27 + CLEAR R18 R27 +CLOSE_AGGREGATION +POP R18 +IMMI 0 R3 +MOV R18 R2 +l145: PUSH R2 +RET +:f_min_t_t:FUN 2 +IMMI 1 R2 +IMMI 1 R4 +LTI R0 R1 R5 +JMPIFNOT R5 l161 +IMMI 0 R4 +MOV R0 R3 +JMP l160 +l161: IMMI 0 R4 +MOV R1 R3 +l160: PUSH R3 +RET +:f_min_vi_vi:FUN 2 +OPEN_AGGREGATION OTHER + LB R0 R2 + LB R1 R3 + CALL FUN d_min_i_i 0 R2 R3 + POP R4 + UB R0 R5 + UB R1 R6 + CALL FUN d_min_i_i 0 R5 R6 + POP R7 + OPEN_AGGREGATION VEC + PUSH R4 + PUSH R7 + CLOSE_AGGREGATION + POP R8 + CALL ROOT mk_intvar 0 R8 + POP R9 + CALL ROOT int_min 1 R0 R1 R9 + PUSH R9 + CLEAR R2 R9 +CLOSE_AGGREGATION +POP R2 +PUSH R2 +RET +:d_min_i_i:FUN 2 +ISPAR R0 R2 +JMPIF R2 l149 +JMP l150 +l149: ISPAR R1 R2 +JMPIF R2 l151 +JMP l152 +l150: JMP l152 +l151: TCALL FUN f_min_t_t 0 +l152: TCALL FUN f_min_vi_vi 1 +:array_int_minimum:ROOT 2 +:int_min:ROOT 3 +:f_max_t_d1vi:FUN 1 +IMMI 1 R1 +IMMI 1 R3 +LENGTH R0 R4 +IMMI 0 R5 +EQI R4 R5 R6 +JMPIFNOT R6 l164 +IMMI 0 R3 +MOV R5 R2 +JMP l163 +l164: EQI R4 R1 R7 +JMPIFNOT R7 l165 +BUILTIN index_set R0 R1 +POP R8 +CALL FUN d_min_si 0 R8 +POP R9 +GET_ARRAY 1 R0 R9 R10 R11 +MOV R11 R3 +MOV R10 R2 +JMP l163 +l165: IMMI 2 R12 +EQI R4 R12 R13 +JMPIFNOT R13 l166 +GET_ARRAY 1 R0 R1 R14 R15 +GET_ARRAY 1 R0 R12 R16 R17 +CALL FUN d_max_i_i 0 R14 R16 +POP R18 +IMMI 0 R19 +JMPIFNOT R15 l167 +MOV R17 R19 +l167: MOV R19 R3 +MOV R18 R2 +JMP l163 +l166: OPEN_AGGREGATION OTHER + BUILTIN infinity R1 + POP R20 + ITER_ARRAY R0 l170 + l169: ITER_NEXT R23 + LB R23 R21 + LTI R21 R20 R22 + JMPIFNOT R22 l168 + MOV R21 R20 + l168: JMP l169 + l170: BUILTIN infinity R5 + POP R24 + ITER_ARRAY R0 l173 + l172: ITER_NEXT R27 + UB R27 R25 + LTI R24 R25 R26 + JMPIFNOT R26 l171 + MOV R25 R24 + l171: JMP l172 + l173: OPEN_AGGREGATION VEC + PUSH R20 + PUSH R24 + CLOSE_AGGREGATION + POP R28 + CALL ROOT mk_intvar 0 R28 + POP R29 + CALL ROOT array_int_maximum 1 R29 R0 + PUSH R29 + CLEAR R20 R29 +CLOSE_AGGREGATION +POP R20 +IMMI 0 R3 +MOV R20 R2 +l163: PUSH R2 +RET +:array_int_maximum:ROOT 2 +:clause:ROOT 2 +:clause:ROOT 2 +:d_clause_d1b_d1b:ROOT 2 +ISPAR R0 R2 +JMPIF R2 l191 +JMP l192 +l191: ISPAR R1 R2 +JMPIF R2 l193 +JMP l194 +l192: JMP l194 +l193: TCALL ROOT clause 1 +l194: TCALL ROOT clause 1 +:bool_not:ROOT 2 +:main:ROOT 0 +OPEN_AGGREGATION OTHER + IMMI 1 R0 + LOAD_GLOBAL 0 R1 + OPEN_AGGREGATION VEC + PUSH R0 + PUSH R1 + CLOSE_AGGREGATION + POP R2 + STORE_GLOBAL R2 3 + LOAD_GLOBAL 1 R3 + OPEN_AGGREGATION VEC + PUSH R0 + PUSH R3 + CLOSE_AGGREGATION + POP R4 + STORE_GLOBAL R4 4 + OPEN_AGGREGATION VEC + ITER_ARRAY R2 l3 + l2: ITER_NEXT R5 + ITER_NEXT R6 + ITER_RANGE R5 R6 l5 + l4: ITER_NEXT R7 + ITER_ARRAY R4 l7 + l6: ITER_NEXT R8 + ITER_NEXT R9 + ITER_RANGE R8 R9 l9 + l8: ITER_NEXT R10 + LOAD_GLOBAL 2 R11 + GET_ARRAY 2 R11 R7 R10 R12 R13 + PUSH R12 + JMP l8 + l9: JMP l6 + l7: JMP l4 + l5: JMP l2 + l3: CLEAR R5 R13 + CLOSE_AGGREGATION + POP R5 + IMMI 0 R6 + ITER_ARRAY R5 l11 + l10: ITER_NEXT R7 + ADDI R6 R7 R6 + JMP l10 + l11: STORE_GLOBAL R6 5 + IMMI 0 R8 + OPEN_AGGREGATION VEC + PUSH R8 + PUSH R6 + CLOSE_AGGREGATION + POP R9 + CALL ROOT mk_intvar 0 R9 + POP R10 + STORE_GLOBAL R10 6 + MULI R1 R3 R11 + OPEN_AGGREGATION VEC + PUSH R8 + PUSH R11 + CLOSE_AGGREGATION + POP R12 + CALL ROOT mk_intvar 0 R12 + POP R13 + STORE_GLOBAL R13 7 + OPEN_AGGREGATION VEC + ITER_ARRAY R2 l13 + l12: ITER_NEXT R14 + ITER_NEXT R15 + ITER_RANGE R14 R15 l15 + l14: ITER_NEXT R16 + ITER_ARRAY R4 l17 + l16: ITER_NEXT R17 + ITER_NEXT R18 + ITER_RANGE R17 R18 l19 + l18: ITER_NEXT R19 + LOAD_GLOBAL 2 R20 + GET_ARRAY 2 R20 R16 R19 R21 R22 + PUSH R21 + JMP l18 + l19: JMP l16 + l17: JMP l14 + l15: JMP l12 + l13: CLEAR R14 R22 + CLOSE_AGGREGATION + POP R14 + CALL FUN d_max_d1i 0 R14 + POP R15 + STORE_GLOBAL R15 8 + OPEN_AGGREGATION VEC + PUSH R0 + PUSH R15 + CLOSE_AGGREGATION + POP R16 + STORE_GLOBAL R16 9 + OPEN_AGGREGATION VEC + ITER_ARRAY R2 l23 + l22: ITER_NEXT R19 + ITER_NEXT R20 + ITER_RANGE R19 R20 l25 + l24: ITER_NEXT R21 + ITER_ARRAY R4 l27 + l26: ITER_NEXT R22 + ITER_NEXT R23 + ITER_RANGE R22 R23 l29 + l28: ITER_NEXT R24 + ITER_ARRAY R16 l31 + l30: ITER_NEXT R25 + ITER_NEXT R26 + ITER_RANGE R25 R26 l33 + l32: ITER_NEXT R27 + CALL ROOT mk_intvar 0 R12 + JMP l32 + l33: JMP l30 + l31: JMP l28 + l29: JMP l26 + l27: JMP l24 + l25: JMP l22 + l23: CLEAR R19 R27 + CLOSE_AGGREGATION + POP R17 + OPEN_AGGREGATION VEC + GET_VEC R2 R0 R18 + PUSH R18 + IMMI 2 R19 + GET_VEC R2 R19 R18 + PUSH R18 + GET_VEC R4 R0 R18 + PUSH R18 + GET_VEC R4 R19 R18 + PUSH R18 + GET_VEC R16 R0 R18 + PUSH R18 + GET_VEC R16 R19 R18 + PUSH R18 + CLEAR R19 R19 + CLOSE_AGGREGATION + POP R18 + BUILTIN array_Xd R17 R18 + POP R17 + STORE_GLOBAL R17 10 + OPEN_AGGREGATION VEC + ITER_ARRAY R16 l35 + l34: ITER_NEXT R21 + ITER_NEXT R22 + ITER_RANGE R21 R22 l37 + l36: ITER_NEXT R23 + CALL ROOT mk_intvar 0 R12 + JMP l36 + l37: JMP l34 + l35: CLEAR R21 R23 +CLOSE_AGGREGATION +POP R19 +OPEN_AGGREGATION VEC + GET_VEC R16 R0 R20 + PUSH R20 + IMMI 2 R21 + GET_VEC R16 R21 R20 + PUSH R20 + CLEAR R21 R21 +CLOSE_AGGREGATION +POP R20 +BUILTIN array_Xd R19 R20 +POP R19 +STORE_GLOBAL R19 11 +OPEN_AGGREGATION VEC + PUSH R10 + PUSH R13 +CLOSE_AGGREGATION +POP R21 +CALL ROOT output_this 1 R21 +OPEN_AGGREGATION VEC + ITER_ARRAY R16 l39 + l38: ITER_NEXT R22 + ITER_NEXT R23 + ITER_RANGE R22 R23 l41 + l40: ITER_NEXT R24 + GET_ARRAY 1 R19 R24 R25 R26 + CALL FUN d_op_times_i_i 1 R24 R25 + POP R27 + PUSH R27 + JMP l40 + l41: JMP l38 + l39: CLEAR R22 R27 +CLOSE_AGGREGATION +POP R22 +LENGTH R22 R23 +JMPIFNOT R23 l48 +EQI R0 R23 R24 +JMPIF R24 l49 +CALL FUN f_sum_cc_dTvi 1 R22 +POP R24 +JMP l50 +l48: IMMI 0 R24 +JMP l50 +l49: GET_VEC R22 R0 R24 +l50: DOM R10 R25 +DOM R24 R26 +INTERSECTION R25 R26 R25 +ISEMPTY R25 R26 +NOT R26 R26 +SIMPLIFY_LIN R10 R24 0 R28 R29 R27 +OPEN_AGGREGATION VEC + ITER_ARRAY R16 l52 + l51: ITER_NEXT R30 + ITER_NEXT R31 + ITER_RANGE R30 R31 l54 + l53: ITER_NEXT R32 + GET_ARRAY 1 R19 R32 R33 R34 + PUSH R33 + JMP l53 + l54: JMP l51 + l52: CLEAR R30 R34 +CLOSE_AGGREGATION +POP R30 +LENGTH R30 R31 +JMPIFNOT R31 l55 +EQI R0 R31 R32 +JMPIF R32 l56 +CALL FUN f_sum_cc_dTvi 1 R30 +POP R32 +JMP l57 +l55: IMMI 0 R32 +JMP l57 +l56: GET_VEC R30 R0 R32 +l57: DOM R13 R33 +DOM R32 R34 +INTERSECTION R33 R34 R33 +ISEMPTY R33 R34 +NOT R34 R34 +SIMPLIFY_LIN R13 R32 0 R36 R37 R35 +ITER_ARRAY R2 l59 +l58: ITER_NEXT R38 +ITER_NEXT R39 +ITER_RANGE R38 R39 l61 +l60: ITER_NEXT R40 +ITER_ARRAY R4 l63 +l62: ITER_NEXT R41 +ITER_NEXT R42 +ITER_RANGE R41 R42 l65 +l64: ITER_NEXT R43 +LOAD_GLOBAL 2 R44 +GET_ARRAY 2 R44 R40 R43 R45 R46 +OPEN_AGGREGATION VEC + ITER_ARRAY R16 l67 + l66: ITER_NEXT R47 + ITER_NEXT R48 + ITER_RANGE R47 R48 l69 + l68: ITER_NEXT R49 + GET_ARRAY 3 R17 R40 R43 R49 R50 R51 + CALL FUN d_op_times_i_i 0 R49 R50 + POP R52 + PUSH R52 + JMP l68 + l69: JMP l66 + l67: CLEAR R47 R52 +CLOSE_AGGREGATION +POP R47 +LENGTH R47 R48 +JMPIFNOT R48 l70 +EQI R0 R48 R49 +JMPIF R49 l71 +CALL FUN f_sum_cc_dTvi 1 R47 +POP R49 +JMP l72 +l70: IMMI 0 R49 +JMP l72 +l71: GET_VEC R47 R0 R49 +l72: DOM R45 R50 +DOM R49 R51 +INTERSECTION R50 R51 R50 +ISEMPTY R50 R51 +NOT R51 R51 +SIMPLIFY_LIN R45 R49 0 R53 R54 R52 +POST R46 +POST R51 +CALL ROOT f_pre_int_lin_eq_d1i_d1vi_i 1 R53 R54 R52 +JMP l64 +l65: JMP l62 +l63: JMP l60 +l61: JMP l58 +l59: ITER_ARRAY R2 l74 +l73: ITER_NEXT R55 +ITER_NEXT R56 +ITER_RANGE R55 R56 l76 +l75: ITER_NEXT R57 +ITER_ARRAY R16 l78 +l77: ITER_NEXT R58 +ITER_NEXT R59 +ITER_RANGE R58 R59 l80 +l79: ITER_NEXT R60 +GET_ARRAY 1 R19 R60 R61 R62 +OPEN_AGGREGATION VEC + ITER_ARRAY R4 l82 + l81: ITER_NEXT R63 + ITER_NEXT R64 + ITER_RANGE R63 R64 l84 + l83: ITER_NEXT R65 + GET_ARRAY 3 R17 R57 R65 R60 R66 R67 + PUSH R66 + JMP l83 + l84: JMP l81 + l82: CLEAR R63 R67 +CLOSE_AGGREGATION +POP R63 +POST R62 +CALL ROOT f_upper_bound_on_increments_vi_d1vi 1 R61 R63 +JMP l79 +l80: JMP l77 +l78: JMP l75 +l76: JMP l73 +l74: POST R26 +CALL ROOT f_pre_int_lin_eq_d1i_d1vi_i 1 R28 R29 R27 +POST R34 +CALL ROOT f_pre_int_lin_eq_d1i_d1vi_i 1 R36 R37 R35 +OPEN_AGGREGATION VEC + PUSH R10 +CLOSE_AGGREGATION +POP R64 +OPEN_AGGREGATION VEC + ITER_ARRAY R64 l86 + l85: ITER_NEXT R66 + PUSH R66 + JMP l85 + l86: ITER_ARRAY R19 l88 + l87: ITER_NEXT R67 + PUSH R67 + JMP l87 + l88: CLEAR R66 R67 +CLOSE_AGGREGATION +POP R65 +OPEN_AGGREGATION VEC + ITER_ARRAY R2 l90 + l89: ITER_NEXT R66 + ITER_NEXT R67 + ITER_RANGE R66 R67 l92 + l91: ITER_NEXT R68 + ITER_ARRAY R4 l94 + l93: ITER_NEXT R69 + ITER_NEXT R70 + ITER_RANGE R69 R70 l96 + l95: ITER_NEXT R71 + ITER_ARRAY R16 l98 + l97: ITER_NEXT R72 + ITER_NEXT R73 + ITER_RANGE R72 R73 l100 + l99: ITER_NEXT R74 + GET_ARRAY 3 R17 R68 R71 R74 R75 R76 + PUSH R75 + JMP l99 + l100: JMP l97 + l98: JMP l95 + l96: JMP l93 + l94: JMP l91 + l92: JMP l89 + l90: CLEAR R66 R76 +CLOSE_AGGREGATION +POP R66 +OPEN_AGGREGATION VEC + ITER_ARRAY R65 l102 + l101: ITER_NEXT R68 + PUSH R68 + JMP l101 + l102: ITER_ARRAY R66 l104 + l103: ITER_NEXT R69 + PUSH R69 + JMP l103 + l104: CLEAR R68 R69 +CLOSE_AGGREGATION +POP R67 +CALL ROOT solve_this 1 R8 R8 R67 R0 R0 +CLEAR R0 R67 +RET diff --git a/radiation/radiation.mzn b/radiation/radiation.mzn new file mode 100644 index 0000000..aaacec1 --- /dev/null +++ b/radiation/radiation.mzn @@ -0,0 +1,77 @@ +%-----------------------------------------------------------------------------% +% Radiation problem, MiniZinc 2.0.4 version +% +%-----------------------------------------------------------------------------% + +%-----------------------------------------------------------------------------% +% Parameters +%-----------------------------------------------------------------------------% + +int: m; % Rows +int: n; % Columns + +set of int: Rows = 1..m; +set of int: Columns = 1..n; + + % Intensity matrix +array[Rows, Columns] of int: Intensity; + + +set of int: BTimes = 1..Bt_max; + +int: Bt_max = max(i in Rows, j in Columns) (Intensity[i,j]); +int: Ints_sum = sum(i in Rows, j in Columns) (Intensity[i,j]); + +%-----------------------------------------------------------------------------% +% Variables +%-----------------------------------------------------------------------------% + + % Total beam-on time +var 0..Ints_sum: Beamtime; + + % Number of shape matrices +var 0..m*n: K; + + % N[b] is the number of shape matrices with associated beam-on time b +array[BTimes] of var 0..m*n: N; + + % Q[i,j,b] is the number of shape matrices with associated beam-on time + % b that expose cell (i,j) +array[Rows, Columns, BTimes] of var 0..m*n: Q; + +%-----------------------------------------------------------------------------% +% Constraints +%-----------------------------------------------------------------------------% + + % For FD/LP hybrid solving, all these should go the LP solver + % (with a suitable linearisation of the 'max' expressions). +constraint + Beamtime = sum(b in BTimes) (b * N[b]) + /\ + K = sum(b in BTimes) (N[b]) + /\ + forall(i in Rows, j in Columns) + ( Intensity[i,j] = sum([b * Q[i,j,b] | b in BTimes]) ) + /\ + forall(i in Rows, b in BTimes) + ( upper_bound_on_increments(N[b], [Q[i,j,b] | j in Columns]) ); + + +predicate upper_bound_on_increments(var int: N_b, array[int] of var int: L) = + N_b >= L[1] + sum([ max(L[j] - L[j-1], 0) | j in 2..n ]); + % + % Good linear version: + % let { array[min(index_set(L))..max(index_set(L))] of var int: S } in + % N_b >= L[1] + sum([ S[j] | j in 2..n ]) /\ + % forall([ S[j] >= L[j] - L[j-1] /\ S[j] >= 0 | j in 2..n ]); + + +%-----------------------------------------------------------------------------% +output [ + "Beamtime = \(Beamtime);\n", + "K = \(K);\n", + "N = \(N);\n", + "Q = array3d(\(Rows), \(Columns), \(BTimes), \(Q));\n" +]; + +%-----------------------------------------------------------------------------% diff --git a/scatterplot.py b/scatterplot.py new file mode 100644 index 0000000..c66ef38 --- /dev/null +++ b/scatterplot.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python3 +import sys + +import numpy as np +import seaborn as sns +import matplotlib.pyplot as plt +import pandas as pd +import matplotlib as mpl + +if __name__ == "__main__": + data = pd.read_csv(sys.argv[1]) + + sns.set(font_scale=1.24, style="whitegrid", font="IBM Plex Sans") + fig, ax = plt.subplots() + + plot = sns.scatterplot( + data=data, + x="Compile Time (s)", + y="Solve Time (s)", + hue="Configuration", + style="Configuration", + legend="gbac" in sys.argv[1], + ) + + if "radiation" in sys.argv[1]: + ax.set_xlim(0, 0.5) + ax.set_ylim(0, 0.5) + elif "gbac" in sys.argv[1]: + handles, labels = ax.get_legend_handles_labels() + ax.legend(handles=handles, labels=labels) + plot.legend(bbox_to_anchor=(0.23, 0.95), loc="upper left", borderaxespad=0) + ax.set_xlim(0, 30) + ax.set_ylim(0, 30) + + plot.figure.savefig("output.pdf", bbox_inches="tight")