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"
815 JNIEnvWrapper swigjnienv(
this) ;
816 JNIEnv * jenv = swigjnienv.getJNIEnv() ;
817 jobject swigjobj = (jobject) NULL ;
824 if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
825 jenv->CallStaticVoidMethod(Swig::jclass_mainJNI, Swig::director_method_ids[0], swigjobj);
826 jthrowable swigerror = jenv->ExceptionOccurred();
834 if (swigjobj) jenv->DeleteLocalRef(swigjobj);
841 jmethodID base_methid;
844 "onSolutionCallback",
"()V", NULL
848 static jclass baseclass = 0 ;
852 baseclass = jenv->FindClass(
"com/google/ortools/sat/SolutionCallback");
853 if (!baseclass)
return;
854 baseclass = (jclass) jenv->NewGlobalRef(baseclass);
856 bool derived = (jenv->IsSameObject(baseclass, jcls) ? false :
true);
857 for (
int i = 0; i < 1; ++i) {
858 if (!methods[i].base_methid) {
859 methods[i].base_methid = jenv->GetMethodID(baseclass, methods[i].mname, methods[i].mdesc);
860 if (!methods[i].base_methid)
return;
864 jmethodID methid = jenv->GetMethodID(jcls, methods[i].mname, methods[i].mdesc);
866 jenv->ExceptionClear();
879 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
883 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
889 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
894 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
895 ((operations_research::sat::SolutionCallback
const *)arg1)->OnSolutionCallback();
901 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
907 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
908 result = (int64_t)((operations_research::sat::SolutionCallback
const *)arg1)->NumBooleans();
909 jresult = (jlong)result;
916 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
922 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
923 result = (int64_t)((operations_research::sat::SolutionCallback
const *)arg1)->NumBranches();
924 jresult = (jlong)result;
931 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
937 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
938 result = (int64_t)((operations_research::sat::SolutionCallback
const *)arg1)->NumConflicts();
939 jresult = (jlong)result;
946 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
952 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
953 result = (int64_t)((operations_research::sat::SolutionCallback
const *)arg1)->NumBinaryPropagations();
954 jresult = (jlong)result;
961 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
967 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
968 result = (int64_t)((operations_research::sat::SolutionCallback
const *)arg1)->NumIntegerPropagations();
969 jresult = (jlong)result;
975 jdouble jresult = 0 ;
976 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
982 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
983 result = (double)((operations_research::sat::SolutionCallback
const *)arg1)->WallTime();
984 jresult = (jdouble)result;
990 jdouble jresult = 0 ;
991 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
997 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
998 result = (double)((operations_research::sat::SolutionCallback
const *)arg1)->UserTime();
999 jresult = (jdouble)result;
1005 jdouble jresult = 0 ;
1006 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
1012 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
1013 result = (double)((operations_research::sat::SolutionCallback
const *)arg1)->ObjectiveValue();
1014 jresult = (jdouble)result;
1020 jdouble jresult = 0 ;
1021 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
1027 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
1028 result = (double)((operations_research::sat::SolutionCallback
const *)arg1)->BestObjectiveBound();
1029 jresult = (jdouble)result;
1036 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
1043 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
1045 result = (int64_t)(arg1)->SolutionIntegerValue(arg2);
1046 jresult = (jlong)result;
1052 jboolean jresult = 0 ;
1053 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
1060 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
1062 result = (bool)(arg1)->SolutionBooleanValue(arg2);
1063 jresult = (jboolean)result;
1069 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
1074 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
1075 (arg1)->StopSearch();
1081 operations_research::sat::SolutionCallback *result = 0 ;
1086 *(operations_research::sat::SolutionCallback **)&jresult = result;
1092 operations_research::sat::SolutionCallback *obj = *((operations_research::sat::SolutionCallback **)&objarg);
1095 director->
swig_connect_director(jenv, jself, jenv->GetObjectClass(jself), (jswig_mem_own == JNI_TRUE), (jweak_global == JNI_TRUE));
1100 operations_research::sat::SolutionCallback *obj = *((operations_research::sat::SolutionCallback **)&objarg);
1110 operations_research::sat::SolveWrapper *arg1 = (operations_research::sat::SolveWrapper *) 0 ;
1111 operations_research::sat::SatParameters *arg2 = 0 ;
1112 operations_research::sat::SatParameters temp2 ;
1117 arg1 = *(operations_research::sat::SolveWrapper **)&jarg1;
1120 std::unique_ptr<char[]> proto_buffer(
1122 bool parsed_ok = temp2.ParseFromArray(proto_buffer.get(), proto_size);
1126 "Unable to parse operations_research::sat::SatParameters protocol message.");
1130 (arg1)->SetParameters((operations_research::sat::SatParameters
const &)*arg2);
1135 operations_research::sat::SolveWrapper *arg1 = (operations_research::sat::SolveWrapper *) 0 ;
1136 operations_research::sat::SolutionCallback *arg2 = 0 ;
1142 arg1 = *(operations_research::sat::SolveWrapper **)&jarg1;
1143 arg2 = *(operations_research::sat::SolutionCallback **)&jarg2;
1148 (arg1)->AddSolutionCallback((operations_research::sat::SolutionCallback
const &)*arg2);
1153 operations_research::sat::SolveWrapper *arg1 = (operations_research::sat::SolveWrapper *) 0 ;
1154 operations_research::sat::SolutionCallback *arg2 = 0 ;
1160 arg1 = *(operations_research::sat::SolveWrapper **)&jarg1;
1161 arg2 = *(operations_research::sat::SolutionCallback **)&jarg2;
1166 (arg1)->ClearSolutionCallback((operations_research::sat::SolutionCallback
const &)*arg2);
1171 operations_research::sat::SolveWrapper *arg1 = (operations_research::sat::SolveWrapper *) 0 ;
1172 SwigValueWrapper< std::function< void (std::string
const &) > > arg2 ;
1177 arg1 = *(operations_research::sat::SolveWrapper **)&jarg1;
1179 jclass jarg2_object_class = jenv->GetObjectClass(jarg2);
1180 if (
nullptr == jarg2_object_class) return ;
1183 jmethodID jarg2_method_id = jenv->GetMethodID(
1184 jarg2_object_class,
"accept",
"(Ljava/lang/Object;)V");
1185 assert(jarg2_method_id !=
nullptr);
1187 jobject jarg2_object = jenv->NewGlobalRef(jarg2);
1190 auto jarg2_guard = std::make_shared<GlobalRefGuard>(jenv, jarg2_object);
1191 arg2 = [jenv, jarg2_object, jarg2_method_id, jarg2_guard](
1192 const std::string&
message) ->
void {
1193 return jenv->CallVoidMethod(jarg2_object, jarg2_method_id,
1194 (jenv)->NewStringUTF(
message.c_str()));
1197 (arg1)->AddLogCallback(arg2);
1202 jbyteArray jresult = 0 ;
1203 operations_research::sat::SolveWrapper *arg1 = (operations_research::sat::SolveWrapper *) 0 ;
1204 operations_research::sat::CpModelProto *arg2 = 0 ;
1205 operations_research::sat::CpModelProto temp2 ;
1206 operations_research::sat::CpSolverResponse result;
1211 arg1 = *(operations_research::sat::SolveWrapper **)&jarg1;
1214 std::unique_ptr<char[]> proto_buffer(
1216 bool parsed_ok = temp2.ParseFromArray(proto_buffer.get(), proto_size);
1220 "Unable to parse operations_research::sat::CpModelProto protocol message.");
1224 result = (arg1)->
Solve((operations_research::sat::CpModelProto
const &)*arg2);
1226 const long size = (&result)->ByteSizeLong();
1227 std::unique_ptr<char[]> buf(
new char[size]);
1228 (&result)->SerializeWithCachedSizesToArray(
reinterpret_cast<uint8_t*
>(buf.get()));
1236 operations_research::sat::SolveWrapper *arg1 = (operations_research::sat::SolveWrapper *) 0 ;
1241 arg1 = *(operations_research::sat::SolveWrapper **)&jarg1;
1242 (arg1)->StopSearch();
1248 operations_research::sat::SolveWrapper *result = 0 ;
1252 result = (operations_research::sat::SolveWrapper *)
new operations_research::sat::SolveWrapper();
1253 *(operations_research::sat::SolveWrapper **)&jresult = result;
1259 operations_research::sat::SolveWrapper *arg1 = (operations_research::sat::SolveWrapper *) 0 ;
1263 arg1 = *(operations_research::sat::SolveWrapper **)&jarg1;
1269 jstring jresult = 0 ;
1270 operations_research::sat::CpModelProto *arg1 = 0 ;
1271 operations_research::sat::CpModelProto temp1 ;
1278 std::unique_ptr<char[]> proto_buffer(
1280 bool parsed_ok = temp1.ParseFromArray(proto_buffer.get(), proto_size);
1284 "Unable to parse operations_research::sat::CpModelProto protocol message.");
1288 result = operations_research::sat::CpSatHelper::ModelStats((operations_research::sat::CpModelProto
const &)*arg1);
1289 jresult = jenv->NewStringUTF((&result)->c_str());
1295 jstring jresult = 0 ;
1296 operations_research::sat::CpSolverResponse *arg1 = 0 ;
1297 operations_research::sat::CpSolverResponse temp1 ;
1304 std::unique_ptr<char[]> proto_buffer(
1306 bool parsed_ok = temp1.ParseFromArray(proto_buffer.get(), proto_size);
1310 "Unable to parse operations_research::sat::CpSolverResponse protocol message.");
1314 result = operations_research::sat::CpSatHelper::SolverResponseStats((operations_research::sat::CpSolverResponse
const &)*arg1);
1315 jresult = jenv->NewStringUTF((&result)->c_str());
1321 jstring jresult = 0 ;
1322 operations_research::sat::CpModelProto *arg1 = 0 ;
1323 operations_research::sat::CpModelProto temp1 ;
1330 std::unique_ptr<char[]> proto_buffer(
1332 bool parsed_ok = temp1.ParseFromArray(proto_buffer.get(), proto_size);
1336 "Unable to parse operations_research::sat::CpModelProto protocol message.");
1341 jresult = jenv->NewStringUTF((&result)->c_str());
1348 operations_research::sat::IntegerVariableProto *arg1 = 0 ;
1349 operations_research::sat::IntegerVariableProto temp1 ;
1356 std::unique_ptr<char[]> proto_buffer(
1358 bool parsed_ok = temp1.ParseFromArray(proto_buffer.get(), proto_size);
1362 "Unable to parse operations_research::sat::IntegerVariableProto protocol message.");
1366 result = operations_research::sat::CpSatHelper::VariableDomain((operations_research::sat::IntegerVariableProto
const &)*arg1);
1373 jboolean jresult = 0 ;
1374 operations_research::sat::CpModelProto *arg1 = 0 ;
1375 std::string *arg2 = 0 ;
1376 operations_research::sat::CpModelProto temp1 ;
1383 std::unique_ptr<char[]> proto_buffer(
1385 bool parsed_ok = temp1.ParseFromArray(proto_buffer.get(), proto_size);
1389 "Unable to parse operations_research::sat::CpModelProto protocol message.");
1397 const char *arg2_pstr = (
const char *)jenv->GetStringUTFChars(jarg2, 0);
1398 if (!arg2_pstr)
return 0;
1399 std::string arg2_str(arg2_pstr);
1401 jenv->ReleaseStringUTFChars(jarg2, arg2_pstr);
1402 result = (bool)operations_research::sat::CpSatHelper::WriteModelToFile((operations_research::sat::CpModelProto
const &)*arg1,(std::string
const &)*arg2);
1403 jresult = (jboolean)result;
1410 operations_research::sat::CpSatHelper *result = 0 ;
1414 result = (operations_research::sat::CpSatHelper *)
new operations_research::sat::CpSatHelper();
1415 *(operations_research::sat::CpSatHelper **)&jresult = result;
1421 operations_research::sat::CpSatHelper *arg1 = (operations_research::sat::CpSatHelper *) 0 ;
1425 arg1 = *(operations_research::sat::CpSatHelper **)&jarg1;
1435 const char *signature;
1438 "SwigDirector_SolutionCallback_onSolutionCallback",
"(Lcom/google/ortools/sat/SolutionCallback;)V"
1441 Swig::jclass_mainJNI = (jclass) jenv->NewGlobalRef(jcls);
1442 if (!Swig::jclass_mainJNI)
return;
1443 for (i = 0; i < (int) (
sizeof(methods)/
sizeof(methods[0])); ++i) {
1444 Swig::director_method_ids[i] = jenv->GetStaticMethodID(jcls, methods[i].method, methods[i].signature);
1445 if (!Swig::director_method_ids[i])
return;
GlobalRefGuard(JNIEnv *jenv, jobject jref)
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)
absl::Status ValidateModel(const ModelProto &model, const bool check_names)
CpSolverResponse Solve(const CpModelProto &model_proto)
Solves the given CpModelProto and returns an instance of CpSolverResponse.
Collection of objects used to extend the Constraint Solver library.
SWIGEXPORT void JNICALL Java_com_google_ortools_sat_mainJNI_delete_1SolveWrapper(JNIEnv *jenv, jclass jcls, jlong jarg1)
SWIGEXPORT jstring JNICALL Java_com_google_ortools_sat_mainJNI_CpSatHelper_1validateModel(JNIEnv *jenv, jclass jcls, jbyteArray jarg1)
SWIGEXPORT void JNICALL Java_com_google_ortools_sat_mainJNI_SolveWrapper_1setParameters(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyteArray jarg2)
SWIGEXPORT jboolean JNICALL Java_com_google_ortools_sat_mainJNI_CpSatHelper_1writeModelToFile(JNIEnv *jenv, jclass jcls, jbyteArray jarg1, jstring jarg2)
SWIGEXPORT jstring JNICALL Java_com_google_ortools_sat_mainJNI_CpSatHelper_1modelStats(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 jlong JNICALL Java_com_google_ortools_sat_mainJNI_new_1CpSatHelper(JNIEnv *jenv, jclass jcls)
SWIGEXPORT jdouble JNICALL Java_com_google_ortools_sat_mainJNI_SolutionCallback_1bestObjectiveBound(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject 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 jlong JNICALL Java_com_google_ortools_sat_mainJNI_CpSatHelper_1variableDomain(JNIEnv *jenv, jclass jcls, jbyteArray jarg1)
SWIGEXPORT jstring JNICALL Java_com_google_ortools_sat_mainJNI_CpSatHelper_1solverResponseStats(JNIEnv *jenv, jclass jcls, jbyteArray jarg1)
SWIGEXPORT void JNICALL Java_com_google_ortools_sat_mainJNI_SolveWrapper_1addLogCallback(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jobject 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_SolutionCallback_1numBranches(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject 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 void JNICALL Java_com_google_ortools_sat_mainJNI_SolveWrapper_1stopSearch(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_SolveWrapper_1addSolutionCallback(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_)
SWIGEXPORT jlong JNICALL Java_com_google_ortools_sat_mainJNI_new_1SolveWrapper(JNIEnv *jenv, jclass jcls)
SWIGEXPORT void JNICALL Java_com_google_ortools_sat_mainJNI_delete_1CpSatHelper(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_SolveWrapper_1clearSolutionCallback(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_)
SWIGEXPORT jbyteArray JNICALL Java_com_google_ortools_sat_mainJNI_SolveWrapper_1solve(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyteArray 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