edits
[satune.git] / src / pycsolver.py
1 from ctypes import *
2
3 class LogicOps:
4         SATC_AND=0
5         SATC_OR=1
6         SATC_NOT=2
7         SATC_XOR=3
8         SATC_IFF=4
9         SATC_IMPLIES=5
10
11 class CompOp:
12         SATC_EQUALS = 0
13         SATC_LT=1
14         SATC_GT=2
15         SATC_LTE=3
16         SATC_GTE=4
17
18 def loadCSolver():
19         csolverlb = cdll.LoadLibrary("lib_cons_comp.so")
20         csolverlb.createCCSolver.restype = c_void_p
21         csolverlb.createSet.argtypes = [c_void_p, c_uint, POINTER(c_long), c_uint]
22         csolverlb.createSet.restype = c_void_p
23         csolverlb.getElementVar.argtypes = [c_void_p, c_void_p]
24         csolverlb.getElementVar.restype = c_void_p
25         csolverlb.createPredicateOperator.argtypes = [c_void_p, c_uint, POINTER(c_void_p), c_uint]
26         csolverlb.createPredicateOperator.restype = c_void_p
27         csolverlb.applyPredicate.argtypes = [c_void_p, c_void_p, POINTER(c_void_p), c_uint]
28         csolverlb.applyPredicate.restype = c_void_p
29         csolverlb.addConstraint.argtypes = [c_void_p, c_void_p]
30         csolverlb.addConstraint.restype = None
31         csolverlb.solve.argtypes = [c_void_p]
32         csolverlb.solve.restype = c_int
33         csolverlb.getElementValue.argtypes = [c_void_p, c_void_p]
34         csolverlb.getElementValue.restype = c_long
35         csolverlb.deleteCCSolver.argtypes = [c_void_p]
36         csolverlb.deleteCCSolver.restype = None
37         csolverlb.createRangeSet.argtypes = [c_void_p, c_uint, c_long, c_long]
38         csolverlb.createRangeSet.restype = c_void_p
39         csolverlb.createRangeVar.argtypes = [c_void_p, c_uint, c_long, c_long]
40         csolverlb.createRangeVar.restype = c_void_p
41         csolverlb.createMutableSet.argtypes = [c_void_p, c_uint]
42         csolverlb.createMutableSet.restype = c_void_p
43         csolverlb.addItem.argtypes = [c_void_p, c_void_p, c_long]
44         csolverlb.addItem.restype = None
45         csolverlb.finalizeMutableSet.argtypes = [c_void_p, c_void_p]
46         csolverlb.finalizeMutableSet.restype = None
47         csolverlb.getElementVar.argtypes = [c_void_p, c_void_p]
48         csolverlb.getElementVar.restype = c_void_p
49         csolverlb.getElementConst.argtypes = [c_void_p, c_uint, c_long]
50         csolverlb.getElementConst.restype = c_void_p
51         csolverlb.getElementRange.argtypes = [c_void_p, c_void_p]
52         csolverlb.getElementRange.restype = c_void_p
53         csolverlb.getBooleanVar.argtypes = [c_void_p, c_uint]
54         csolverlb.getBooleanVar.restype = c_void_p
55         csolverlb.createFunctionOperator.argtypes = [c_void_p, c_uint, POINTER(c_void_p), c_uint, c_void_p, c_uint]
56         csolverlb.createFunctionOperator.restype = c_void_p
57         csolverlb.createPredicateOperator.argtypes = [c_void_p, c_uint, POINTER(c_void_p), c_uint]
58         csolverlb.createPredicateOperator.restype = c_void_p
59         csolverlb.createPredicateTable.argtypes = [c_void_p, c_void_p, c_uint]
60         csolverlb.createPredicateTable.restype = c_void_p
61         csolverlb.createTable.argtypes = [c_void_p, POINTER(c_void_p), c_uint, c_void_p]
62         csolverlb.createTable.restype = c_void_p
63         csolverlb.createTableForPredicate.argtypes = [c_void_p, POINTER(c_void_p), c_uint]
64         csolverlb.createTableForPredicate.restype = c_void_p
65         csolverlb.addTableEntry.argtypes = [c_void_p, c_void_p, c_void_p, c_uint, c_long]
66         csolverlb.addTableEntry.restype = None
67         csolverlb.completeTable.argtypes = [c_void_p, c_void_p, c_uint]
68         csolverlb.completeTable.restype = c_void_p
69         csolverlb.applyFunction.argtypes = [c_void_p, c_void_p, POINTER(c_void_p), c_uint, c_void_p]
70         csolverlb.applyFunction.restype = c_void_p
71         csolverlb.applyPredicateTable.argtypes = [c_void_p, c_void_p, POINTER(c_void_p), c_uint, c_void_p]
72         csolverlb.applyPredicateTable.restype = c_void_p
73         csolverlb.applyPredicate.argtypes = [c_void_p, c_void_p, POINTER(c_void_p), c_uint]
74         csolverlb.applyPredicate.restype = c_void_p
75         csolverlb.applyLogicalOperation.argtypes = [c_void_p, c_uint, c_void_p, c_uint]
76         csolverlb.applyLogicalOperation.restype = c_void_p
77         csolverlb.applyLogicalOperationTwo.argtypes = [c_void_p, c_uint, c_void_p, c_void_p]
78         csolverlb.applyLogicalOperationTwo.restype = c_void_p
79         csolverlb.applyLogicalOperationOne.argtypes = [c_void_p, c_uint, c_void_p]
80         csolverlb.applyLogicalOperationOne.restype = c_void_p
81         csolverlb.addConstraint.argtypes = [c_void_p, c_void_p]
82         csolverlb.addConstraint.restype = None
83         csolverlb.createOrder.argtypes = [c_void_p, c_uint, c_void_p]
84         csolverlb.createOrder.restype = c_void_p
85         csolverlb.orderConstraint.argtypes = [c_void_p, c_void_p, c_long, c_long]
86         csolverlb.orderConstraint.restype = c_void_p
87         csolverlb.solve.argtypes = [c_void_p]
88         csolverlb.solve.restype = c_int
89         csolverlb.getElementValue.argtypes = [c_void_p, c_void_p]
90         csolverlb.getElementValue.restype = c_long
91         csolverlb.getBooleanValue.argtypes = [c_void_p, c_void_p]
92         csolverlb.getBooleanValue.restype = c_int
93         csolverlb.getOrderConstraintValue.argtypes = [c_void_p, c_void_p, c_long, c_long]
94         csolverlb.getOrderConstraintValue.restype = c_int
95         csolverlb.printConstraints.argtypes = [c_void_p]
96         csolverlb.printConstraints.restype = None
97         csolverlb.serialize.argtypes = [c_void_p]
98         csolverlb.serialize.restype = None
99         return csolverlb
100