CSE505/Assignment2/C/cut.lp
2024-03-09 16:25:30 -05:00

67 lines
1002 B
Plaintext

#const max = 10.
#const size = 30.
order(1, size).
order(2, size).
order(3, size).
order(4, size).
width(1).
width(2).
width(3).
width(4).
pattern(1, 1, 0).
pattern(1, 2, 1).
pattern(1, 3, 0).
pattern(1, 4, 3).
pattern(2, 1, 1).
pattern(2, 2, 0).
pattern(2, 3, 1).
pattern(2, 4, 2).
pattern(3, 1, 1).
pattern(3, 2, 2).
pattern(3, 3, 0).
pattern(3, 4, 2).
pattern(4, 1, 0).
pattern(4, 2, 1).
pattern(4, 3, 2).
pattern(4, 4, 1).
pattern(5, 1, 3).
pattern(5, 2, 1).
pattern(5, 3, 1).
pattern(5, 4, 1).
pattern(6, 1, 2).
pattern(6, 2, 4).
pattern(6, 3, 0).
pattern(6, 4, 1).
pattern(7, 1, 0).
pattern(7, 2, 6).
pattern(7, 3, 1).
pattern(7, 4, 0).
pattern(8, 1, 1).
pattern(8, 2, 5).
pattern(8, 3, 1).
pattern(8, 4, 0).
pattern(9, 1, 4).
pattern(9, 2, 2).
pattern(9, 3, 1).
pattern(9, 4, 0).
1 { cut(I, 0..max) } 1:- pattern(I, _, _).
:- order(W, L), #sum { J * K: pattern(I, W, J), cut(I, K)} < L.
total(N) :- N = #sum {J, I : cut(I, J)}.
#minimize {N: total(N)}.
#show cut/2.
#show total/1.