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];
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"
797 JavaVMAttachArgs args;
798 args.version = JNI_VERSION_1_2;
801 jvm_->AttachCurrentThread((
void**)&jenv, &args);
802 jenv->DeleteGlobalRef(jref_);
803 jvm_->DetachCurrentThread();
827 JNIEnvWrapper swigjnienv(
this) ;
828 JNIEnv * jenv = swigjnienv.getJNIEnv() ;
829 jobject swigjobj = (jobject) NULL ;
836 if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
837 jenv->CallStaticVoidMethod(Swig::jclass_mainJNI, Swig::director_method_ids[0], swigjobj);
838 jthrowable swigerror = jenv->ExceptionOccurred();
846 if (swigjobj) jenv->DeleteLocalRef(swigjobj);
853 jmethodID base_methid;
856 "onSolutionCallback",
"()V", NULL
860 static jclass baseclass = 0 ;
864 baseclass = jenv->FindClass(
"com/google/ortools/sat/SolutionCallback");
865 if (!baseclass)
return;
866 baseclass = (jclass) jenv->NewGlobalRef(baseclass);
868 bool derived = (jenv->IsSameObject(baseclass, jcls) ? false :
true);
869 for (
int i = 0; i < 1; ++i) {
870 if (!methods[i].base_methid) {
871 methods[i].base_methid = jenv->GetMethodID(baseclass, methods[i].mname, methods[i].mdesc);
872 if (!methods[i].base_methid)
return;
876 jmethodID methid = jenv->GetMethodID(jcls, methods[i].mname, methods[i].mdesc);
878 jenv->ExceptionClear();
891 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
895 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
901 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
906 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
907 ((operations_research::sat::SolutionCallback
const *)arg1)->OnSolutionCallback();
913 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
919 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
920 result = (int64_t)((operations_research::sat::SolutionCallback
const *)arg1)->NumBooleans();
921 jresult = (jlong)result;
928 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
934 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
935 result = (int64_t)((operations_research::sat::SolutionCallback
const *)arg1)->NumBranches();
936 jresult = (jlong)result;
943 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
949 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
950 result = (int64_t)((operations_research::sat::SolutionCallback
const *)arg1)->NumConflicts();
951 jresult = (jlong)result;
958 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
964 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
965 result = (int64_t)((operations_research::sat::SolutionCallback
const *)arg1)->NumBinaryPropagations();
966 jresult = (jlong)result;
973 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
979 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
980 result = (int64_t)((operations_research::sat::SolutionCallback
const *)arg1)->NumIntegerPropagations();
981 jresult = (jlong)result;
987 jdouble jresult = 0 ;
988 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
994 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
995 result = (double)((operations_research::sat::SolutionCallback
const *)arg1)->WallTime();
996 jresult = (jdouble)result;
1002 jdouble jresult = 0 ;
1003 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
1009 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
1010 result = (double)((operations_research::sat::SolutionCallback
const *)arg1)->UserTime();
1011 jresult = (jdouble)result;
1017 jdouble jresult = 0 ;
1018 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
1024 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
1025 result = (double)((operations_research::sat::SolutionCallback
const *)arg1)->ObjectiveValue();
1026 jresult = (jdouble)result;
1032 jdouble jresult = 0 ;
1033 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
1039 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
1040 result = (double)((operations_research::sat::SolutionCallback
const *)arg1)->BestObjectiveBound();
1041 jresult = (jdouble)result;
1048 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
1055 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
1057 result = (int64_t)(arg1)->SolutionIntegerValue(arg2);
1058 jresult = (jlong)result;
1064 jboolean jresult = 0 ;
1065 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
1072 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
1074 result = (bool)(arg1)->SolutionBooleanValue(arg2);
1075 jresult = (jboolean)result;
1081 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
1086 arg1 = *(operations_research::sat::SolutionCallback **)&jarg1;
1087 (arg1)->StopSearch();
1093 operations_research::sat::SolutionCallback *result = 0 ;
1098 *(operations_research::sat::SolutionCallback **)&jresult = result;
1104 operations_research::sat::SolutionCallback *obj = *((operations_research::sat::SolutionCallback **)&objarg);
1107 director->
swig_connect_director(jenv, jself, jenv->GetObjectClass(jself), (jswig_mem_own == JNI_TRUE), (jweak_global == JNI_TRUE));
1112 operations_research::sat::SolutionCallback *obj = *((operations_research::sat::SolutionCallback **)&objarg);
1122 operations_research::sat::SolveWrapper *arg1 = (operations_research::sat::SolveWrapper *) 0 ;
1129 arg1 = *(operations_research::sat::SolveWrapper **)&jarg1;
1132 std::unique_ptr<char[]> proto_buffer(
1134 bool parsed_ok = temp2.ParseFromArray(proto_buffer.get(), proto_size);
1138 "Unable to parse operations_research::sat::SatParameters protocol message.");
1147 operations_research::sat::SolveWrapper *arg1 = (operations_research::sat::SolveWrapper *) 0 ;
1148 operations_research::sat::SolutionCallback *arg2 = 0 ;
1154 arg1 = *(operations_research::sat::SolveWrapper **)&jarg1;
1155 arg2 = *(operations_research::sat::SolutionCallback **)&jarg2;
1160 (arg1)->AddSolutionCallback((operations_research::sat::SolutionCallback
const &)*arg2);
1165 operations_research::sat::SolveWrapper *arg1 = (operations_research::sat::SolveWrapper *) 0 ;
1166 operations_research::sat::SolutionCallback *arg2 = 0 ;
1172 arg1 = *(operations_research::sat::SolveWrapper **)&jarg1;
1173 arg2 = *(operations_research::sat::SolutionCallback **)&jarg2;
1178 (arg1)->ClearSolutionCallback((operations_research::sat::SolutionCallback
const &)*arg2);
1183 operations_research::sat::SolveWrapper *arg1 = (operations_research::sat::SolveWrapper *) 0 ;
1184 SwigValueWrapper< std::function< void (std::string
const &) > > arg2 ;
1189 arg1 = *(operations_research::sat::SolveWrapper **)&jarg1;
1193 jobject jarg2_object = jenv->NewGlobalRef(jarg2);
1197 jenv->GetJavaVM(&jvm);
1198 auto jarg2_guard = std::make_shared<GlobalRefGuard>(jvm, jarg2_object);
1200 jclass jarg2_object_class = jenv->GetObjectClass(jarg2);
1201 if (
nullptr == jarg2_object_class) return ;
1202 jmethodID jarg2_method_id = jenv->GetMethodID(
1203 jarg2_object_class,
"accept",
"(Ljava/lang/Object;)V");
1204 assert(jarg2_method_id !=
nullptr);
1207 arg2 = [jvm, jarg2_object, jarg2_method_id, jarg2_guard](
1208 const std::string&
message) ->
void {
1209 JNIEnv *jenv = NULL;
1210 JavaVMAttachArgs args;
1211 args.version = JNI_VERSION_1_2;
1214 jvm->AttachCurrentThread((
void**)&jenv, &args);
1215 jenv->CallVoidMethod(jarg2_object, jarg2_method_id, (jenv)->NewStringUTF(
message.c_str()));
1216 jvm->DetachCurrentThread();
1219 (arg1)->AddLogCallback(arg2);
1224 jbyteArray jresult = 0 ;
1225 operations_research::sat::SolveWrapper *arg1 = (operations_research::sat::SolveWrapper *) 0 ;
1233 arg1 = *(operations_research::sat::SolveWrapper **)&jarg1;
1236 std::unique_ptr<char[]> proto_buffer(
1238 bool parsed_ok = temp2.ParseFromArray(proto_buffer.get(), proto_size);
1242 "Unable to parse operations_research::sat::CpModelProto protocol message.");
1248 const long size = (&result)->ByteSizeLong();
1249 std::unique_ptr<char[]> buf(
new char[size]);
1250 (&result)->SerializeWithCachedSizesToArray(
reinterpret_cast<uint8_t*
>(buf.get()));
1258 operations_research::sat::SolveWrapper *arg1 = (operations_research::sat::SolveWrapper *) 0 ;
1263 arg1 = *(operations_research::sat::SolveWrapper **)&jarg1;
1264 (arg1)->StopSearch();
1270 operations_research::sat::SolveWrapper *result = 0 ;
1274 result = (operations_research::sat::SolveWrapper *)
new operations_research::sat::SolveWrapper();
1275 *(operations_research::sat::SolveWrapper **)&jresult = result;
1281 operations_research::sat::SolveWrapper *arg1 = (operations_research::sat::SolveWrapper *) 0 ;
1285 arg1 = *(operations_research::sat::SolveWrapper **)&jarg1;
1291 jstring jresult = 0 ;
1300 std::unique_ptr<char[]> proto_buffer(
1302 bool parsed_ok = temp1.ParseFromArray(proto_buffer.get(), proto_size);
1306 "Unable to parse operations_research::sat::CpModelProto protocol message.");
1311 jresult = jenv->NewStringUTF((&result)->c_str());
1317 jstring jresult = 0 ;
1326 std::unique_ptr<char[]> proto_buffer(
1328 bool parsed_ok = temp1.ParseFromArray(proto_buffer.get(), proto_size);
1332 "Unable to parse operations_research::sat::CpSolverResponse protocol message.");
1337 jresult = jenv->NewStringUTF((&result)->c_str());
1343 jstring jresult = 0 ;
1352 std::unique_ptr<char[]> proto_buffer(
1354 bool parsed_ok = temp1.ParseFromArray(proto_buffer.get(), proto_size);
1358 "Unable to parse operations_research::sat::CpModelProto protocol message.");
1363 jresult = jenv->NewStringUTF((&result)->c_str());
1378 std::unique_ptr<char[]> proto_buffer(
1380 bool parsed_ok = temp1.ParseFromArray(proto_buffer.get(), proto_size);
1384 "Unable to parse operations_research::sat::IntegerVariableProto protocol message.");
1395 jboolean jresult = 0 ;
1397 std::string *arg2 = 0 ;
1405 std::unique_ptr<char[]> proto_buffer(
1407 bool parsed_ok = temp1.ParseFromArray(proto_buffer.get(), proto_size);
1411 "Unable to parse operations_research::sat::CpModelProto protocol message.");
1419 const char *arg2_pstr = (
const char *)jenv->GetStringUTFChars(jarg2, 0);
1420 if (!arg2_pstr)
return 0;
1421 std::string arg2_str(arg2_pstr);
1423 jenv->ReleaseStringUTFChars(jarg2, arg2_pstr);
1425 jresult = (jboolean)result;
1432 operations_research::sat::CpSatHelper *result = 0 ;
1436 result = (operations_research::sat::CpSatHelper *)
new operations_research::sat::CpSatHelper();
1437 *(operations_research::sat::CpSatHelper **)&jresult = result;
1443 operations_research::sat::CpSatHelper *arg1 = (operations_research::sat::CpSatHelper *) 0 ;
1447 arg1 = *(operations_research::sat::CpSatHelper **)&jarg1;
1457 const char *signature;
1460 "SwigDirector_SolutionCallback_onSolutionCallback",
"(Lcom/google/ortools/sat/SolutionCallback;)V"
1463 Swig::jclass_mainJNI = (jclass) jenv->NewGlobalRef(jcls);
1464 if (!Swig::jclass_mainJNI)
return;
1465 for (i = 0; i < (int) (
sizeof(methods)/
sizeof(methods[0])); ++i) {
1466 Swig::director_method_ids[i] = jenv->GetStaticMethodID(jcls, methods[i].method, methods[i].signature);
1467 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::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