From 0d17d3a55896ea439202010107270273a388b3ee Mon Sep 17 00:00:00 2001 From: timmy Date: Wed, 21 Feb 2024 02:47:47 -0500 Subject: [PATCH] test cases pass --- gibbon-compiler/solve_ilp_-34.py | 22 +++++++++++++++++++ gibbon-compiler/solve_ilp_-49.py | 22 +++++++++++++++++++ gibbon-compiler/solve_ilp_14.py | 22 +++++++++++++++++++ .../tests/test-gibbon-examples.yaml | 20 ----------------- 4 files changed, 66 insertions(+), 20 deletions(-) create mode 100644 gibbon-compiler/solve_ilp_-34.py create mode 100644 gibbon-compiler/solve_ilp_-49.py create mode 100644 gibbon-compiler/solve_ilp_14.py diff --git a/gibbon-compiler/solve_ilp_-34.py b/gibbon-compiler/solve_ilp_-34.py new file mode 100644 index 00000000..25e74d77 --- /dev/null +++ b/gibbon-compiler/solve_ilp_-34.py @@ -0,0 +1,22 @@ +from docplex.mp.model import Model +model_2 = Model() +x_00 = model_2.integer_var(lb=0, ub=1, name="x_00") +x_11 = model_2.integer_var(lb=0, ub=1, name="x_11") +cost3 = model_2.integer_var(name="cost3") +x_minus_y11 = (x_00 - x_11) +cost5 = (x_minus_y11 == -1) +cost6 = (x_minus_y11 <= -1) +cost7 = (x_minus_y11 == 1) +cost8 = (x_minus_y11 >= 1) +cost9 = (x_minus_y11 != -1) +cost10 = (x_minus_y11 != 1) +model_2.add(cost5 <= (cost3 == 0)) +model_2.add((cost6 & cost9) <= (cost3 == 100)) +model_2.add(cost7 <= (cost3 == 200)) +model_2.add((cost8 & cost10) <= (cost3 == 300)) +min4 = cost3 * 50 +model_2.add(x_00 != x_11) +model_2.minimize(min4 + 0) +soln12 = model_2.solve() +print("({},{})".format(0, soln12.get_value(x_00))) +print("({},{})".format(1, soln12.get_value(x_11))) \ No newline at end of file diff --git a/gibbon-compiler/solve_ilp_-49.py b/gibbon-compiler/solve_ilp_-49.py new file mode 100644 index 00000000..25e74d77 --- /dev/null +++ b/gibbon-compiler/solve_ilp_-49.py @@ -0,0 +1,22 @@ +from docplex.mp.model import Model +model_2 = Model() +x_00 = model_2.integer_var(lb=0, ub=1, name="x_00") +x_11 = model_2.integer_var(lb=0, ub=1, name="x_11") +cost3 = model_2.integer_var(name="cost3") +x_minus_y11 = (x_00 - x_11) +cost5 = (x_minus_y11 == -1) +cost6 = (x_minus_y11 <= -1) +cost7 = (x_minus_y11 == 1) +cost8 = (x_minus_y11 >= 1) +cost9 = (x_minus_y11 != -1) +cost10 = (x_minus_y11 != 1) +model_2.add(cost5 <= (cost3 == 0)) +model_2.add((cost6 & cost9) <= (cost3 == 100)) +model_2.add(cost7 <= (cost3 == 200)) +model_2.add((cost8 & cost10) <= (cost3 == 300)) +min4 = cost3 * 50 +model_2.add(x_00 != x_11) +model_2.minimize(min4 + 0) +soln12 = model_2.solve() +print("({},{})".format(0, soln12.get_value(x_00))) +print("({},{})".format(1, soln12.get_value(x_11))) \ No newline at end of file diff --git a/gibbon-compiler/solve_ilp_14.py b/gibbon-compiler/solve_ilp_14.py new file mode 100644 index 00000000..25e74d77 --- /dev/null +++ b/gibbon-compiler/solve_ilp_14.py @@ -0,0 +1,22 @@ +from docplex.mp.model import Model +model_2 = Model() +x_00 = model_2.integer_var(lb=0, ub=1, name="x_00") +x_11 = model_2.integer_var(lb=0, ub=1, name="x_11") +cost3 = model_2.integer_var(name="cost3") +x_minus_y11 = (x_00 - x_11) +cost5 = (x_minus_y11 == -1) +cost6 = (x_minus_y11 <= -1) +cost7 = (x_minus_y11 == 1) +cost8 = (x_minus_y11 >= 1) +cost9 = (x_minus_y11 != -1) +cost10 = (x_minus_y11 != 1) +model_2.add(cost5 <= (cost3 == 0)) +model_2.add((cost6 & cost9) <= (cost3 == 100)) +model_2.add(cost7 <= (cost3 == 200)) +model_2.add((cost8 & cost10) <= (cost3 == 300)) +min4 = cost3 * 50 +model_2.add(x_00 != x_11) +model_2.minimize(min4 + 0) +soln12 = model_2.solve() +print("({},{})".format(0, soln12.get_value(x_00))) +print("({},{})".format(1, soln12.get_value(x_11))) \ No newline at end of file diff --git a/gibbon-compiler/tests/test-gibbon-examples.yaml b/gibbon-compiler/tests/test-gibbon-examples.yaml index f2df09f1..8d3a234d 100644 --- a/gibbon-compiler/tests/test-gibbon-examples.yaml +++ b/gibbon-compiler/tests/test-gibbon-examples.yaml @@ -911,23 +911,3 @@ tests: failing: [] run-modes: ["gibbon2", "gibbon3", "pointer"] - - name: layout1ContentSearchRunPipeline.hs - test-flags: ["--no-gc", "--opt-layout-local", "--opt-layout-use-solver"] - dir: examples/layout_bench - answer-file: examples/layout_bench/layout1ContentSearchRunPipeline.ans - failing: [interp1,pointer,gibbon1, gibbon3] - run-modes: [] - - - name: manyFuncs.hs - test-flags: ["--no-gc", "--opt-layout-local", "--opt-layout-use-solver"] - dir: examples/layout_bench - answer-file: examples/layout_bench/manyFuncsLocal.ans - failing: [interp1,pointer,gibbon1, gibbon3, gibbon2] - run-modes: [] - - - name: manyFuncs.hs - test-flags: ["--no-gc", "--opt-layout-global", "--opt-layout-use-solver"] - dir: examples/layout_bench - answer-file: examples/layout_bench/manyFuncsGlobal.ans - failing: [interp1,pointer,gibbon1, gibbon3, gibbon2] - run-modes: []