8 SATEncoder* satEncoder;
9 /** This is a vector of constraints that must be satisfied. */
10 VectorBoolean * constraints;
12 /** This is a vector of all boolean structs that we have allocated. */
13 VectorBoolean * allBooleans;
15 /** This is a vector of all set structs that we have allocated. */
18 /** This is a vector of all element structs that we have allocated. */
19 VectorElement * allElements;
21 /** This is a vector of all predicate structs that we have allocated. */
22 VectorPredicate * allPredicates;
24 /** This is a vector of all table structs that we have allocated. */
25 VectorTable * allTables;
27 /** This is a vector of all order structs that we have allocated. */
28 VectorOrder * allOrders;
30 /** This is a vector of all function structs that we have allocated. */
31 VectorFunction* allFunctions;
34 /** Create a new solver instance. */
36 CSolver * allocCSolver();
38 /** Delete solver instance. */
40 void deleteSolver(CSolver * This);
42 /** This function creates a set containing the elements passed in the array. */
44 Set * createSet(CSolver *, VarType type, uint64_t * elements, uint num);
46 /** This function creates a set from lowrange to highrange (inclusive). */
48 Set * createRangeSet(CSolver *, VarType type, uint64_t lowrange, uint64_t highrange);
50 /** This function creates a mutable set. */
52 MutableSet * createMutableSet(CSolver *, VarType type);
54 /** This function adds a new item to a set. */
56 void addItem(CSolver *, MutableSet * set, uint64_t element);
58 /** This function adds a new unique item to the set and returns it.
59 This function cannot be used in conjunction with manually adding
62 uint64_t createUniqueItem(CSolver *, MutableSet * set);
64 /** This function creates an element variable over a set. */
66 Element * getElementVar(CSolver *, Set * set);
68 /** This function creates a boolean variable. */
70 Boolean * getBooleanVar(CSolver *, VarType type);
72 /** This function creates a function operator. */
74 Function * createFunctionOperator(CSolver *solver, ArithOp op, Set ** domain, uint numDomain, Set * range,
75 OverFlowBehavior overflowbehavior);
77 /** This function creates a predicate operator. */
79 Predicate * createPredicateOperator(CSolver *solver, CompOp op, Set ** domain, uint numDomain);
81 /** This function creates an empty instance table.*/
83 Table * createTable(CSolver *solver, Set **domains, uint numDomain, Set * range);
85 /** This function adds an input output relation to a table. */
87 void addTableEntry(CSolver *solver, Table* table, uint64_t* inputs, uint inputSize, uint64_t result);
89 /** This function converts a completed table into a function. */
91 Function * completeTable(CSolver *, Table *);
93 /** This function applies a function to the Elements in its input. */
95 Element * applyFunction(CSolver *, Function * function, Element ** array, uint numArrays, Boolean * overflowstatus);
97 /** This function applies a predicate to the Elements in its input. */
99 Boolean * applyPredicate(CSolver *, Predicate * predicate, Element ** inputs, uint numInputs);
101 /** This function applies a logical operation to the Booleans in its input. */
103 Boolean * applyLogicalOperation(CSolver *, LogicOp op, Boolean ** array, uint asize);
105 /** This function adds a boolean constraint to the set of constraints
108 void addConstraint(CSolver *, Boolean * constraint);
110 /** This function instantiates an order of type type over the set set. */
111 Order * createOrder(CSolver *, OrderType type, Set * set);
113 /** This function instantiates a boolean on two items in an order. */
114 Boolean * orderConstraint(CSolver *, Order * order, uint64_t first, uint64_t second);
116 /** When everything is done, the client calls this function and then csolver starts to encode*/
117 int startEncoding(CSolver*);
119 /** After getting the solution from the SAT solver, client can get the value of an element via this function*/
120 uint64_t getElementValue(CSolver*, Element* element);
122 /** After getting the solution from the SAT solver, client can get the value of a boolean via this function*/
123 bool getBooleanValue( CSolver* , Boolean* boolean);