addConstraintCNF(cnf, constraintNegate(constraintAND2(cnf, encoding->variables[i], encoding->variables[j])));
}
}
- addConstraintCNF(cnf, constraintOR(cnf, encoding->numVars, encoding->variables));
if(encoding->anyValue)
- generateAnyValueOneHotEncoding(encoding);
+ addConstraintCNF(cnf, constraintOR(cnf, encoding->numVars, encoding->variables));
}
void SATEncoder::generateUnaryEncodingVars(ElementEncoding *encoding) {
}
}
-void SATEncoder::generateAnyValueOneHotEncoding(ElementEncoding *encoding){
- if(encoding->numVars == 0)
- return;
- Edge carray[encoding->numVars];
- int size = 0;
- for (uint i = 0; i < encoding->encArraySize; i++) {
- if (encoding->isinUseElement(i)){
- carray[size++] = encoding->variables[i];
- }
- }
- if(size > 0){
- addConstraintCNF(cnf, constraintOR(cnf, size, carray));
- }
-}
-
void SATEncoder::generateAnyValueBinaryIndexEncoding(ElementEncoding *encoding){
if(encoding->numVars == 0)
return;
Edge encodeEnumTablePredicateSATEncoder(BooleanPredicate *constraint);
void encodeEnumTableElemFunctionSATEncoder(ElementFunction *This);
void encodeEnumEntriesTableElemFuncSATEncoder(ElementFunction *This);
- void generateAnyValueOneHotEncoding(ElementEncoding *encoding);
void generateAnyValueBinaryIndexEncoding(ElementEncoding *encoding);
void generateAnyValueBinaryValueEncoding(ElementEncoding *encoding);
CNF *cnf;