fix sigs
authorBrian Demsky <bdemsky@uci.edu>
Tue, 24 Jul 2018 20:33:03 +0000 (13:33 -0700)
committerbdemsky <bdemsky@uci.edu>
Tue, 24 Jul 2018 20:34:02 +0000 (13:34 -0700)
src/ASTTransform/elementopt.cc
src/pycsolver.py

index 775a5d2..d6dec3d 100755 (executable)
@@ -138,6 +138,11 @@ void ElementOpt::handlePredicateInequality(BooleanPredicate *pred, ElementSet *v
        solver->elemMap.remove(var);
        var->set = newset;
        solver->elemMap.put(var, var);
+
+       if (count == 1) {
+               ElementConst * elemconst = (ElementConst *) solver->getElementConst(s->type, elemArray[0]);
+               replaceVarWithConst(pred, var, elemconst);
+       }
 }
 
 void ElementOpt::constrainVarWithConst(BooleanPredicate *pred, ElementSet *var, ElementConst *value) {
@@ -160,6 +165,11 @@ void ElementOpt::constrainVarWithConst(BooleanPredicate *pred, ElementSet *var,
        solver->elemMap.remove(var);
        var->set = newset;
        solver->elemMap.put(var, var);
+
+       if (count == 1) {
+               ElementConst * elemconst = (ElementConst *) solver->getElementConst(s->type, elemArray[0]);
+               replaceVarWithConst(pred, var, elemconst);
+       }
 }
 
 void ElementOpt::replaceVarWithConst(BooleanPredicate * pred, ElementSet *var, ElementConst * value) {
index 3dd296b..6806674 100644 (file)
@@ -35,7 +35,7 @@ def loadCSolver():
         csolverlb.createSet.restype = c_void_p
         csolverlb.getElementVar.argtypes = [c_void_p, c_void_p]
         csolverlb.getElementVar.restype = c_void_p
-        csolverlb.createPredicateOperator.argtypes = [c_void_p, c_uint, POINTER(c_void_p), c_uint]
+        csolverlb.createPredicateOperator.argtypes = [c_void_p, c_uint]
         csolverlb.createPredicateOperator.restype = c_void_p
         csolverlb.applyPredicate.argtypes = [c_void_p, c_void_p, POINTER(c_void_p), c_uint]
         csolverlb.applyPredicate.restype = c_void_p
@@ -65,15 +65,15 @@ def loadCSolver():
        csolverlb.getElementRange.restype = c_void_p
        csolverlb.getBooleanVar.argtypes = [c_void_p, c_uint]
        csolverlb.getBooleanVar.restype = c_void_p
-       csolverlb.createFunctionOperator.argtypes = [c_void_p, c_uint, POINTER(c_void_p), c_uint, c_void_p, c_uint]
+       csolverlb.createFunctionOperator.argtypes = [c_void_p, c_uint, c_void_p, c_uint]
        csolverlb.createFunctionOperator.restype = c_void_p
-       csolverlb.createPredicateOperator.argtypes = [c_void_p, c_uint, POINTER(c_void_p), c_uint]
+       csolverlb.createPredicateOperator.argtypes = [c_void_p, c_uint]
        csolverlb.createPredicateOperator.restype = c_void_p
        csolverlb.createPredicateTable.argtypes = [c_void_p, c_void_p, c_uint]
        csolverlb.createPredicateTable.restype = c_void_p
-       csolverlb.createTable.argtypes = [c_void_p, POINTER(c_void_p), c_uint, c_void_p]
+       csolverlb.createTable.argtypes = [c_void_p, c_void_p]
        csolverlb.createTable.restype = c_void_p
-       csolverlb.createTableForPredicate.argtypes = [c_void_p, POINTER(c_void_p), c_uint]
+       csolverlb.createTableForPredicate.argtypes = [c_void_p]
        csolverlb.createTableForPredicate.restype = c_void_p
        csolverlb.addTableEntry.argtypes = [c_void_p, c_void_p, c_void_p, c_uint, c_long]
        csolverlb.addTableEntry.restype = None