Skip to content

Commit

Permalink
test cases pass
Browse files Browse the repository at this point in the history
  • Loading branch information
0xtimmy committed Feb 21, 2024
1 parent bbaa2d7 commit 0d17d3a
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 20 deletions.
22 changes: 22 additions & 0 deletions gibbon-compiler/solve_ilp_-34.py
Original file line number Diff line number Diff line change
@@ -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)))
22 changes: 22 additions & 0 deletions gibbon-compiler/solve_ilp_-49.py
Original file line number Diff line number Diff line change
@@ -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)))
22 changes: 22 additions & 0 deletions gibbon-compiler/solve_ilp_14.py
Original file line number Diff line number Diff line change
@@ -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)))
20 changes: 0 additions & 20 deletions gibbon-compiler/tests/test-gibbon-examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: []

0 comments on commit 0d17d3a

Please sign in to comment.