16 #define SWIG_DIRECTORS
21 template<
typename T>
class SwigValueWrapper {
22 struct SwigMovePointer {
24 SwigMovePointer(T *p) : ptr(p) { }
25 ~SwigMovePointer() {
delete ptr; }
26 SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0;
delete oldptr; ptr = rhs.ptr; rhs.ptr = 0;
return *
this; }
28 SwigValueWrapper& operator=(
const SwigValueWrapper<T>& rhs);
29 SwigValueWrapper(
const SwigValueWrapper<T>& rhs);
31 SwigValueWrapper() : pointer(0) { }
32 SwigValueWrapper& operator=(
const T& t) { SwigMovePointer tmp(
new T(t)); pointer = tmp;
return *
this; }
33 operator T&()
const {
return *pointer.ptr; }
34 T *operator&() {
return pointer.ptr; }
37 template <
typename T> T SwigValueInit() {
48 #ifndef SWIGTEMPLATEDISAMBIGUATOR
49 # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
50 # define SWIGTEMPLATEDISAMBIGUATOR template
51 # elif defined(__HP_aCC)
54 # define SWIGTEMPLATEDISAMBIGUATOR template
56 # define SWIGTEMPLATEDISAMBIGUATOR
62 # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
63 # define SWIGINLINE inline
71 # if defined(__GNUC__)
72 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
73 # define SWIGUNUSED __attribute__ ((__unused__))
78 # define SWIGUNUSED __attribute__ ((__unused__))
84 #ifndef SWIG_MSC_UNSUPPRESS_4505
85 # if defined(_MSC_VER)
86 # pragma warning(disable : 4505)
90 #ifndef SWIGUNUSEDPARM
92 # define SWIGUNUSEDPARM(p)
94 # define SWIGUNUSEDPARM(p) p SWIGUNUSED
100 # define SWIGINTERN static SWIGUNUSED
104 #ifndef SWIGINTERNINLINE
105 # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
109 #if defined(__GNUC__)
110 # if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
111 # ifndef GCC_HASCLASSVISIBILITY
112 # define GCC_HASCLASSVISIBILITY
118 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
119 # if defined(STATIC_LINKED)
122 # define SWIGEXPORT __declspec(dllexport)
125 # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
126 # define SWIGEXPORT __attribute__ ((visibility("default")))
135 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
136 # define SWIGSTDCALL __stdcall
143 #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
144 # define _CRT_SECURE_NO_DEPRECATE
148 #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
149 # define _SCL_SECURE_NO_DEPRECATE
153 #if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES)
154 # define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
162 #ifdef __INTEL_COMPILER
163 # pragma warning disable 592
168 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
169 typedef long long __int64;
173 #if defined(__x86_64)
200 const char *java_exception;
221 while (except_ptr->
code != code && except_ptr->
code)
224 jenv->ExceptionClear();
227 jenv->ThrowNew(excep, msg);
233 #define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_JavaThrowException(jenv, SWIG_JavaIllegalArgumentException, msg); return nullreturn; } else
246 #ifdef SWIG_DIRECTOR_STATIC
257 #if defined(DEBUG_DIRECTOR_OWNED) || defined(DEBUG_DIRECTOR_EXCEPTION) || defined(DEBUG_DIRECTOR_THREAD_NAME)
263 #if defined(SWIG_JAVA_USE_THREAD_NAME)
265 #if !defined(SWIG_JAVA_GET_THREAD_NAME)
270 #if defined(__linux__)
272 #include <sys/prctl.h>
275 #if defined(PR_GET_NAME)
276 return prctl(PR_GET_NAME, (
unsigned long)
name, 0, 0, 0);
283 #elif defined(__unix__) || defined(__APPLE__)
287 return pthread_getname_np(pthread_self(),
name, len);
306 class JObjectWrapper {
316 bool set(JNIEnv *jenv, jobject jobj,
bool mem_own,
bool weak_global) {
318 weak_global_ = weak_global || !mem_own;
320 jthis_ = weak_global_ ? jenv->NewWeakGlobalRef(jobj) : jenv->NewGlobalRef(jobj);
321 #if defined(DEBUG_DIRECTOR_OWNED)
322 std::cout <<
"JObjectWrapper::set(" << jobj <<
", " << (weak_global ?
"weak_global" :
"global_ref") <<
") -> " << jthis_ << std::endl;
326 #if defined(DEBUG_DIRECTOR_OWNED)
327 std::cout <<
"JObjectWrapper::set(" << jobj <<
", " << (weak_global ?
"weak_global" :
"global_ref") <<
") -> already set" << std::endl;
333 jobject
get(JNIEnv *jenv)
const {
334 #if defined(DEBUG_DIRECTOR_OWNED)
335 std::cout <<
"JObjectWrapper::get(";
340 std::cout <<
") -> return new local ref" << std::endl;
342 return (jthis_ ? jenv->NewLocalRef(jthis_) : jthis_);
346 #if defined(DEBUG_DIRECTOR_OWNED)
347 std::cout <<
"JObjectWrapper::release(" << jthis_ <<
"): " << (weak_global_ ?
"weak global ref" :
"global ref") << std::endl;
351 if (jenv->IsSameObject(jthis_, NULL) == JNI_FALSE)
352 jenv->DeleteWeakGlobalRef((jweak)jthis_);
354 jenv->DeleteGlobalRef(jthis_);
369 if (take_or_release) {
371 jenv->DeleteGlobalRef(jthis_);
372 jthis_ = jenv->NewWeakGlobalRef(jself);
378 jenv->DeleteWeakGlobalRef((jweak)jthis_);
379 jthis_ = jenv->NewGlobalRef(jself);
380 weak_global_ =
false;
393 class LocalRefGuard {
398 LocalRefGuard(
const LocalRefGuard &);
399 LocalRefGuard &operator=(
const LocalRefGuard &);
404 jenv_->DeleteLocalRef(jobj_);
414 #if defined (_MSC_VER) && (_MSC_VER<1300)
416 friend class JNIEnvWrapper;
419 class JNIEnvWrapper {
425 #if defined(__ANDROID__)
426 JNIEnv **jenv = &jenv_;
428 void **jenv = (
void **)&jenv_;
430 env_status = director_->swig_jvm_->GetEnv((
void **)&jenv_, JNI_VERSION_1_2);
431 JavaVMAttachArgs args;
432 args.version = JNI_VERSION_1_2;
435 #if defined(SWIG_JAVA_USE_THREAD_NAME)
436 char thread_name[64];
437 if (Swig::GetThreadName(thread_name,
sizeof(thread_name)) == 0) {
438 args.name = thread_name;
439 #if defined(DEBUG_DIRECTOR_THREAD_NAME)
440 std::cout <<
"JNIEnvWrapper: thread name: " << thread_name << std::endl;
442 std::cout <<
"JNIEnvWrapper: Couldn't set Java thread name" << std::endl;
446 #if defined(SWIG_JAVA_ATTACH_CURRENT_THREAD_AS_DAEMON)
449 director_->swig_jvm_->AttachCurrentThreadAsDaemon(jenv, &args);
451 director_->swig_jvm_->AttachCurrentThread(jenv, &args);
455 #if !defined(SWIG_JAVA_NO_DETACH_CURRENT_THREAD)
458 if (env_status == JNI_EDETACHED)
459 director_->swig_jvm_->DetachCurrentThread();
473 JNIEnv *jenv = jnienv.getJNIEnv() ;
476 #if defined(DEBUG_DIRECTOR_OWNED)
477 std::cout <<
"Swig::Director::disconnect_director_self(" << jobj <<
")" << std::endl;
479 if (jobj && jenv->IsSameObject(jobj, NULL) == JNI_FALSE) {
480 jmethodID disconn_meth = jenv->GetMethodID(jenv->GetObjectClass(jobj), disconn_method,
"()V");
482 #if defined(DEBUG_DIRECTOR_OWNED)
483 std::cout <<
"Swig::Director::disconnect_director_self upcall to " << disconn_method << std::endl;
485 jenv->CallVoidMethod(jobj, disconn_meth);
493 jenv->GetJavaVM(&swig_jvm_);
498 JNIEnv *jenv = jnienv.getJNIEnv() ;
502 bool swig_set_self(JNIEnv *jenv, jobject jself,
bool mem_own,
bool weak_global) {
517 template<
size_t N>
class BoolArray {
521 memset(array_, 0,
sizeof(array_));
536 JavaString(JNIEnv *jenv, jstring jstr) : jenv_(jenv), jstr_(jstr), cstr_(0) {
538 cstr_ = (
const char *) jenv_->GetStringUTFChars(jstr_, NULL);
542 if (jenv_ && jstr_ && cstr_)
543 jenv_->ReleaseStringUTFChars(jstr_, cstr_);
546 const char *
c_str(
const char *null_string =
"null JavaString")
const {
547 return cstr_ ? cstr_ : null_string;
561 class JavaExceptionMessage {
563 JavaExceptionMessage(JNIEnv *jenv, jthrowable throwable) : message_(jenv, exceptionMessageFromThrowable(jenv, throwable)) {
568 const char *
message(
const char *null_string =
"Could not get exception message in JavaExceptionMessage")
const {
569 return message_.
c_str(null_string);
578 static jstring exceptionMessageFromThrowable(JNIEnv *jenv, jthrowable throwable) {
580 if (jenv && throwable) {
581 jenv->ExceptionClear();
582 jclass throwclz = jenv->GetObjectClass(throwable);
585 jmethodID getMessageMethodID = jenv->GetMethodID(throwclz,
"getMessage",
"()Ljava/lang/String;");
586 if (getMessageMethodID)
587 jmsg = (jstring)jenv->CallObjectMethod(throwable, getMessageMethodID);
589 if (jmsg == NULL && jenv->ExceptionCheck())
590 jenv->ExceptionClear();
599 class DirectorException :
public std::exception {
603 DirectorException(JNIEnv *jenv, jthrowable throwable) : jenv_(jenv), throwable_(throwable), classname_(0), msg_(0) {
606 if (jenv && throwable) {
607 jenv->ExceptionClear();
608 jclass throwclz = jenv->GetObjectClass(throwable);
610 jclass clzclz = jenv->GetObjectClass(throwclz);
612 jmethodID getNameMethodID = jenv->GetMethodID(clzclz,
"getName",
"()Ljava/lang/String;");
613 if (getNameMethodID) {
614 jstring jstr_classname = (jstring)(jenv->CallObjectMethod(throwclz, getNameMethodID));
616 if (jstr_classname) {
618 const char *classname = jsclassname.c_str(0);
620 classname_ = copypath(classname);
628 msg_ = copystr(exceptionmsg.message(0));
632 DirectorException(
const char *msg) : jenv_(0), throwable_(0), classname_(0), msg_(msg ? copystr(msg) : 0) {
640 const char *
what()
const throw() {
641 return msg_ ? msg_ :
"Unspecified DirectorException message";
648 if (jenv == jenv_ && throwable_) {
650 jthrowable throwable = jenv->ExceptionOccurred();
651 if (throwable && jenv->IsSameObject(throwable, throwable_) == JNI_FALSE) {
652 jenv->ExceptionClear();
656 jenv->Throw(throwable_);
659 jenv->ExceptionClear();
661 jmethodID ctorMethodID = 0;
662 jclass throwableclass = 0;
664 throwableclass = jenv->FindClass(classname_);
666 ctorMethodID = jenv->GetMethodID(throwableclass,
"<init>",
"(Ljava/lang/String;)V");
670 jenv->ThrowNew(throwableclass,
what());
684 static void raise(JNIEnv *jenv, jthrowable throwable) {
689 static char *copypath(
const char *srcmsg) {
690 char *target = copystr(srcmsg);
691 for (
char *c=target; *c; ++c) {
698 static char *copystr(
const char *srcmsg) {
701 size_t msglen = strlen(srcmsg) + 1;
702 target =
new char[msglen];
703 strncpy(target, srcmsg, msglen);
709 jthrowable throwable_;
710 const char *classname_;
717 bool matches =
false;
719 if (throwable && jenv && classname) {
723 jenv->ExceptionClear();
725 jclass clz = jenv->FindClass(classname);
727 jclass classclz = jenv->GetObjectClass(clz);
728 jmethodID isInstanceMethodID = jenv->GetMethodID(classclz,
"isInstance",
"(Ljava/lang/Object;)Z");
729 if (isInstanceMethodID) {
730 matches = jenv->CallBooleanMethod(clz, isInstanceMethodID, throwable) != 0;
734 #if defined(DEBUG_DIRECTOR_EXCEPTION)
735 if (jenv->ExceptionCheck()) {
737 JavaExceptionMessage exc(jenv, jenv->ExceptionOccurred());
738 std::cout <<
"Error: ExceptionMatches: class '" << classname <<
"' : " << exc.message() << std::endl;
748 jclass jclass_mainJNI = NULL;
749 jmethodID director_method_ids[1];
756 #define SWIGWORDSIZE64
760 #if (__WORDSIZE == 32) || (LONG_MAX == INT_MAX)
761 # error "SWIG wrapped code invalid in 32 bit architecture, regenerate code using -DSWIGWORDSIZE32"
783 #include "ortools/sat/swig_helper.h"
803 JNIEnvWrapper swigjnienv(
this) ;
804 JNIEnv * jenv = swigjnienv.getJNIEnv() ;
805 jobject swigjobj = (jobject) NULL ;
812 if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
813 jenv->CallStaticVoidMethod(Swig::jclass_mainJNI, Swig::director_method_ids[0], swigjobj);
814 jthrowable swigerror = jenv->ExceptionOccurred();
822 if (swigjobj) jenv->DeleteLocalRef(swigjobj);
829 jmethodID base_methid;
832 "onSolutionCallback",
"()V", NULL
836 static jclass baseclass = 0 ;
840 baseclass = jenv->FindClass(
"com/google/ortools/sat/SolutionCallback");
841 if (!baseclass)
return;
842 baseclass = (jclass) jenv->NewGlobalRef(baseclass);
844 bool derived = (jenv->IsSameObject(baseclass, jcls) ? false :
true);
845 for (
int i = 0; i < 1; ++i) {
846 if (!methods[i].base_methid) {
847 methods[i].base_methid = jenv->GetMethodID(baseclass, methods[i].mname, methods[i].mdesc);
848 if (!methods[i].base_methid)
return;
852 jmethodID methid = jenv->GetMethodID(jcls, methods[i].mname, methods[i].mdesc);
854 jenv->ExceptionClear();
867 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
871 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
877 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
882 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
883 ((operations_research::sat::SolutionCallback
const *)arg1)->OnSolutionCallback();
889 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
895 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
896 result = (
int64)((operations_research::sat::SolutionCallback
const *)arg1)->NumBooleans();
897 jresult = (jlong)result;
904 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
910 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
911 result = (
int64)((operations_research::sat::SolutionCallback
const *)arg1)->NumBranches();
912 jresult = (jlong)result;
919 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
925 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
926 result = (
int64)((operations_research::sat::SolutionCallback
const *)arg1)->NumConflicts();
927 jresult = (jlong)result;
934 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
940 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
941 result = (
int64)((operations_research::sat::SolutionCallback
const *)arg1)->NumBinaryPropagations();
942 jresult = (jlong)result;
949 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
955 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
956 result = (
int64)((operations_research::sat::SolutionCallback
const *)arg1)->NumIntegerPropagations();
957 jresult = (jlong)result;
963 jdouble jresult = 0 ;
964 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
970 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
971 result = (double)((operations_research::sat::SolutionCallback
const *)arg1)->WallTime();
972 jresult = (jdouble)result;
978 jdouble jresult = 0 ;
979 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
985 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
986 result = (double)((operations_research::sat::SolutionCallback
const *)arg1)->UserTime();
987 jresult = (jdouble)result;
993 jdouble jresult = 0 ;
994 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
1000 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
1001 result = (double)((operations_research::sat::SolutionCallback
const *)arg1)->ObjectiveValue();
1002 jresult = (jdouble)result;
1008 jdouble jresult = 0 ;
1009 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
1015 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
1016 result = (double)((operations_research::sat::SolutionCallback
const *)arg1)->BestObjectiveBound();
1017 jresult = (jdouble)result;
1024 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
1031 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
1033 result = (
int64)(arg1)->SolutionIntegerValue(arg2);
1034 jresult = (jlong)result;
1040 jboolean jresult = 0 ;
1041 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
1048 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
1050 result = (bool)(arg1)->SolutionBooleanValue(arg2);
1051 jresult = (jboolean)result;
1057 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
1062 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
1063 (arg1)->StopSearch();
1069 operations_research::sat::SolutionCallback *result = 0 ;
1074 *(operations_research::sat::SolutionCallback **)&jresult = result;
1080 operations_research::sat::SolutionCallback *obj = *((operations_research::sat::SolutionCallback **)&objarg);
1083 director->
swig_connect_director(jenv, jself, jenv->GetObjectClass(jself), (jswig_mem_own == JNI_TRUE), (jweak_global == JNI_TRUE));
1088 operations_research::sat::SolutionCallback *obj = *((operations_research::sat::SolutionCallback **)&objarg);
1098 jbyteArray jresult = 0 ;
1099 operations_research::sat::CpModelProto *arg1 = 0 ;
1100 operations_research::sat::CpModelProto temp1 ;
1101 operations_research::sat::CpSolverResponse result;
1107 std::unique_ptr<char[]> proto_buffer(
1109 bool parsed_ok = temp1.ParseFromArray(proto_buffer.get(), proto_size);
1113 "Unable to parse operations_research::sat::CpModelProto protocol message.");
1119 const long size = (&result)->ByteSizeLong();
1120 std::unique_ptr<char[]> buf(
new char[size]);
1121 (&result)->SerializeWithCachedSizesToArray(
reinterpret_cast<uint8*
>(buf.get()));
1129 jbyteArray jresult = 0 ;
1130 operations_research::sat::CpModelProto *arg1 = 0 ;
1131 operations_research::sat::SatParameters *arg2 = 0 ;
1132 operations_research::sat::CpModelProto temp1 ;
1133 operations_research::sat::SatParameters temp2 ;
1134 operations_research::sat::CpSolverResponse result;
1140 std::unique_ptr<char[]> proto_buffer(
1142 bool parsed_ok = temp1.ParseFromArray(proto_buffer.get(), proto_size);
1146 "Unable to parse operations_research::sat::CpModelProto protocol message.");
1152 std::unique_ptr<char[]> proto_buffer(
1154 bool parsed_ok = temp2.ParseFromArray(proto_buffer.get(), proto_size);
1158 "Unable to parse operations_research::sat::SatParameters protocol message.");
1164 const long size = (&result)->ByteSizeLong();
1165 std::unique_ptr<char[]> buf(
new char[size]);
1166 (&result)->SerializeWithCachedSizesToArray(
reinterpret_cast<uint8*
>(buf.get()));
1174 jbyteArray jresult = 0 ;
1175 operations_research::sat::CpModelProto *arg1 = 0 ;
1176 operations_research::sat::SatParameters *arg2 = 0 ;
1177 operations_research::sat::SolutionCallback *arg3 = 0 ;
1178 operations_research::sat::CpModelProto temp1 ;
1179 operations_research::sat::SatParameters temp2 ;
1180 operations_research::sat::CpSolverResponse result;
1187 std::unique_ptr<char[]> proto_buffer(
1189 bool parsed_ok = temp1.ParseFromArray(proto_buffer.get(), proto_size);
1193 "Unable to parse operations_research::sat::CpModelProto protocol message.");
1199 std::unique_ptr<char[]> proto_buffer(
1201 bool parsed_ok = temp2.ParseFromArray(proto_buffer.get(), proto_size);
1205 "Unable to parse operations_research::sat::SatParameters protocol message.");
1209 arg3 = *(operations_research::sat::SolutionCallback **)&jarg3;
1214 result = operations_research::sat::SatHelper::SolveWithParametersAndSolutionCallback((operations_research::sat::CpModelProto
const &)*arg1,(operations_research::sat::SatParameters
const &)*arg2,(operations_research::sat::SolutionCallback
const &)*arg3);
1216 const long size = (&result)->ByteSizeLong();
1217 std::unique_ptr<char[]> buf(
new char[size]);
1218 (&result)->SerializeWithCachedSizesToArray(
reinterpret_cast<uint8*
>(buf.get()));
1226 jstring jresult = 0 ;
1227 operations_research::sat::CpModelProto *arg1 = 0 ;
1228 operations_research::sat::CpModelProto temp1 ;
1235 std::unique_ptr<char[]> proto_buffer(
1237 bool parsed_ok = temp1.ParseFromArray(proto_buffer.get(), proto_size);
1241 "Unable to parse operations_research::sat::CpModelProto protocol message.");
1245 result = operations_research::sat::SatHelper::ModelStats((operations_research::sat::CpModelProto
const &)*arg1);
1246 jresult = jenv->NewStringUTF((&result)->c_str());
1252 jstring jresult = 0 ;
1253 operations_research::sat::CpSolverResponse *arg1 = 0 ;
1254 operations_research::sat::CpSolverResponse temp1 ;
1261 std::unique_ptr<char[]> proto_buffer(
1263 bool parsed_ok = temp1.ParseFromArray(proto_buffer.get(), proto_size);
1267 "Unable to parse operations_research::sat::CpSolverResponse protocol message.");
1271 result = operations_research::sat::SatHelper::SolverResponseStats((operations_research::sat::CpSolverResponse
const &)*arg1);
1272 jresult = jenv->NewStringUTF((&result)->c_str());
1278 jstring jresult = 0 ;
1279 operations_research::sat::CpModelProto *arg1 = 0 ;
1280 operations_research::sat::CpModelProto temp1 ;
1287 std::unique_ptr<char[]> proto_buffer(
1289 bool parsed_ok = temp1.ParseFromArray(proto_buffer.get(), proto_size);
1293 "Unable to parse operations_research::sat::CpModelProto protocol message.");
1297 result = operations_research::sat::SatHelper::ValidateModel((operations_research::sat::CpModelProto
const &)*arg1);
1298 jresult = jenv->NewStringUTF((&result)->c_str());
1305 operations_research::sat::IntegerVariableProto *arg1 = 0 ;
1306 operations_research::sat::IntegerVariableProto temp1 ;
1313 std::unique_ptr<char[]> proto_buffer(
1315 bool parsed_ok = temp1.ParseFromArray(proto_buffer.get(), proto_size);
1319 "Unable to parse operations_research::sat::IntegerVariableProto protocol message.");
1323 result = operations_research::sat::SatHelper::VariableDomain((operations_research::sat::IntegerVariableProto
const &)*arg1);
1330 jboolean jresult = 0 ;
1331 operations_research::sat::CpModelProto *arg1 = 0 ;
1332 std::string *arg2 = 0 ;
1333 operations_research::sat::CpModelProto temp1 ;
1340 std::unique_ptr<char[]> proto_buffer(
1342 bool parsed_ok = temp1.ParseFromArray(proto_buffer.get(), proto_size);
1346 "Unable to parse operations_research::sat::CpModelProto protocol message.");
1354 const char *arg2_pstr = (
const char *)jenv->GetStringUTFChars(jarg2, 0);
1355 if (!arg2_pstr)
return 0;
1356 std::string arg2_str(arg2_pstr);
1358 jenv->ReleaseStringUTFChars(jarg2, arg2_pstr);
1359 result = (bool)operations_research::sat::SatHelper::WriteModelToFile((operations_research::sat::CpModelProto
const &)*arg1,(std::string
const &)*arg2);
1360 jresult = (jboolean)result;
1367 operations_research::sat::SatHelper *result = 0 ;
1371 result = (operations_research::sat::SatHelper *)
new operations_research::sat::SatHelper();
1372 *(operations_research::sat::SatHelper **)&jresult = result;
1378 operations_research::sat::SatHelper *arg1 = (operations_research::sat::SatHelper *) 0 ;
1382 arg1 = *(operations_research::sat::SatHelper **)&jarg1;
1392 const char *signature;
1395 "SwigDirector_SolutionCallback_onSolutionCallback",
"(Lcom/google/ortools/sat/SolutionCallback;)V"
1398 Swig::jclass_mainJNI = (jclass) jenv->NewGlobalRef(jcls);
1399 if (!Swig::jclass_mainJNI)
return;
1400 for (i = 0; i < (int) (
sizeof(methods)/
sizeof(methods[0])); ++i) {
1401 Swig::director_method_ids[i] = jenv->GetStaticMethodID(jcls, methods[i].method, methods[i].signature);
1402 if (!Swig::director_method_ids[i])
return;
static jbyteArray MakeJByteArray(JNIEnv *env, const char *a, int size)
static char * MakeCharArray(JNIEnv *env, jbyteArray a, int *size)
bool & operator[](size_t n)
bool operator[](size_t n) const
JNIEnvWrapper(const Director *director)
JNIEnv * getJNIEnv() const
static void raise(JNIEnv *jenv, jthrowable throwable)
void raiseJavaException(JNIEnv *jenv) const
const char * what() const
DirectorException(const char *msg)
DirectorException(JNIEnv *jenv, jthrowable throwable)
void throwException(JNIEnv *jenv) const
PyObject * swig_get_self() const
jobject swig_get_self(JNIEnv *jenv) const
JObjectWrapper swig_self_
bool swig_set_self(JNIEnv *jenv, jobject jself, bool mem_own, bool weak_global)
void swig_disconnect_director_self(const char *disconn_method)
void swig_java_change_ownership(JNIEnv *jenv, jobject jself, bool take_or_release)
void release(JNIEnv *jenv)
bool set(JNIEnv *jenv, jobject jobj, bool mem_own, bool weak_global)
void java_change_ownership(JNIEnv *jenv, jobject jself, bool take_or_release)
jobject get(JNIEnv *jenv) const
JavaExceptionMessage(JNIEnv *jenv, jthrowable throwable)
const char * message(const char *null_string="Could not get exception message in JavaExceptionMessage") const
JavaString(JNIEnv *jenv, jstring jstr)
const char * c_str(const char *null_string="null JavaString") const
LocalRefGuard(JNIEnv *jenv, jobject jobj)
virtual ~SwigDirector_SolutionCallback()
void swig_connect_director(SWIG_Callback0_t callbackOnSolutionCallback)
virtual void OnSolutionCallback() const
SwigDirector_SolutionCallback()
Swig::BoolArray< 1 > swig_override
We call domain any subset of Int64 = [kint64min, kint64max].
SWIGINTERN bool ExceptionMatches(JNIEnv *jenv, jthrowable throwable, const char *classname)
CpSolverResponse SolveWithParameters(const CpModelProto &model_proto, const SatParameters ¶ms)
Solves the given CpModelProto with the given parameters.
CpSolverResponse Solve(const CpModelProto &model_proto)
Solves the given CpModelProto and returns an instance of CpSolverResponse.
The vehicle routing library lets one model and solve generic vehicle routing problems ranging from th...
SWIGEXPORT jbyteArray JNICALL Java_com_google_ortools_sat_mainJNI_SatHelper_1solve(JNIEnv *jenv, jclass jcls, jbyteArray jarg1)
SWIGEXPORT jstring JNICALL Java_com_google_ortools_sat_mainJNI_SatHelper_1solverResponseStats(JNIEnv *jenv, jclass jcls, jbyteArray jarg1)
SWIGEXPORT void JNICALL Java_com_google_ortools_sat_mainJNI_SolutionCallback_1stopSearch(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_)
SWIGEXPORT jdouble JNICALL Java_com_google_ortools_sat_mainJNI_SolutionCallback_1bestObjectiveBound(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_)
SWIGEXPORT jstring JNICALL Java_com_google_ortools_sat_mainJNI_SatHelper_1validateModel(JNIEnv *jenv, jclass jcls, jbyteArray jarg1)
SWIGEXPORT jlong JNICALL Java_com_google_ortools_sat_mainJNI_SolutionCallback_1solutionIntegerValue(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2)
SWIGEXPORT jdouble JNICALL Java_com_google_ortools_sat_mainJNI_SolutionCallback_1userTime(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_)
SWIGEXPORT jboolean JNICALL Java_com_google_ortools_sat_mainJNI_SatHelper_1writeModelToFile(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jstring jarg2)
SWIGEXPORT jlong JNICALL Java_com_google_ortools_sat_mainJNI_new_1SatHelper(JNIEnv *jenv, jclass jcls)
SWIGEXPORT jbyteArray JNICALL Java_com_google_ortools_sat_mainJNI_SatHelper_1solveWithParametersAndSolutionCallback(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jbyteArray jarg2, jlong jarg3, jobject jarg3_)
SWIGEXPORT jbyteArray JNICALL Java_com_google_ortools_sat_mainJNI_SatHelper_1solveWithParameters(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jbyteArray jarg2)
static void SWIGUNUSED SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionCodes code, const char *msg)
@ SWIG_JavaArithmeticException
@ SWIG_JavaRuntimeException
@ SWIG_JavaNullPointerException
@ SWIG_JavaDirectorPureVirtual
@ SWIG_JavaOutOfMemoryError
@ SWIG_JavaIllegalStateException
@ SWIG_JavaIllegalArgumentException
@ SWIG_JavaIndexOutOfBoundsException
SWIGEXPORT jlong JNICALL Java_com_google_ortools_sat_mainJNI_SatHelper_1variableDomain(JNIEnv *jenv, jclass jcls, jbyteArray jarg1)
SWIGEXPORT jlong JNICALL Java_com_google_ortools_sat_mainJNI_SolutionCallback_1numBranches(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_)
SWIGEXPORT jstring JNICALL Java_com_google_ortools_sat_mainJNI_SatHelper_1modelStats(JNIEnv *jenv, jclass jcls, jbyteArray jarg1)
SWIGEXPORT jlong JNICALL Java_com_google_ortools_sat_mainJNI_SolutionCallback_1numBooleans(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_)
SWIGEXPORT jlong JNICALL Java_com_google_ortools_sat_mainJNI_SolutionCallback_1numConflicts(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_)
SWIGEXPORT void JNICALL Java_com_google_ortools_sat_mainJNI_SolutionCallback_1onSolutionCallback(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_)
SWIGEXPORT jlong JNICALL Java_com_google_ortools_sat_mainJNI_new_1SolutionCallback(JNIEnv *jenv, jclass jcls)
SWIGEXPORT void JNICALL Java_com_google_ortools_sat_mainJNI_delete_1SatHelper(JNIEnv *jenv, jclass jcls, jlong jarg1)
SWIGEXPORT jlong JNICALL Java_com_google_ortools_sat_mainJNI_SolutionCallback_1numIntegerPropagations(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_)
SWIGEXPORT void JNICALL Java_com_google_ortools_sat_mainJNI_delete_1SolutionCallback(JNIEnv *jenv, jclass jcls, jlong jarg1)
SWIGEXPORT jboolean JNICALL Java_com_google_ortools_sat_mainJNI_SolutionCallback_1solutionBooleanValue(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2)
SWIGEXPORT void JNICALL Java_com_google_ortools_sat_mainJNI_SolutionCallback_1director_1connect(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jswig_mem_own, jboolean jweak_global)
SWIGEXPORT void JNICALL Java_com_google_ortools_sat_mainJNI_swig_1module_1init(JNIEnv *jenv, jclass jcls)
SWIGEXPORT jlong JNICALL Java_com_google_ortools_sat_mainJNI_SolutionCallback_1numBinaryPropagations(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_)
SWIGEXPORT jdouble JNICALL Java_com_google_ortools_sat_mainJNI_SolutionCallback_1objectiveValue(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_)
SWIGEXPORT void JNICALL Java_com_google_ortools_sat_mainJNI_SolutionCallback_1change_1ownership(JNIEnv *jenv, jclass jcls, jobject jself, jlong objarg, jboolean jtake_or_release)
SWIGEXPORT jdouble JNICALL Java_com_google_ortools_sat_mainJNI_SolutionCallback_1wallTime(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_)
const char * java_exception
SWIG_JavaExceptionCodes code