/** De-duplicate array */
uint lowindex=0;
- edges[lowindex++]=edges[initindex++];
+ edges[lowindex]=edges[initindex++];
for(;initindex<numEdges;initindex++) {
Edge e1=edges[lowindex];
return E_False;
}
} else
- edges[lowindex++]=edges[initindex];
+ edges[++lowindex]=edges[initindex];
}
+ lowindex++; //Make lowindex look like size
+
if (lowindex==1)
return edges[0];
}
}
- return createNode(cnf, NodeType_AND, numEdges, edges);
+ return createNode(cnf, NodeType_AND, lowindex, edges);
}
Edge constraintAND2(CNF * cnf, Edge left, Edge right) {
deleteVectorEdge(ve);
}
-void countConstraint(CNF *cnf, VectorEdge *stack, Edge e) {
+void countConstraint(CNF *cnf, VectorEdge *stack, Edge eroot) {
//Skip constants and variables...
- if (edgeIsVarConst(e))
+ if (edgeIsVarConst(eroot))
return;
- clearVectorEdge(stack);pushVectorEdge(stack, e);
+ clearVectorEdge(stack);pushVectorEdge(stack, eroot);
bool isMatching=cnf->enableMatching;
bool propagate(CNF *cnf, CNFExpr ** dest, CNFExpr * src, bool negate) {
if (src != NULL && !isProxy(src) && getLitSizeCNF(src) == 0) {
- if (dest == NULL) {
+ if (*dest == NULL) {
*dest = allocCNFExprBool(negate ? alwaysFalseCNF(src) : alwaysTrueCNF(src));
} else if (isProxy(*dest)) {
bool alwaysTrue = (negate ? alwaysFalseCNF(src) : alwaysTrueCNF(src));
Edge nv2=constraintNegate(v2);
Edge iff1=constraintIFF(cnf, nv1, v2);
Edge iff2=constraintIFF(cnf, nv2, v3);
- Edge iff3=constraintIFF(cnf, v3, nv1);
- Edge cand=constraintAND(cnf, 3, (Edge[]) {iff1, iff2, iff3});
+ // Edge iff3=constraintIFF(cnf, v3, nv1);
+ //Edge cand=constraintAND(cnf, 3, (Edge[]) {iff1, iff2, iff3});
+ Edge cand=constraintAND(cnf, 2, (Edge[]) {iff1, iff2});
addConstraint(cnf, cand);
solveCNF(cnf);
deleteCNF(cnf);