1 #include "satencoder.h"
7 Edge getElementValueConstraint(SATEncoder* This, Element* elem, uint64_t value) {
8 generateElementEncodingVariables(This, getElementEncoding(elem));
9 switch(getElementEncoding(elem)->type){
18 return getElementValueBinaryIndexConstraint(This, elem, value);
33 Edge getElementValueBinaryIndexConstraint(SATEncoder * This, Element* elem, uint64_t value) {
34 ASTNodeType type = GETELEMENTTYPE(elem);
35 ASSERT(type == ELEMSET || type == ELEMFUNCRETURN);
36 ElementEncoding* elemEnc = getElementEncoding(elem);
37 for(uint i=0; i<elemEnc->encArraySize; i++){
38 if( isinUseElement(elemEnc, i) && elemEnc->encodingArray[i]==value){
39 return generateBinaryConstraint(This->cnf, elemEnc->numVars, elemEnc->variables, i);