struct NodeFlags {
NodeType type:2;
int wasExpanded:2;
+ int cnfVisitedDown:2;
+ int cnfVisitedUp:2;
};
typedef struct NodeFlags NodeFlags;
uint maxsize;
bool enableMatching;
Node ** node_array;
+ IncrementalSolver * solver;
VectorEdge constraints;
};
typedef struct CNF CNF;
+struct CNFExpr;
+typedef struct CNFExpr CNFExpr;
+
static inline bool getExpanded(Node *n, int isNegated) {
return n->flags.wasExpanded & (1<<isNegated);
}
return ((uintptr_t)e.node_ptr) & NEGATE_EDGE;
}
+static inline bool isPosEdge(Edge e) {
+ return !(((uintptr_t)e.node_ptr) & NEGATE_EDGE);
+}
+
static inline bool isNodeEdge(Edge e) {
return !(((uintptr_t)e.node_ptr) & EDGE_IS_VAR_CONSTANT);
}
return eret;
}
+static inline Literal getEdgeVar(Edge e) {
+ int val = (int) (((uintptr_t) e.node_ptr) >> VAR_SHIFT);
+ return isNegEdge(e) ? -val : val;
+}
+
+static inline bool isProxy(CNFExpr *expr) {
+ return (bool) (((intptr_t) expr) & 1);
+}
+
+static inline Literal getProxy(CNFExpr *expr) {
+ return (Literal) (((intptr_t) expr) >> 1);
+}
uint hashNode(NodeType type, uint numEdges, Edge * edges);
Node * allocNode(NodeType type, uint numEdges, Edge * edges, uint hashCode);
Edge constraintNewVar(CNF *cnf);
void countPass(CNF *cnf);
void countConstraint(CNF *cnf, VectorEdge * stack, Edge e);
+void convertPass(CNF *cnf, bool backtrackLit);
+void convertConstraint(CNF *cnf, VectorEdge *stack, Edge e, bool backtrackLit);
+void constrain(CNF * cnf, Literal l, CNFExpr *exp);
+void produceCNF(CNF * cnf, Edge e);
Edge E_True={(Node *)(uintptr_t) EDGE_IS_VAR_CONSTANT};