1 #ifndef ELEMENTENCODING_H
2 #define ELEMENTENCODING_H
4 #include "naiveencoder.h"
5 #include "constraint.h"
7 enum ElementEncodingType {
8 ELEM_UNASSIGNED, ONEHOT, UNARY, BINARYINDEX, ONEHOTBINARY, BINARYVAL
11 typedef enum ElementEncodingType ElementEncodingType;
13 struct ElementEncoding {
14 ElementEncodingType type;
16 Edge * variables;/* List Variables Used To Encode Element */
17 uint64_t * encodingArray; /* List the Variables in the appropriate order */
18 uint64_t * inUseArray;/* Bitmap to track variables in use */
20 uint numVars; /* Number of variables */
23 void initElementEncoding(ElementEncoding *This, Element *element);
24 void setElementEncodingType(ElementEncoding* This, ElementEncodingType type);
25 void deleteElementEncoding(ElementEncoding *This);
26 void allocEncodingArrayElement(ElementEncoding *This, uint size);
27 void allocInUseArrayElement(ElementEncoding *This, uint size);
28 static inline bool isinUseElement(ElementEncoding *This, uint offset) {
29 return (This->inUseArray[(offset>>6)] >> (offset & 63)) &0x1;
32 static inline void setInUseElement(ElementEncoding *This, uint offset) {
33 This->inUseArray[(offset>>6)] |= 1 << (offset & 63);
36 void generateBinaryIndexEncodingVars(SATEncoder* encode, ElementEncoding* This);
37 void generateElementEncodingVariables(SATEncoder* encoder, ElementEncoding* This);