21template<
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; }
37template <
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
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
86# pragma warning(disable : 4505)
92# define SWIGUNUSEDPARM(p)
94# define SWIGUNUSEDPARM(p) p SWIGUNUSED
100# define SWIGINTERN static SWIGUNUSED
104#ifndef SWIGINTERNINLINE
105# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
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;
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];
774#include "ortools/sat/swig_helper.h"
788 JavaVMAttachArgs args;
789 args.version = JNI_VERSION_1_2;
792 jvm_->AttachCurrentThread((
void**)&jenv, &args);
793 jenv->DeleteGlobalRef(jref_);
794 jvm_->DetachCurrentThread();
818 JNIEnvWrapper swigjnienv(
this) ;
819 JNIEnv * jenv = swigjnienv.getJNIEnv() ;
820 jobject swigjobj = (jobject) NULL ;
827 if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
828 jenv->CallStaticVoidMethod(Swig::jclass_mainJNI, Swig::director_method_ids[0], swigjobj);
829 jthrowable swigerror = jenv->ExceptionOccurred();
837 if (swigjobj) jenv->DeleteLocalRef(swigjobj);
844 jmethodID base_methid;
847 "onSolutionCallback",
"()V", NULL
851 static jclass baseclass = 0 ;
855 baseclass = jenv->FindClass(
"com/google/ortools/sat/SolutionCallback");
856 if (!baseclass)
return;
857 baseclass = (jclass) jenv->NewGlobalRef(baseclass);
859 bool derived = (jenv->IsSameObject(baseclass, jcls) ? false :
true);
860 for (
int i = 0; i < 1; ++i) {
861 if (!methods[i].base_methid) {
862 methods[i].base_methid = jenv->GetMethodID(baseclass, methods[i].mname, methods[i].mdesc);
863 if (!methods[i].base_methid)
return;
867 jmethodID methid = jenv->GetMethodID(jcls, methods[i].mname, methods[i].mdesc);
869 jenv->ExceptionClear();
882 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
886 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
892 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
897 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
898 ((operations_research::sat::SolutionCallback
const *)arg1)->OnSolutionCallback();
904 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
910 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
911 result = (int64_t)((operations_research::sat::SolutionCallback
const *)arg1)->NumBooleans();
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_t)((operations_research::sat::SolutionCallback
const *)arg1)->NumBranches();
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_t)((operations_research::sat::SolutionCallback
const *)arg1)->NumConflicts();
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_t)((operations_research::sat::SolutionCallback
const *)arg1)->NumBinaryPropagations();
957 jresult = (jlong)result;
964 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
970 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
971 result = (int64_t)((operations_research::sat::SolutionCallback
const *)arg1)->NumIntegerPropagations();
972 jresult = (jlong)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)->WallTime();
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)->UserTime();
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)->ObjectiveValue();
1017 jresult = (jdouble)result;
1023 jdouble jresult = 0 ;
1024 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
1030 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
1031 result = (double)((operations_research::sat::SolutionCallback
const *)arg1)->BestObjectiveBound();
1032 jresult = (jdouble)result;
1039 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
1046 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
1048 result = (int64_t)(arg1)->SolutionIntegerValue(arg2);
1049 jresult = (jlong)result;
1055 jboolean jresult = 0 ;
1056 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
1063 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
1065 result = (bool)(arg1)->SolutionBooleanValue(arg2);
1066 jresult = (jboolean)result;
1072 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
1077 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
1078 (arg1)->StopSearch();
1084 operations_research::sat::SolutionCallback *result = 0 ;
1089 *(operations_research::sat::SolutionCallback **)&jresult = result;
1095 operations_research::sat::SolutionCallback *obj = *((operations_research::sat::SolutionCallback **)&objarg);
1098 director->
swig_connect_director(jenv, jself, jenv->GetObjectClass(jself), (jswig_mem_own == JNI_TRUE), (jweak_global == JNI_TRUE));
1103 operations_research::sat::SolutionCallback *obj = *((operations_research::sat::SolutionCallback **)&objarg);
1113 operations_research::sat::SolveWrapper *arg1 = (operations_research::sat::SolveWrapper *) 0 ;
1120 arg1 = *(operations_research::sat::SolveWrapper **)&jarg1;
1123 std::unique_ptr<char[]> proto_buffer(
1125 bool parsed_ok = temp2.ParseFromArray(proto_buffer.get(), proto_size);
1129 "Unable to parse operations_research::sat::SatParameters protocol message.");
1138 operations_research::sat::SolveWrapper *arg1 = (operations_research::sat::SolveWrapper *) 0 ;
1139 operations_research::sat::SolutionCallback *arg2 = 0 ;
1145 arg1 = *(operations_research::sat::SolveWrapper **)&jarg1;
1146 arg2 = *(operations_research::sat::SolutionCallback **)&jarg2;
1151 (arg1)->AddSolutionCallback((operations_research::sat::SolutionCallback
const &)*arg2);
1156 operations_research::sat::SolveWrapper *arg1 = (operations_research::sat::SolveWrapper *) 0 ;
1157 operations_research::sat::SolutionCallback *arg2 = 0 ;
1163 arg1 = *(operations_research::sat::SolveWrapper **)&jarg1;
1164 arg2 = *(operations_research::sat::SolutionCallback **)&jarg2;
1169 (arg1)->ClearSolutionCallback((operations_research::sat::SolutionCallback
const &)*arg2);
1174 operations_research::sat::SolveWrapper *arg1 = (operations_research::sat::SolveWrapper *) 0 ;
1175 SwigValueWrapper< std::function< void (std::string
const &) > > arg2 ;
1180 arg1 = *(operations_research::sat::SolveWrapper **)&jarg1;
1184 jobject jarg2_object = jenv->NewGlobalRef(jarg2);
1188 jenv->GetJavaVM(&jvm);
1189 auto jarg2_guard = std::make_shared<GlobalRefGuard>(jvm, jarg2_object);
1191 jclass jarg2_object_class = jenv->GetObjectClass(jarg2);
1192 if (
nullptr == jarg2_object_class) return ;
1193 jmethodID jarg2_method_id = jenv->GetMethodID(
1194 jarg2_object_class,
"accept",
"(Ljava/lang/Object;)V");
1195 assert(jarg2_method_id !=
nullptr);
1198 arg2 = [jvm, jarg2_object, jarg2_method_id, jarg2_guard](
1199 const std::string&
message) ->
void {
1200 JNIEnv *jenv = NULL;
1201 JavaVMAttachArgs args;
1202 args.version = JNI_VERSION_1_2;
1205 jvm->AttachCurrentThread((
void**)&jenv, &args);
1206 jenv->CallVoidMethod(jarg2_object, jarg2_method_id, (jenv)->NewStringUTF(
message.c_str()));
1207 jvm->DetachCurrentThread();
1210 (arg1)->AddLogCallback(arg2);
1215 jbyteArray jresult = 0 ;
1216 operations_research::sat::SolveWrapper *arg1 = (operations_research::sat::SolveWrapper *) 0 ;
1224 arg1 = *(operations_research::sat::SolveWrapper **)&jarg1;
1227 std::unique_ptr<char[]> proto_buffer(
1229 bool parsed_ok = temp2.ParseFromArray(proto_buffer.get(), proto_size);
1233 "Unable to parse operations_research::sat::CpModelProto protocol message.");
1239 const long size = (&result)->ByteSizeLong();
1240 std::unique_ptr<char[]> buf(
new char[size]);
1241 (&result)->SerializeWithCachedSizesToArray(
reinterpret_cast<uint8_t*
>(buf.get()));
1249 operations_research::sat::SolveWrapper *arg1 = (operations_research::sat::SolveWrapper *) 0 ;
1254 arg1 = *(operations_research::sat::SolveWrapper **)&jarg1;
1255 (arg1)->StopSearch();
1261 operations_research::sat::SolveWrapper *result = 0 ;
1265 result = (operations_research::sat::SolveWrapper *)
new operations_research::sat::SolveWrapper();
1266 *(operations_research::sat::SolveWrapper **)&jresult = result;
1272 operations_research::sat::SolveWrapper *arg1 = (operations_research::sat::SolveWrapper *) 0 ;
1276 arg1 = *(operations_research::sat::SolveWrapper **)&jarg1;
1282 jstring jresult = 0 ;
1291 std::unique_ptr<char[]> proto_buffer(
1293 bool parsed_ok = temp1.ParseFromArray(proto_buffer.get(), proto_size);
1297 "Unable to parse operations_research::sat::CpModelProto protocol message.");
1302 jresult = jenv->NewStringUTF((&result)->c_str());
1308 jstring jresult = 0 ;
1317 std::unique_ptr<char[]> proto_buffer(
1319 bool parsed_ok = temp1.ParseFromArray(proto_buffer.get(), proto_size);
1323 "Unable to parse operations_research::sat::CpSolverResponse protocol message.");
1328 jresult = jenv->NewStringUTF((&result)->c_str());
1334 jstring jresult = 0 ;
1343 std::unique_ptr<char[]> proto_buffer(
1345 bool parsed_ok = temp1.ParseFromArray(proto_buffer.get(), proto_size);
1349 "Unable to parse operations_research::sat::CpModelProto protocol message.");
1354 jresult = jenv->NewStringUTF((&result)->c_str());
1369 std::unique_ptr<char[]> proto_buffer(
1371 bool parsed_ok = temp1.ParseFromArray(proto_buffer.get(), proto_size);
1375 "Unable to parse operations_research::sat::IntegerVariableProto protocol message.");
1386 jboolean jresult = 0 ;
1388 std::string *arg2 = 0 ;
1396 std::unique_ptr<char[]> proto_buffer(
1398 bool parsed_ok = temp1.ParseFromArray(proto_buffer.get(), proto_size);
1402 "Unable to parse operations_research::sat::CpModelProto protocol message.");
1410 const char *arg2_pstr = (
const char *)jenv->GetStringUTFChars(jarg2, 0);
1411 if (!arg2_pstr)
return 0;
1412 std::string arg2_str(arg2_pstr);
1414 jenv->ReleaseStringUTFChars(jarg2, arg2_pstr);
1416 jresult = (jboolean)result;
1423 operations_research::sat::CpSatHelper *result = 0 ;
1427 result = (operations_research::sat::CpSatHelper *)
new operations_research::sat::CpSatHelper();
1428 *(operations_research::sat::CpSatHelper **)&jresult = result;
1434 operations_research::sat::CpSatHelper *arg1 = (operations_research::sat::CpSatHelper *) 0 ;
1438 arg1 = *(operations_research::sat::CpSatHelper **)&jarg1;
1448 const char *signature;
1451 "SwigDirector_SolutionCallback_onSolutionCallback",
"(Lcom/google/ortools/sat/SolutionCallback;)V"
1454 Swig::jclass_mainJNI = (jclass) jenv->NewGlobalRef(jcls);
1455 if (!Swig::jclass_mainJNI)
return;
1456 for (i = 0; i < (int) (
sizeof(methods)/
sizeof(methods[0])); ++i) {
1457 Swig::director_method_ids[i] = jenv->GetStaticMethodID(jcls, methods[i].method, methods[i].signature);
1458 if (!Swig::director_method_ids[i])
return;
GlobalRefGuard(JavaVM *jvm, 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) const
bool & operator[](size_t n)
JNIEnv * getJNIEnv() const
JNIEnvWrapper(const Director *director)
static void raise(JNIEnv *jenv, jthrowable throwable)
void raiseJavaException(JNIEnv *jenv) const
DirectorException(const char *msg)
const char * what() const
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
const char * c_str(const char *null_string="null JavaString") const
JavaString(JNIEnv *jenv, jstring jstr)
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::StatusOr< SolveResult > Solve(const Model &model, const SolverType solver_type, const SolveArguments &solve_args, const SolverInitArguments &init_args)
absl::Status ValidateModel(const ModelProto &model, const bool check_names)
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