#include "tableentry.h"
#include "table.h"
#include "order.h"
+#include "predicate.h"
SATEncoder * allocSATEncoder() {
encodeConstraintSATEncoder(This, constraint);
}
- size = getSizeVectorElement(csolver->allElements);
- for(uint i=0; i<size; i++){
- Element* element = getVectorElement(csolver->allElements, i);
- switch(GETELEMENTTYPE(element)){
- case ELEMFUNCRETURN:
- encodeFunctionElementSATEncoder(This, (ElementFunction*) element);
- break;
- default:
- continue;
- //ElementSets that aren't used in any constraints/functions
- //will be eliminated.
- }
- }
+// FIXME: Following line for element!
+// size = getSizeVectorElement(csolver->allElements);
+// for(uint i=0; i<size; i++){
+// Element* element = getVectorElement(csolver->allElements, i);
+// switch(GETELEMENTTYPE(element)){
+// case ELEMFUNCRETURN:
+// encodeFunctionElementSATEncoder(This, (ElementFunction*) element);
+// break;
+// default:
+// continue;
+// //ElementSets that aren't used in any constraints/functions
+// //will be eliminated.
+// }
+// }
}
Constraint * encodeConstraintSATEncoder(SATEncoder *This, Boolean *constraint) {
}
Constraint * encodePredicateSATEncoder(SATEncoder * This, BooleanPredicate * constraint) {
- //TO IMPLEMENT
-
+ switch(GETPREDICATETYPE(constraint) ){
+ case TABLEPRED:
+ return encodeTablePredicateSATEncoder(This, constraint);
+ case OPERATORPRED:
+ return encodeOperatorPredicateSATEncoder(This, constraint);
+ default:
+ ASSERT(0);
+ }
+ return NULL;
+}
+
+Constraint * encodeTablePredicateSATEncoder(SATEncoder * This, BooleanPredicate * constraint){
+ switch(constraint->encoding.type){
+ case ENUMERATEIMPLICATIONS:
+ return encodeEnumTablePredicateSATEncoder(This, constraint);
+ case CIRCUIT:
+ ASSERT(0);
+ break;
+ default:
+ ASSERT(0);
+ }
+ return NULL;
+}
+
+Constraint * encodeEnumTablePredicateSATEncoder(SATEncoder * This, BooleanPredicate * constraint){
+ TableEntry* entries = &(((PredicateTable*)constraint->predicate)->table->entries);
+ uint size = getSizeVectorTableEntry(entries);
+ for(uint i=0; i<size; i++){
+ TableEntry* entry = getVectorTableEntry(entries, i);
+
+ }
+}
+
+Constraint * encodeOperatorPredicateSATEncoder(SATEncoder * This, BooleanPredicate * constraint){
+ switch(constraint->encoding.type){
+ case ENUMERATEIMPLICATIONS:
+ break;
+ case CIRCUIT:
+ break;
+ default:
+ ASSERT(0);
+ }
return NULL;
}
Constraint * encodeVarSATEncoder(SATEncoder *This, BooleanVar * constraint);
Constraint * encodeLogicSATEncoder(SATEncoder *This, BooleanLogic * constraint);
Constraint * encodePredicateSATEncoder(SATEncoder * This, BooleanPredicate * constraint);
+Constraint * encodeTablePredicateSATEncoder(SATEncoder * This, BooleanPredicate * constraint);
+Constraint * encodeEnumTablePredicateSATEncoder(SATEncoder * This, BooleanPredicate * constraint);
+Constraint * encodeOperatorPredicateSATEncoder(SATEncoder * This, BooleanPredicate * constraint);
+
Constraint * getElementValueBinaryIndexConstraint(Element* This, uint64_t value);
Constraint * getElementValueConstraint(Element* This, uint64_t value);