Adding incremental to Java, C, and python APIs
authorHamed Gorjiara <hgorjiar@uci.edu>
Fri, 14 Jun 2019 22:17:24 +0000 (15:17 -0700)
committerHamed Gorjiara <hgorjiar@uci.edu>
Fri, 14 Jun 2019 22:17:24 +0000 (15:17 -0700)
src/ccsolver.cc
src/ccsolver.h
src/pycsolver.py
src/satune_SatuneJavaAPI.cc
src/satune_SatuneJavaAPI.h

index fa2e3426211b50e34f786e506e865307d3aa2d04..ca206174148a35bccd80682a8231b015176036cb 100644 (file)
@@ -146,10 +146,18 @@ int solve(void *solver) {
        return CCSOLVER(solver)->solve();
 }
 
+int solveIncremental(void *solver) {
+       return CCSOLVER(solver)->solveIncremental();
+}
+
 long getElementValue(void *solver,void *element) {
        return (long) CCSOLVER(solver)->getElementValue((Element *)element);
 }
 
+void freezeElement(void *solver,void *element) {
+       CCSOLVER(solver)->freezeElement((Element *)element);
+}
+
 int getBooleanValue(void *solver, void *boolean) {
        return CCSOLVER(solver)->getBooleanValue(BooleanEdge((Boolean *) boolean));
 }
index 86d5a46374541cf88c6f1bd77fc643aedde6e826..091303fb18540a420da62aaac0c8ad1f632489e3 100644 (file)
@@ -40,7 +40,9 @@ void printConstraint(void *solver,void *constraint);
 void *createOrder(void *solver,unsigned int type, void *set);
 void *orderConstraint(void *solver,void *order, long first, long second);
 int solve(void *solver);
+int solveIncremental(void *solver);
 long getElementValue(void *solver,void *element);
+void freezeElement(void *solver,void *element);
 int getBooleanValue(void *solver,void *boolean);
 int getOrderConstraintValue(void *solver,void *order, long first, long second);
 void printConstraints(void *solver);
index 461a8590b74f845c48f68e36079b6a4a108d8c89..905d1d775a8fd25b99a947e77d67b8d8d010b66d 100644 (file)
@@ -101,10 +101,14 @@ def loadCSolver():
        csolverlb.orderConstraint.restype = c_void_p
        csolverlb.solve.argtypes = [c_void_p]
        csolverlb.solve.restype = c_int
+       csolverlb.solveIncremental.argtypes = [c_void_p]
+       csolverlb.solveIncremental.restype = c_int
         csolverlb.mustHaveValue.argtypes = [c_void_p, c_void_p]
        csolverlb.mustHaveValue.restype = c_void_p
        csolverlb.getElementValue.argtypes = [c_void_p, c_void_p]
-       csolverlb.getElementValue.restype = c_long
+       csolverlb.getElementValue.restype = c_void_p
+       csolverlb.freezeElement.argtypes = [c_void_p, c_void_p]
+       csolverlb.freezeElement.restype = c_long
        csolverlb.getBooleanValue.argtypes = [c_void_p, c_void_p]
        csolverlb.getBooleanValue.restype = c_int
        csolverlb.getOrderConstraintValue.argtypes = [c_void_p, c_void_p, c_long, c_long]
index 21cd504ff5f00029cff1c7ef6041496c97b7dcf0..d1397ee88e7ebe7be39cb2a98260c30bff990eb6 100644 (file)
@@ -391,6 +391,17 @@ JNIEXPORT jint JNICALL Java_satune_SatuneJavaAPI_solve
        return (jint) solve((void *)solver);
 }
 
+/*
+ * Class:     SatuneJavaAPI
+ * Method:    solveIncremental
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL Java_satune_SatuneJavaAPI_solveIncremental
+       (JNIEnv *env, jobject obj, jlong solver)
+{
+       return (jint) solveIncremental((void *)solver);
+}
+
 /*
  * Class:     SatuneJavaAPI
  * Method:    getElementValue
@@ -402,6 +413,17 @@ JNIEXPORT jlong JNICALL Java_satune_SatuneJavaAPI_getElementValue
        return (jlong) getElementValue((void *)solver,(void *)element);
 }
 
+/*
+ * Class:     SatuneJavaAPI
+ * Method:    freezeElement
+ * Signature: (JJ)J
+ */
+JNIEXPORT void JNICALL Java_satune_SatuneJavaAPI_freezeElement
+       (JNIEnv *env, jobject obj, jlong solver, jlong element)
+{
+       freezeElement((void *)solver,(void *)element);
+}
+
 /*
  * Class:     SatuneJavaAPI
  * Method:    getBooleanValue
index 68703bcbf8b55f7bb0b5239fb3ec38348e2abb71..7b301f96ba3c7b2703b6017ee08a8e9e1c98a7b8 100644 (file)
@@ -280,6 +280,14 @@ JNIEXPORT jlong JNICALL Java_satune_SatuneJavaAPI_orderConstraint
 JNIEXPORT jint JNICALL Java_satune_SatuneJavaAPI_solve
        (JNIEnv *, jobject, jlong);
 
+/*
+ * Class:     satune_SatuneJavaAPI
+ * Method:    solveIncremental
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL Java_satune_SatuneJavaAPI_solveIncremental
+       (JNIEnv *, jobject, jlong);
+
 /*
  * Class:     satune_SatuneJavaAPI
  * Method:    getElementValue
@@ -288,6 +296,15 @@ JNIEXPORT jint JNICALL Java_satune_SatuneJavaAPI_solve
 JNIEXPORT jlong JNICALL Java_satune_SatuneJavaAPI_getElementValue
        (JNIEnv *, jobject, jlong, jlong);
 
+
+/*
+ * Class:     satune_SatuneJavaAPI
+ * Method:    getElementValue
+ * Signature: (JJ)J
+ */
+JNIEXPORT void JNICALL Java_satune_SatuneJavaAPI_freezeElement
+       (JNIEnv *, jobject, jlong, jlong);
+
 /*
  * Class:     satune_SatuneJavaAPI
  * Method:    getBooleanValue