From 5e3c2fe8a5fec84f6d480da9511441168aea8dad Mon Sep 17 00:00:00 2001 From: bozokopic Date: Tue, 10 Apr 2018 15:50:59 +0200 Subject: playground - test csp --- playground/csp/main.py | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 playground/csp/main.py (limited to 'playground') diff --git a/playground/csp/main.py b/playground/csp/main.py new file mode 100644 index 0000000..d08f748 --- /dev/null +++ b/playground/csp/main.py @@ -0,0 +1,39 @@ +import sys +sys.path += ['../../src_py'] + +from opcut import csp + + +def main(): + panels = [ + csp.Panel(id='p1', width=100, height=100) + ] + items = [ + csp.Item(id='i1', width=10, height=10, rotate=True), + csp.Item(id='i2', width=10, height=9, rotate=True), + csp.Item(id='i3', width=20, height=8, rotate=True), + csp.Item(id='i4', width=10, height=20, rotate=True), + csp.Item(id='i5', width=30, height=19, rotate=True), + csp.Item(id='i6', width=10, height=18, rotate=True), + csp.Item(id='i7', width=10, height=17, rotate=True), + csp.Item(id='i8', width=20, height=16, rotate=True), + csp.Item(id='i9', width=10, height=15, rotate=True), + csp.Item(id='i10', width=30, height=14, rotate=True), + csp.Item(id='i11', width=10, height=20, rotate=True), + csp.Item(id='i12', width=30, height=19, rotate=True), + csp.Item(id='i13', width=10, height=18, rotate=True), + csp.Item(id='i14', width=10, height=17, rotate=True), + csp.Item(id='i15', width=20, height=16, rotate=True), + csp.Item(id='i16', width=10, height=15, rotate=True), + csp.Item(id='i17', width=30, height=14, rotate=True), + csp.Item(id='i18', width=10, height=20, rotate=True), + csp.Item(id='i19', width=30, height=19, rotate=True), + ] + cut_width = 1 + method = csp.Method.FORWARD_GREEDY + result = csp.calculate(panels, items, cut_width, method) + print(result) + + +if __name__ == '__main__': + sys.exit(main()) -- cgit v1.2.3-70-g09d2