16 #define SWIG_PYTHON_DIRECTOR_NO_VTABLE
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
167 #if defined(__GNUC__) && defined(_WIN32) && !defined(SWIG_PYTHON_NO_HYPOT_WORKAROUND)
172 #if defined(_DEBUG) && defined(SWIG_PYTHON_INTERPRETER_NO_DEBUG)
190 #define SWIG_RUNTIME_VERSION "4"
193 #ifdef SWIG_TYPE_TABLE
194 # define SWIG_QUOTE_STRING(x) #x
195 # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
196 # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
198 # define SWIG_TYPE_TABLE_NAME
211 # define SWIGRUNTIME SWIGINTERN
214 #ifndef SWIGRUNTIMEINLINE
215 # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
219 #ifndef SWIG_BUFFER_SIZE
220 # define SWIG_BUFFER_SIZE 1024
224 #define SWIG_POINTER_DISOWN 0x1
225 #define SWIG_CAST_NEW_MEMORY 0x2
226 #define SWIG_POINTER_NO_NULL 0x4
229 #define SWIG_POINTER_OWN 0x1
312 #define SWIG_ERROR (-1)
313 #define SWIG_IsOK(r) (r >= 0)
314 #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
317 #define SWIG_CASTRANKLIMIT (1 << 8)
319 #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
321 #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
323 #define SWIG_BADOBJ (SWIG_ERROR)
324 #define SWIG_OLDOBJ (SWIG_OK)
325 #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
326 #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
328 #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
329 #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
330 #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
331 #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
332 #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
333 #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
336 #if defined(SWIG_CASTRANK_MODE)
337 # ifndef SWIG_TypeRank
338 # define SWIG_TypeRank unsigned long
340 # ifndef SWIG_MAXCASTRANK
341 # define SWIG_MAXCASTRANK (2)
343 # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
344 # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
349 return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
352 # define SWIG_AddCast(r) (r)
353 # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
363 typedef void *(*swig_converter_func)(
void *,
int *);
405 const char *f2,
const char *l2) {
406 for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
407 while ((*f1 ==
' ') && (f1 != l1)) ++f1;
408 while ((*f2 ==
' ') && (f2 != l2)) ++f2;
409 if (*f1 != *f2)
return (*f1 > *f2) ? 1 : -1;
411 return (
int)((l1 - f1) - (l2 - f2));
421 const char* te = tb + strlen(tb);
423 while (equiv != 0 && *ne) {
424 for (nb = ne; *ne; ++ne) {
425 if (*ne ==
'|')
break;
450 if (strcmp(iter->
type->
name, c) == 0) {
451 if (iter == ty->
cast)
477 if (iter->
type == from) {
478 if (iter == ty->
cast)
510 if (!ty || !ty->
dcast)
return ty;
511 while (ty && (ty->
dcast)) {
512 ty = (*ty->
dcast)(ptr);
536 if (!type)
return NULL;
537 if (type->
str != NULL) {
538 const char *last_name = type->
str;
540 for (s = type->
str; *s; s++)
541 if (*s ==
'|') last_name = s+1;
589 size_t r = iter->
size - 1;
592 size_t i = (l + r) >> 1;
593 const char *iname = iter->
types[i]->
name;
595 int compare = strcmp(
name, iname);
597 return iter->
types[i];
598 }
else if (compare < 0) {
604 }
else if (compare > 0) {
613 }
while (iter != end);
640 for (; i < iter->
size; ++i) {
642 return iter->
types[i];
645 }
while (iter != end);
657 static const char hex[17] =
"0123456789abcdef";
658 const unsigned char *u = (
unsigned char *) ptr;
659 const unsigned char *eu = u + sz;
660 for (; u != eu; ++u) {
661 unsigned char uu = *u;
662 *(c++) = hex[(uu & 0xf0) >> 4];
663 *(c++) = hex[uu & 0xf];
673 unsigned char *u = (
unsigned char *) ptr;
674 const unsigned char *eu = u + sz;
675 for (; u != eu; ++u) {
678 if ((d >=
'0') && (d <=
'9'))
679 uu = (
unsigned char)((d -
'0') << 4);
680 else if ((d >=
'a') && (d <=
'f'))
681 uu = (
unsigned char)((d - (
'a'-10)) << 4);
685 if ((d >=
'0') && (d <=
'9'))
686 uu |= (
unsigned char)(d -
'0');
687 else if ((d >=
'a') && (d <=
'f'))
688 uu |= (
unsigned char)(d - (
'a'-10));
702 if ((2*
sizeof(
void *) + 2) > bsz)
return 0;
705 if (strlen(
name) + 1 > (bsz - (r - buff)))
return 0;
713 if (strcmp(c,
"NULL") == 0) {
726 size_t lname = (
name ? strlen(
name) : 0);
727 if ((2*sz + 2 + lname) > bsz)
return 0;
731 strncpy(r,
name,lname+1);
741 if (strcmp(c,
"NULL") == 0) {
756 #define SWIG_UnknownError -1
757 #define SWIG_IOError -2
758 #define SWIG_RuntimeError -3
759 #define SWIG_IndexError -4
760 #define SWIG_TypeError -5
761 #define SWIG_DivisionByZero -6
762 #define SWIG_OverflowError -7
763 #define SWIG_SyntaxError -8
764 #define SWIG_ValueError -9
765 #define SWIG_SystemError -10
766 #define SWIG_AttributeError -11
767 #define SWIG_MemoryError -12
768 #define SWIG_NullReferenceError -13
773 #if PY_VERSION_HEX >= 0x03000000
775 #define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type)
776 #define PyInt_Check(x) PyLong_Check(x)
777 #define PyInt_AsLong(x) PyLong_AsLong(x)
778 #define PyInt_FromLong(x) PyLong_FromLong(x)
779 #define PyInt_FromSize_t(x) PyLong_FromSize_t(x)
780 #define PyString_Check(name) PyBytes_Check(name)
781 #define PyString_FromString(x) PyUnicode_FromString(x)
782 #define PyString_Format(fmt, args) PyUnicode_Format(fmt, args)
783 #define PyString_AsString(str) PyBytes_AsString(str)
784 #define PyString_Size(str) PyBytes_Size(str)
785 #define PyString_InternFromString(key) PyUnicode_InternFromString(key)
786 #define Py_TPFLAGS_HAVE_CLASS Py_TPFLAGS_BASETYPE
787 #define PyString_AS_STRING(x) PyUnicode_AS_STRING(x)
788 #define _PyLong_FromSsize_t(x) PyLong_FromSsize_t(x)
793 # define Py_TYPE(op) ((op)->ob_type)
798 #if PY_VERSION_HEX >= 0x03000000
799 # define SWIG_Python_str_FromFormat PyUnicode_FromFormat
801 # define SWIG_Python_str_FromFormat PyString_FromFormat
811 #if PY_VERSION_HEX >= 0x03030000
812 return (
char *)PyUnicode_AsUTF8(str);
813 #elif PY_VERSION_HEX >= 0x03000000
815 str = PyUnicode_AsUTF8String(str);
819 if (PyBytes_AsStringAndSize(str, &cstr, &len) != -1) {
820 newstr = (
char *)
malloc(len+1);
822 memcpy(newstr, cstr, len+1);
828 return PyString_AsString(str);
832 #if PY_VERSION_HEX >= 0x03030000 || PY_VERSION_HEX < 0x03000000
833 # define SWIG_Python_str_DelForPy3(x)
835 # define SWIG_Python_str_DelForPy3(x) free( (void*) (x) )
842 #if PY_VERSION_HEX >= 0x03000000
843 return PyUnicode_FromString(c);
845 return PyString_FromString(c);
850 # define PyObject_DEL PyObject_Del
855 # define SWIGPY_USE_CAPSULE
856 # define SWIGPY_CAPSULE_NAME ("swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME)
858 #if PY_VERSION_HEX < 0x03020000
859 #define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type)
860 #define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name)
861 #define Py_hash_t long
873 type = PyExc_MemoryError;
876 type = PyExc_IOError;
879 type = PyExc_RuntimeError;
882 type = PyExc_IndexError;
885 type = PyExc_TypeError;
888 type = PyExc_ZeroDivisionError;
891 type = PyExc_OverflowError;
894 type = PyExc_SyntaxError;
897 type = PyExc_ValueError;
900 type = PyExc_SystemError;
903 type = PyExc_AttributeError;
906 type = PyExc_RuntimeError;
917 PyObject *traceback = 0;
919 if (PyErr_Occurred())
920 PyErr_Fetch(&type, &
value, &traceback);
922 PyObject *old_str = PyObject_Str(
value);
927 PyErr_Format(type,
"%s %s", tmp, mesg);
929 PyErr_Format(type,
"%s", mesg);
934 PyErr_SetString(PyExc_RuntimeError, mesg);
944 error = PyErr_Occurred();
945 return error && PyErr_GivenExceptionMatches(error, PyExc_TypeError);
954 PyObject *type = NULL, *
value = NULL, *traceback = NULL;
955 PyErr_Fetch(&type, &
value, &traceback);
956 #if PY_VERSION_HEX >= 0x03000000
957 newvalue = PyUnicode_FromFormat(
"%S\nAdditional information:\n%s",
value,
message);
959 newvalue = PyString_FromFormat(
"%s\nAdditional information:\n%s", PyString_AsString(
value),
message);
962 PyErr_Restore(type, newvalue, traceback);
965 PyErr_SetString(PyExc_TypeError,
message);
969 #if defined(SWIG_PYTHON_NO_THREADS)
970 # if defined(SWIG_PYTHON_THREADS)
971 # undef SWIG_PYTHON_THREADS
974 #if defined(SWIG_PYTHON_THREADS)
975 # if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL)
976 # define SWIG_PYTHON_USE_GIL
978 # if defined(SWIG_PYTHON_USE_GIL)
979 # ifndef SWIG_PYTHON_INITIALIZE_THREADS
980 # define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads()
983 class SWIG_Python_Thread_Block {
985 PyGILState_STATE state;
987 void end() {
if (status) { PyGILState_Release(state); status =
false;} }
988 SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {}
989 ~SWIG_Python_Thread_Block() { end(); }
991 class SWIG_Python_Thread_Allow {
995 void end() {
if (status) { PyEval_RestoreThread(save); status =
false; }}
996 SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {}
997 ~SWIG_Python_Thread_Allow() { end(); }
999 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block
1000 # define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end()
1001 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow _swig_thread_allow
1002 # define SWIG_PYTHON_THREAD_END_ALLOW _swig_thread_allow.end()
1004 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK PyGILState_STATE _swig_thread_block = PyGILState_Ensure()
1005 # define SWIG_PYTHON_THREAD_END_BLOCK PyGILState_Release(_swig_thread_block)
1006 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW PyThreadState *_swig_thread_allow = PyEval_SaveThread()
1007 # define SWIG_PYTHON_THREAD_END_ALLOW PyEval_RestoreThread(_swig_thread_allow)
1010 # if !defined(SWIG_PYTHON_INITIALIZE_THREADS)
1011 # define SWIG_PYTHON_INITIALIZE_THREADS
1013 # if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK)
1014 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK
1016 # if !defined(SWIG_PYTHON_THREAD_END_BLOCK)
1017 # define SWIG_PYTHON_THREAD_END_BLOCK
1019 # if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW)
1020 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW
1022 # if !defined(SWIG_PYTHON_THREAD_END_ALLOW)
1023 # define SWIG_PYTHON_THREAD_END_ALLOW
1027 # define SWIG_PYTHON_INITIALIZE_THREADS
1028 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK
1029 # define SWIG_PYTHON_THREAD_END_BLOCK
1030 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW
1031 # define SWIG_PYTHON_THREAD_END_ALLOW
1047 #define SWIG_PY_POINTER 4
1048 #define SWIG_PY_BINARY 5
1074 #if PY_VERSION_HEX < 0x02070000
1075 # error "This version of SWIG only supports Python >= 2.7"
1078 #if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03020000
1079 # error "This version of SWIG only supports Python 3 >= 3.2"
1085 #define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
1086 #define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags)
1087 #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own)
1089 #ifdef SWIGPYTHON_BUILTIN
1090 #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(self, ptr, type, flags)
1092 #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
1095 #define SWIG_InternalNewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
1097 #define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty)
1098 #define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src)
1099 #define swig_owntype int
1102 #define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
1103 #define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
1106 #define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags)
1107 #define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags)
1110 #define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type)
1111 #define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(NULL, ptr, type, 0)
1114 #define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
1115 #define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
1120 #define SWIG_GetModule(clientdata) SWIG_Python_GetModule(clientdata)
1121 #define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer)
1122 #define SWIG_NewClientData(obj) SwigPyClientData_New(obj)
1124 #define SWIG_SetErrorObj SWIG_Python_SetErrorObj
1125 #define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg
1126 #define SWIG_ErrorType(code) SWIG_Python_ErrorType(code)
1127 #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg)
1128 #define SWIG_fail goto fail
1138 PyErr_SetObject(errtype, obj);
1146 PyErr_SetString(errtype, msg);
1150 #define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj)
1154 #if defined(SWIGPYTHON_BUILTIN)
1157 SwigPyBuiltin_AddPublicSymbol(PyObject *seq,
const char *key) {
1158 PyObject *s = PyString_InternFromString(key);
1159 PyList_Append(seq, s);
1165 PyDict_SetItemString(d,
name, obj);
1167 if (public_interface)
1168 SwigPyBuiltin_AddPublicSymbol(public_interface,
name);
1175 PyDict_SetItemString(d,
name, obj);
1187 }
else if (result == Py_None) {
1191 if (!PyList_Check(result)) {
1192 PyObject *o2 = result;
1193 result = PyList_New(1);
1194 PyList_SetItem(result, 0, o2);
1196 PyList_Append(result,obj);
1211 PyErr_Format(PyExc_TypeError,
"%s expected %s%d arguments, got none",
1216 if (!PyTuple_Check(args)) {
1217 if (min <= 1 && max >= 1) {
1220 for (i = 1; i <
max; ++i) {
1225 PyErr_SetString(PyExc_SystemError,
"UnpackTuple() argument list is not a tuple");
1228 Py_ssize_t l = PyTuple_GET_SIZE(args);
1230 PyErr_Format(PyExc_TypeError,
"%s expected %s%d arguments, got %d",
1233 }
else if (l >
max) {
1234 PyErr_Format(PyExc_TypeError,
"%s expected %s%d arguments, got %d",
1239 for (i = 0; i < l; ++i) {
1240 objs[i] = PyTuple_GET_ITEM(args, i);
1242 for (; l <
max; ++l) {
1254 assert(PyDict_Check(kwargs));
1255 if (PyDict_Size(kwargs) > 0) {
1256 PyErr_Format(PyExc_TypeError,
"%s() does not take keyword arguments",
name);
1264 #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL);
1271 #define SWIG_STATIC_POINTER(var) var
1273 #define SWIG_STATIC_POINTER(var) var = 0; if (!var) var
1281 #define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1)
1282 #define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN)
1284 #define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1)
1286 #define SWIG_BUILTIN_TP_INIT (SWIG_POINTER_OWN << 2)
1287 #define SWIG_BUILTIN_INIT (SWIG_BUILTIN_TP_INIT | SWIG_POINTER_OWN)
1298 PyObject *none = Py_None;
1312 PyTypeObject *pytype;
1321 PyErr_SetString(PyExc_TypeError,
"Implicit conversion is prohibited for explicit constructors.");
1328 PyObject *klass = data ? data->
klass : 0;
1329 return (klass ? klass : PyExc_RuntimeError);
1342 Py_INCREF(data->
klass);
1344 if (PyClass_Check(obj)) {
1349 data->
newraw = PyObject_GetAttrString(data->
klass,
"__new__");
1352 data->
newargs = PyTuple_New(1);
1353 PyTuple_SetItem(data->
newargs, 0, obj);
1360 data->
destroy = PyObject_GetAttrString(data->
klass,
"__swig_destroy__");
1361 if (PyErr_Occurred()) {
1368 flags = PyCFunction_GET_FLAGS(data->
destroy);
1369 data->
delargs = !(flags & (METH_O));
1381 Py_XDECREF(data->
newraw);
1394 #ifdef SWIGPYTHON_BUILTIN
1400 #ifdef SWIGPYTHON_BUILTIN
1403 SwigPyObject_get___dict__(PyObject *v, PyObject *
SWIGUNUSEDPARM(args))
1408 sobj->dict = PyDict_New();
1410 Py_INCREF(sobj->dict);
1419 return PyLong_FromVoidPtr(v->
ptr);
1425 PyObject *res = NULL;
1426 PyObject *args = PyTuple_New(1);
1431 #if PY_VERSION_HEX >= 0x03000000
1432 res = PyUnicode_Format(ofmt,args);
1434 res = PyString_Format(ofmt,args);
1463 # if PY_VERSION_HEX >= 0x03000000
1464 PyObject *joined = PyUnicode_Concat(repr, nrep);
1469 PyString_ConcatAndDel(&repr,nrep);
1488 return (i < j) ? -1 : ((i > j) ? 1 : 0);
1496 if( op != Py_EQ && op != Py_NE ) {
1497 Py_INCREF(Py_NotImplemented);
1498 return Py_NotImplemented;
1507 #ifdef SWIGPYTHON_BUILTIN
1512 assert(SwigPyObject_stype);
1528 #ifdef SWIGPYTHON_BUILTIN
1530 if (PyType_IsSubtype(op->ob_type, target_tp))
1532 return (strcmp(op->ob_type->tp_name,
"SwigPyObject") == 0);
1535 || (strcmp(
Py_TYPE(op)->tp_name,
"SwigPyObject") == 0);
1550 PyObject *destroy = data ? data->
destroy : 0;
1562 PyObject *type = NULL, *
value = NULL, *traceback = NULL;
1563 PyErr_Fetch(&type, &
value, &traceback);
1571 PyCFunction meth = PyCFunction_GET_FUNCTION(destroy);
1572 PyObject *mself = PyCFunction_GET_SELF(destroy);
1573 res = ((*meth)(mself, v));
1576 PyErr_WriteUnraisable(destroy);
1578 PyErr_Restore(type,
value, traceback);
1582 #if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
1585 printf(
"swig/python detected a memory leak of type '%s', no destructor found.\n", (
name ?
name :
"unknown"));
1598 PyErr_SetString(PyExc_TypeError,
"Attempt to append a non SwigPyObject");
1611 Py_INCREF(sobj->
next);
1638 if (!PyArg_UnpackTuple(args,
"own", 0, 1, &val)) {
1642 PyObject *obj = PyBool_FromLong(sobj->
own);
1644 if (PyObject_IsTrue(val)) {
1658 {
"own",
SwigPyObject_own, METH_VARARGS,
"returns/sets ownership of the pointer"},
1667 static char swigobject_doc[] =
"Swig object carries a C/C++ instance pointer";
1669 static PyNumberMethods SwigPyObject_as_number = {
1674 #
if PY_VERSION_HEX < 0x03000000
1690 #
if PY_VERSION_HEX < 0x03000000
1694 #if PY_VERSION_HEX < 0x03000000
1700 #if PY_VERSION_HEX < 0x03000000
1704 #if PY_VERSION_HEX >= 0x03050000
1705 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
1706 #elif PY_VERSION_HEX >= 0x03000000
1707 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
1709 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
1713 static PyTypeObject swigpyobject_type;
1714 static int type_init = 0;
1716 const PyTypeObject tmp = {
1717 #if PY_VERSION_HEX >= 0x03000000
1718 PyVarObject_HEAD_INIT(NULL, 0)
1720 PyObject_HEAD_INIT(NULL)
1730 #if PY_VERSION_HEX >= 0x03000000
1736 &SwigPyObject_as_number,
1742 PyObject_GenericGetAttr,
1773 #
if PY_VERSION_HEX >= 0x03040000
1776 #
if PY_VERSION_HEX >= 0x03080000
1779 #
if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000)
1790 swigpyobject_type = tmp;
1792 if (PyType_Ready(&swigpyobject_type) < 0)
1795 return &swigpyobject_type;
1808 return (PyObject *)sobj;
1849 int s = (i < j) ? -1 : ((i > j) ? 1 : 0);
1850 return s ? s : strncmp((
const char *)v->
pack, (
const char *)w->
pack, 2*v->
size);
1864 || (strcmp((op)->ob_type->tp_name,
"SwigPyPacked") == 0);
1879 static char swigpacked_doc[] =
"Swig object carries a C/C++ instance pointer";
1880 static PyTypeObject swigpypacked_type;
1881 static int type_init = 0;
1883 const PyTypeObject tmp = {
1884 #if PY_VERSION_HEX>=0x03000000
1885 PyVarObject_HEAD_INIT(NULL, 0)
1887 PyObject_HEAD_INIT(NULL)
1897 #if PY_VERSION_HEX>=0x03000000
1909 PyObject_GenericGetAttr,
1940 #
if PY_VERSION_HEX >= 0x03040000
1943 #
if PY_VERSION_HEX >= 0x03080000
1946 #
if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000)
1957 swigpypacked_type = tmp;
1959 if (PyType_Ready(&swigpypacked_type) < 0)
1962 return &swigpypacked_type;
1970 void *pack =
malloc(size);
1972 memcpy(pack, ptr, size);
1981 return (PyObject *) sobj;
1989 if (sobj->
size != size)
return 0;
1990 memcpy(ptr, sobj->
pack, size);
2014 #if PY_VERSION_HEX>=0x03000000
2015 #define SWIG_PYTHON_SLOW_GETSET_THIS
2026 #ifdef SWIGPYTHON_BUILTIN
2028 # ifdef PyWeakref_CheckProxy
2029 if (PyWeakref_CheckProxy(pyobj)) {
2030 pyobj = PyWeakref_GET_OBJECT(pyobj);
2040 #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
2041 if (PyInstance_Check(pyobj)) {
2042 obj = _PyInstance_Lookup(pyobj,
SWIG_This());
2044 PyObject **dictptr = _PyObject_GetDictPtr(pyobj);
2045 if (dictptr != NULL) {
2046 PyObject *dict = *dictptr;
2047 obj = dict ? PyDict_GetItem(dict,
SWIG_This()) : 0;
2049 #ifdef PyWeakref_CheckProxy
2050 if (PyWeakref_CheckProxy(pyobj)) {
2051 PyObject *wobj = PyWeakref_GET_OBJECT(pyobj);
2055 obj = PyObject_GetAttr(pyobj,
SWIG_This());
2059 if (PyErr_Occurred()) PyErr_Clear();
2065 obj = PyObject_GetAttr(pyobj,
SWIG_This());
2069 if (PyErr_Occurred()) PyErr_Clear();
2089 int oldown = sobj->
own;
2107 if (obj == Py_None && !implicit_conv) {
2119 void *vptr = sobj->
ptr;
2124 if (ptr) *ptr = vptr;
2144 if (ptr) *ptr = vptr;
2150 *own = *own | sobj->
own;
2156 if (implicit_conv) {
2159 PyObject *klass = data->
klass;
2165 if (PyErr_Occurred()) {
2190 if (!
SWIG_IsOK(res) && obj == Py_None) {
2193 if (PyErr_Occurred())
2206 if (!PyCFunction_Check(obj)) {
2213 const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
2214 const char *desc = doc ? strstr(doc,
"swig_ptr: ") : 0;
2260 PyObject *newraw = data->
newraw;
2262 inst = PyObject_Call(newraw, data->
newargs, NULL);
2264 #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
2265 PyObject **dictptr = _PyObject_GetDictPtr(inst);
2266 if (dictptr != NULL) {
2267 PyObject *dict = *dictptr;
2269 dict = PyDict_New();
2271 PyDict_SetItem(dict,
SWIG_This(), swig_this);
2275 if (PyObject_SetAttr(inst,
SWIG_This(), swig_this) == -1) {
2282 #if PY_VERSION_HEX >= 0x03000000
2283 PyObject *empty_args = PyTuple_New(0);
2285 PyObject *empty_kwargs = PyDict_New();
2287 inst = ((PyTypeObject *)data->
newargs)->tp_new((PyTypeObject *)data->
newargs, empty_args, empty_kwargs);
2288 Py_DECREF(empty_kwargs);
2290 if (PyObject_SetAttr(inst,
SWIG_This(), swig_this) == -1) {
2294 Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG;
2298 Py_DECREF(empty_args);
2301 PyObject *dict = PyDict_New();
2303 PyDict_SetItem(dict,
SWIG_This(), swig_this);
2304 inst = PyInstance_NewRaw(data->
newargs, dict);
2315 #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
2316 PyObject **dictptr = _PyObject_GetDictPtr(inst);
2317 if (dictptr != NULL) {
2318 PyObject *dict = *dictptr;
2320 dict = PyDict_New();
2323 return PyDict_SetItem(dict,
SWIG_This(), swig_this);
2326 return PyObject_SetAttr(inst,
SWIG_This(), swig_this);
2360 if (clientdata && clientdata->
pytype) {
2365 PyObject *next_self = clientdata->
pytype->tp_alloc(clientdata->
pytype, 0);
2366 while (newobj->
next)
2368 newobj->
next = next_self;
2370 #ifdef SWIGPYTHON_BUILTIN
2376 #ifdef SWIGPYTHON_BUILTIN
2385 return (PyObject*) newobj;
2412 #ifdef SWIG_LINK_RUNTIME
2413 void *SWIG_ReturnGlobalTypeList(
void *);
2418 static void *type_pointer = (
void *)0;
2420 if (!type_pointer) {
2421 #ifdef SWIG_LINK_RUNTIME
2422 type_pointer = SWIG_ReturnGlobalTypeList((
void *)0);
2425 if (PyErr_Occurred()) {
2427 type_pointer = (
void *)0;
2453 #if PY_VERSION_HEX >= 0x03000000
2457 static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };
2458 PyObject *module = Py_InitModule(
"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table);
2461 if (pointer && module) {
2464 Py_XDECREF(pointer);
2480 PyObject *obj = PyDict_GetItem(cache, key);
2488 obj = PyCapsule_New((
void*) descriptor, NULL, NULL);
2489 PyDict_SetItem(cache, key, obj);
2500 #define SWIG_POINTER_EXCEPTION 0
2501 #define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg)
2502 #define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags)
2507 if (PyErr_Occurred()) {
2509 PyObject *
value = 0;
2510 PyObject *traceback = 0;
2511 PyErr_Fetch(&type, &
value, &traceback);
2513 PyObject *old_str = PyObject_Str(
value);
2515 const char *errmesg = tmp ? tmp :
"Invalid error message";
2519 PyErr_Format(type,
"%s %s", mesg, errmesg);
2521 PyErr_Format(type,
"%s %s", errmesg, mesg);
2535 if (PyErr_Occurred()) {
2538 PyOS_snprintf(mesg,
sizeof(mesg),
"argument number %d:", argnum);
2550 return ty ? ty->
str :
"";
2557 #if defined(SWIG_COBJECT_TYPES)
2561 PyErr_Format(PyExc_TypeError,
"a '%s' is expected, 'SwigPyObject(%s)' is received",
2568 const char *otype = (obj ? obj->ob_type->tp_name : 0);
2570 PyObject *str = PyObject_Str(obj);
2573 PyErr_Format(PyExc_TypeError,
"a '%s' is expected, '%s(%s)' is received",
2577 PyErr_Format(PyExc_TypeError,
"a '%s' is expected, '%s' is received",
2584 PyErr_Format(PyExc_TypeError,
"a '%s' is expected", type);
2586 PyErr_Format(PyExc_TypeError,
"unexpected type is received");
2597 #if SWIG_POINTER_EXCEPTION
2607 #ifdef SWIGPYTHON_BUILTIN
2609 SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *
name, PyObject *
value) {
2610 PyTypeObject *tp = obj->ob_type;
2612 PyObject *encoded_name;
2616 # ifdef Py_USING_UNICODE
2617 if (PyString_Check(
name)) {
2618 name = PyUnicode_Decode(PyString_AsString(
name), PyString_Size(
name), NULL, NULL);
2621 }
else if (!PyUnicode_Check(
name))
2623 if (!PyString_Check(
name))
2626 PyErr_Format(PyExc_TypeError,
"attribute name must be string, not '%.200s'",
name->ob_type->tp_name);
2633 if (PyType_Ready(tp) < 0)
2637 descr = _PyType_Lookup(tp,
name);
2640 f = descr->ob_type->tp_descr_set;
2642 if (PyString_Check(
name)) {
2643 encoded_name =
name;
2646 encoded_name = PyUnicode_AsUTF8String(
name);
2650 PyErr_Format(PyExc_AttributeError,
"'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name));
2651 Py_DECREF(encoded_name);
2653 res = f(descr, obj,
value);
2669 #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0)
2671 #define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else
2690 #define SWIG_exception(code, msg) do { SWIG_Error(code, msg); SWIG_fail;; } while(0)
2695 #define SWIGTYPE_p_absl__Status swig_types[0]
2696 #define SWIGTYPE_p_char swig_types[1]
2697 #define SWIGTYPE_p_int swig_types[2]
2698 #define SWIGTYPE_p_long swig_types[3]
2699 #define SWIGTYPE_p_operations_research__MPConstraint swig_types[4]
2700 #define SWIGTYPE_p_operations_research__MPModelExportOptions swig_types[5]
2701 #define SWIGTYPE_p_operations_research__MPModelRequest swig_types[6]
2702 #define SWIGTYPE_p_operations_research__MPObjective swig_types[7]
2703 #define SWIGTYPE_p_operations_research__MPSolver swig_types[8]
2704 #define SWIGTYPE_p_operations_research__MPSolverParameters swig_types[9]
2705 #define SWIGTYPE_p_operations_research__MPVariable swig_types[10]
2706 #define SWIGTYPE_p_short swig_types[11]
2707 #define SWIGTYPE_p_signed_char swig_types[12]
2708 #define SWIGTYPE_p_std__ostream swig_types[13]
2709 #define SWIGTYPE_p_unsigned_char swig_types[14]
2710 #define SWIGTYPE_p_unsigned_int swig_types[15]
2711 #define SWIGTYPE_p_unsigned_long swig_types[16]
2712 #define SWIGTYPE_p_unsigned_short swig_types[17]
2715 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
2716 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
2720 #ifdef SWIG_TypeQuery
2721 # undef SWIG_TypeQuery
2723 #define SWIG_TypeQuery SWIG_Python_TypeQuery
2728 #if PY_VERSION_HEX >= 0x03000000
2729 # define SWIG_init PyInit__pywraplp
2732 # define SWIG_init init_pywraplp
2735 #define SWIG_name "_pywraplp"
2737 #define SWIGVERSION 0x040002
2738 #define SWIG_VERSION SWIGVERSION
2741 #define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a))
2742 #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a))
2745 #include <stdexcept>
2749 class SwigPtr_PyObject {
2777 Py_XINCREF(item._obj);
2791 operator PyObject *()
const
2805 struct SwigVar_PyObject : SwigPtr_PyObject {
2828 #define SWIGWORDSIZE64
2832 #if (__WORDSIZE == 32) || (LONG_MAX == INT_MAX)
2833 # error "SWIG wrapped code invalid in 32 bit architecture, regenerate code using -DSWIGWORDSIZE32"
2840 #include "ortools/base/python-swig.h"
2845 #include "ortools/linear_solver/model_exporter_swig_helper.h"
2892 return PyInt_FromLong((
long)
value);
2899 static int init = 0;
2912 #if PY_VERSION_HEX>=0x03000000
2913 #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
2914 if (PyBytes_Check(obj))
2916 if (PyUnicode_Check(obj))
2919 if (PyString_Check(obj))
2922 char *cstr; Py_ssize_t len;
2924 #if PY_VERSION_HEX>=0x03000000
2925 #if !defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
2926 if (!alloc && cptr) {
2933 obj = PyUnicode_AsUTF8String(obj);
2939 if (PyBytes_AsStringAndSize(obj, &cstr, &len) == -1)
2942 if (PyString_AsStringAndSize(obj, &cstr, &len) == -1)
2948 *cptr =
reinterpret_cast< char*
>(memcpy(
new char[len + 1], cstr,
sizeof(
char)*(len + 1)));
2955 #if PY_VERSION_HEX>=0x03000000
2956 #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
2957 *cptr = PyBytes_AsString(obj);
2968 if (psize) *psize = len + 1;
2969 #if PY_VERSION_HEX>=0x03000000 && !defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
2974 #if defined(SWIG_PYTHON_2_UNICODE)
2975 #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
2976 #error "Cannot use both SWIG_PYTHON_2_UNICODE and SWIG_PYTHON_STRICT_BYTE_CHAR at once"
2978 #if PY_VERSION_HEX<0x03000000
2979 if (PyUnicode_Check(obj)) {
2980 char *cstr; Py_ssize_t len;
2981 if (!alloc && cptr) {
2984 obj = PyUnicode_AsUTF8String(obj);
2987 if (PyString_AsStringAndSize(obj, &cstr, &len) != -1) {
2990 *cptr =
reinterpret_cast< char*
>(memcpy(
new char[len + 1], cstr,
sizeof(
char)*(len + 1)));
2992 if (psize) *psize = len + 1;
3004 if (pchar_descriptor) {
3007 if (cptr) *cptr = (
char *) vptr;
3008 if (psize) *psize = vptr ? (strlen((
char *)vptr) + 1) : 0;
3021 char* buf = 0 ;
size_t size = 0;
int alloc =
SWIG_OLDOBJ;
3024 if (val) *val =
new std::string(buf, size - 1);
3032 static int init = 0;
3050 #if !defined(SWIG_NO_LLONG_MAX)
3051 # if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
3052 # define LLONG_MAX __LONG_LONG_MAX__
3053 # define LLONG_MIN (-LLONG_MAX - 1LL)
3054 # define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
3063 if (PyFloat_Check(obj)) {
3064 if (val) *val = PyFloat_AsDouble(obj);
3066 #if PY_VERSION_HEX < 0x03000000
3067 }
else if (PyInt_Check(obj)) {
3068 if (val) *val = (double) PyInt_AsLong(obj);
3071 }
else if (PyLong_Check(obj)) {
3072 double v = PyLong_AsDouble(obj);
3073 if (!PyErr_Occurred()) {
3080 #ifdef SWIG_PYTHON_CAST_MODE
3083 double d = PyFloat_AsDouble(obj);
3084 if (!PyErr_Occurred()) {
3091 long v = PyLong_AsLong(obj);
3092 if (!PyErr_Occurred()) {
3114 if ((
min <= x && x <=
max)) {
3115 double fx = floor(x);
3116 double cx = ceil(x);
3117 double rd = ((x - fx) < 0.5) ? fx : cx;
3118 if ((errno == EDOM) || (errno == ERANGE)) {
3121 double summ, reps, diff;
3124 }
else if (rd > x) {
3131 if (reps < 8*DBL_EPSILON) {
3144 #if PY_VERSION_HEX < 0x03000000
3145 if (PyInt_Check(obj)) {
3146 if (val) *val = PyInt_AsLong(obj);
3150 if (PyLong_Check(obj)) {
3151 long v = PyLong_AsLong(obj);
3152 if (!PyErr_Occurred()) {
3160 #ifdef SWIG_PYTHON_CAST_MODE
3163 long v = PyInt_AsLong(obj);
3164 if (!PyErr_Occurred()) {
3174 if (val) *val = (long)(d);
3190 if ((v < INT_MIN || v > INT_MAX)) {
3193 if (val) *val =
static_cast< int >(v);
3203 return PyBool_FromLong(
value ? 1 : 0);
3211 if (!PyBool_Check(obj))
3213 r = PyObject_IsTrue(obj);
3216 if (val) *val = r ? true :
false;
3221 #define SWIG_From_double PyFloat_FromDouble
3224 #define SWIG_From_long PyInt_FromLong
3227 std::string error_message;
3228 self->LoadModelFromProto(input_model, &error_message);
3229 return error_message;
3236 if (size > INT_MAX) {
3238 return pchar_descriptor ?
3241 #if PY_VERSION_HEX >= 0x03000000
3242 #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
3243 return PyBytes_FromStringAndSize(carray,
static_cast< Py_ssize_t
>(size));
3245 return PyUnicode_DecodeUTF8(carray,
static_cast< Py_ssize_t
>(size),
"surrogateescape");
3248 return PyString_FromStringAndSize(carray,
static_cast< Py_ssize_t
>(size));
3267 self->ExportModelToProto(&
model);
3274 self->ExportModelToProto(&
model);
3278 if (variables.size() != values.size()) {
3279 LOG(FATAL) <<
"Different number of variables and values when setting "
3282 std::vector<std::pair<const operations_research::MPVariable*, double> >
3283 hint(variables.size());
3284 for (
int i = 0; i < variables.size(); ++i) {
3285 hint[i] = std::make_pair(variables[i], values[i]);
3287 self->SetHint(hint);
3290 return self->SetNumThreads(num_theads).ok();
3298 return self->name();
3301 return self->name();
3319 PyObject *resultobj = 0;
3320 std::string *arg1 = 0 ;
3325 PyObject *swig_obj[2] ;
3330 std::string *ptr = (std::string *)0;
3342 SWIG_exception_fail(
SWIG_ArgError(ecode2),
"in method '" "new_Solver" "', argument " "2"" of type '" "operations_research::MPSolver::OptimizationProblemType""'");
3356 PyObject *resultobj = 0;
3360 PyObject *swig_obj[1] ;
3378 PyObject *resultobj = 0;
3379 std::string *arg1 = 0 ;
3381 PyObject *swig_obj[1] ;
3387 std::string *ptr = (std::string *)0;
3408 PyObject *resultobj = 0;
3412 PyObject *swig_obj[1] ;
3419 SWIG_exception_fail(
SWIG_ArgError(ecode1),
"in method '" "Solver_SupportsProblemType" "', argument " "1"" of type '" "operations_research::MPSolver::OptimizationProblemType""'");
3431 PyObject *resultobj = 0;
3435 PyObject *swig_obj[1] ;
3453 PyObject *resultobj = 0;
3457 PyObject *swig_obj[1] ;
3476 PyObject *resultobj = 0;
3480 PyObject *swig_obj[1] ;
3481 std::vector< operations_research::MPVariable * > *result = 0 ;
3501 PyObject *resultobj = 0;
3503 std::string *arg2 = 0 ;
3507 PyObject *swig_obj[2] ;
3517 std::string *ptr = (std::string *)0;
3538 PyObject *resultobj = 0;
3543 std::string *arg5 = 0 ;
3553 PyObject *swig_obj[5] ;
3566 arg2 =
static_cast< double >(val2);
3571 arg3 =
static_cast< double >(val3);
3576 arg4 =
static_cast< bool >(val4);
3578 std::string *ptr = (std::string *)0;
3599 PyObject *resultobj = 0;
3603 std::string *arg4 = 0 ;
3611 PyObject *swig_obj[4] ;
3624 arg2 =
static_cast< double >(val2);
3629 arg3 =
static_cast< double >(val3);
3631 std::string *ptr = (std::string *)0;
3652 PyObject *resultobj = 0;
3656 std::string *arg4 = 0 ;
3664 PyObject *swig_obj[4] ;
3677 arg2 =
static_cast< double >(val2);
3682 arg3 =
static_cast< double >(val3);
3684 std::string *ptr = (std::string *)0;
3705 PyObject *resultobj = 0;
3707 std::string *arg2 = 0 ;
3711 PyObject *swig_obj[2] ;
3721 std::string *ptr = (std::string *)0;
3742 PyObject *resultobj = 0;
3746 PyObject *swig_obj[1] ;
3765 PyObject *resultobj = 0;
3769 PyObject *swig_obj[1] ;
3770 std::vector< operations_research::MPConstraint * > *result = 0 ;
3790 PyObject *resultobj = 0;
3792 std::string *arg2 = 0 ;
3796 PyObject *swig_obj[2] ;
3802 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "Solver_LookupConstraint" "', argument " "1"" of type '" "operations_research::MPSolver const *""'");
3806 std::string *ptr = (std::string *)0;
3827 PyObject *resultobj = 0;
3839 if ((nobjs < 3) || (nobjs > 3))
SWIG_fail;
3849 arg2 =
static_cast< double >(val2);
3854 arg3 =
static_cast< double >(val3);
3864 PyObject *resultobj = 0;
3870 if ((nobjs < 1) || (nobjs > 1))
SWIG_fail;
3885 PyObject *resultobj = 0;
3889 std::string *arg4 = 0 ;
3899 if ((nobjs < 4) || (nobjs > 4))
SWIG_fail;
3909 arg2 =
static_cast< double >(val2);
3914 arg3 =
static_cast< double >(val3);
3916 std::string *ptr = (std::string *)0;
3937 PyObject *resultobj = 0;
3939 std::string *arg2 = 0 ;
3945 if ((nobjs < 2) || (nobjs > 2))
SWIG_fail;
3952 std::string *ptr = (std::string *)0;
3974 PyObject *argv[5] = {
4051 " Possible C/C++ prototypes are:\n"
4052 " operations_research::MPSolver::MakeRowConstraint(double,double)\n"
4053 " operations_research::MPSolver::MakeRowConstraint()\n"
4054 " operations_research::MPSolver::MakeRowConstraint(double,double,std::string const &)\n"
4055 " operations_research::MPSolver::MakeRowConstraint(std::string const &)\n");
4061 PyObject *resultobj = 0;
4065 PyObject *swig_obj[1] ;
4084 PyObject *resultobj = 0;
4090 if ((nobjs < 1) || (nobjs > 1))
SWIG_fail;
4105 PyObject *resultobj = 0;
4114 if ((nobjs < 2) || (nobjs > 2))
SWIG_fail;
4122 SWIG_exception_fail(
SWIG_ArgError(res2),
"in method '" "Solver_Solve" "', argument " "2"" of type '" "operations_research::MPSolverParameters const &""'");
4125 SWIG_exception_fail(
SWIG_ValueError,
"invalid null reference " "in method '" "Solver_Solve" "', argument " "2"" of type '" "operations_research::MPSolverParameters const &""'");
4138 PyObject *argv[3] = {
4169 " Possible C/C++ prototypes are:\n"
4170 " operations_research::MPSolver::Solve()\n"
4171 " operations_research::MPSolver::Solve(operations_research::MPSolverParameters const &)\n");
4177 PyObject *resultobj = 0;
4181 PyObject *swig_obj[1] ;
4182 std::vector< double > result;
4188 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "Solver_ComputeConstraintActivities" "', argument " "1"" of type '" "operations_research::MPSolver const *""'");
4193 resultobj = vector_output_helper(&result, &PyFloat_FromDouble);
4202 PyObject *resultobj = 0;
4212 PyObject *swig_obj[3] ;
4225 arg2 =
static_cast< double >(val2);
4230 arg3 =
static_cast< bool >(val3);
4240 PyObject *resultobj = 0;
4244 PyObject *swig_obj[1] ;
4263 PyObject *resultobj = 0;
4268 PyObject *swig_obj[2] ;
4273 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "Solver_FillSolutionResponseProto" "', argument " "1"" of type '" "operations_research::MPSolver const *""'");
4278 PyObject*
const pyresult = PyObject_CallMethod(
4279 swig_obj[1],
const_cast<char*
>(
"SerializeToString"),
nullptr);
4280 if (pyresult !=
nullptr) {
4281 char* buffer =
nullptr;
4282 Py_ssize_t length = 0;
4283 int result = PyString_AsStringAndSize(pyresult, &buffer, &length);
4284 if (buffer !=
nullptr) {
4285 arg2->ParseFromArray(buffer, length);
4287 Py_DECREF(pyresult);
4293 std::string encoded_protobuf;
4294 arg2->SerializeToString(&encoded_protobuf);
4296 PyObject*
const python_encoded_protobuf =
4297 PyBytes_FromStringAndSize(encoded_protobuf.c_str(),
4298 encoded_protobuf.size());
4304 if (python_encoded_protobuf !=
nullptr) {
4305 PyObject*
const result = PyObject_CallMethod(
4306 swig_obj[1],
const_cast<char*
>(
"ParseFromString"),
4307 const_cast<char*
>(
"(O)"), python_encoded_protobuf);
4308 Py_DECREF(python_encoded_protobuf);
4309 if (result !=
nullptr) {
4327 PyObject *resultobj = 0;
4332 PyObject *swig_obj[2] ;
4337 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "Solver_SolveWithProto" "', argument " "1"" of type '" "operations_research::MPModelRequest const &""'");
4340 SWIG_exception_fail(
SWIG_ValueError,
"invalid null reference " "in method '" "Solver_SolveWithProto" "', argument " "1"" of type '" "operations_research::MPModelRequest const &""'");
4345 PyObject*
const pyresult = PyObject_CallMethod(
4346 swig_obj[1],
const_cast<char*
>(
"SerializeToString"),
nullptr);
4347 if (pyresult !=
nullptr) {
4348 char* buffer =
nullptr;
4349 Py_ssize_t length = 0;
4350 int result = PyString_AsStringAndSize(pyresult, &buffer, &length);
4351 if (buffer !=
nullptr) {
4352 arg2->ParseFromArray(buffer, length);
4354 Py_DECREF(pyresult);
4360 std::string encoded_protobuf;
4361 arg2->SerializeToString(&encoded_protobuf);
4363 PyObject*
const python_encoded_protobuf =
4364 PyBytes_FromStringAndSize(encoded_protobuf.c_str(),
4365 encoded_protobuf.size());
4371 if (python_encoded_protobuf !=
nullptr) {
4372 PyObject*
const result = PyObject_CallMethod(
4373 swig_obj[1],
const_cast<char*
>(
"ParseFromString"),
4374 const_cast<char*
>(
"(O)"), python_encoded_protobuf);
4375 Py_DECREF(python_encoded_protobuf);
4376 if (result !=
nullptr) {
4394 PyObject *resultobj = 0;
4399 PyObject *swig_obj[2] ;
4404 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "Solver_ExportModelToProto" "', argument " "1"" of type '" "operations_research::MPSolver const *""'");
4409 PyObject*
const pyresult = PyObject_CallMethod(
4410 swig_obj[1],
const_cast<char*
>(
"SerializeToString"),
nullptr);
4411 if (pyresult !=
nullptr) {
4412 char* buffer =
nullptr;
4413 Py_ssize_t length = 0;
4414 int result = PyString_AsStringAndSize(pyresult, &buffer, &length);
4415 if (buffer !=
nullptr) {
4416 arg2->ParseFromArray(buffer, length);
4418 Py_DECREF(pyresult);
4424 std::string encoded_protobuf;
4425 arg2->SerializeToString(&encoded_protobuf);
4427 PyObject*
const python_encoded_protobuf =
4428 PyBytes_FromStringAndSize(encoded_protobuf.c_str(),
4429 encoded_protobuf.size());
4435 if (python_encoded_protobuf !=
nullptr) {
4436 PyObject*
const result = PyObject_CallMethod(
4437 swig_obj[1],
const_cast<char*
>(
"ParseFromString"),
4438 const_cast<char*
>(
"(O)"), python_encoded_protobuf);
4439 Py_DECREF(python_encoded_protobuf);
4440 if (result !=
nullptr) {
4458 PyObject *resultobj = 0;
4466 absl::Status result;
4468 if ((nobjs < 3) || (nobjs > 3))
SWIG_fail;
4471 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "Solver_LoadSolutionFromProto" "', argument " "1"" of type '" "operations_research::MPSolver *""'");
4476 PyObject*
const pyresult = PyObject_CallMethod(
4477 swig_obj[1],
const_cast<char*
>(
"SerializeToString"),
nullptr);
4478 if (pyresult !=
nullptr) {
4479 char* buffer =
nullptr;
4480 Py_ssize_t length = 0;
4481 int result = PyString_AsStringAndSize(pyresult, &buffer, &length);
4482 if (buffer !=
nullptr) {
4483 arg2->ParseFromArray(buffer, length);
4485 Py_DECREF(pyresult);
4492 arg3 =
static_cast< double >(val3);
4508 PyObject *resultobj = 0;
4513 absl::Status result;
4515 if ((nobjs < 2) || (nobjs > 2))
SWIG_fail;
4518 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "Solver_LoadSolutionFromProto" "', argument " "1"" of type '" "operations_research::MPSolver *""'");
4523 PyObject*
const pyresult = PyObject_CallMethod(
4524 swig_obj[1],
const_cast<char*
>(
"SerializeToString"),
nullptr);
4525 if (pyresult !=
nullptr) {
4526 char* buffer =
nullptr;
4527 Py_ssize_t length = 0;
4528 int result = PyString_AsStringAndSize(pyresult, &buffer, &length);
4529 if (buffer !=
nullptr) {
4530 arg2->ParseFromArray(buffer, length);
4532 Py_DECREF(pyresult);
4551 PyObject *argv[4] = {
4565 PyObject*
const module = PyImport_ImportModule(
"ortools.linear_solver.linear_solver_pb2");
4566 if (module !=
nullptr) {
4567 PyObject*
const dict = PyModule_GetDict(module);
4568 if (dict !=
nullptr) {
4569 PyObject*
const clss = PyDict_GetItemString(dict,
"MPSolutionResponse");
4570 if (clss !=
nullptr) {
4571 if (PyObject_IsInstance(argv[1], clss)) {
4593 PyObject*
const module = PyImport_ImportModule(
"ortools.linear_solver.linear_solver_pb2");
4594 if (module !=
nullptr) {
4595 PyObject*
const dict = PyModule_GetDict(module);
4596 if (dict !=
nullptr) {
4597 PyObject*
const clss = PyDict_GetItemString(dict,
"MPSolutionResponse");
4598 if (clss !=
nullptr) {
4599 if (PyObject_IsInstance(argv[1], clss)) {
4622 " Possible C/C++ prototypes are:\n"
4623 " operations_research::MPSolver::LoadSolutionFromProto(operations_research::MPSolutionResponse const &,double)\n"
4624 " operations_research::MPSolver::LoadSolutionFromProto(operations_research::MPSolutionResponse const &)\n");
4630 PyObject *resultobj = 0;
4632 std::string *arg2 = 0 ;
4636 PyObject *swig_obj[2] ;
4642 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "Solver_SetSolverSpecificParametersAsString" "', argument " "1"" of type '" "operations_research::MPSolver *""'");
4646 std::string *ptr = (std::string *)0;
4649 SWIG_exception_fail(
SWIG_ArgError(res2),
"in method '" "Solver_SetSolverSpecificParametersAsString" "', argument " "2"" of type '" "std::string const &""'");
4652 SWIG_exception_fail(
SWIG_ValueError,
"invalid null reference " "in method '" "Solver_SetSolverSpecificParametersAsString" "', argument " "2"" of type '" "std::string const &""'");
4656 result = (bool)(arg1)->SetSolverSpecificParametersAsString((std::string
const &)*arg2);
4667 PyObject *resultobj = 0;
4680 PyObject *resultobj = 0;
4684 PyObject *swig_obj[1] ;
4693 (arg1)->EnableOutput();
4702 PyObject *resultobj = 0;
4706 PyObject *swig_obj[1] ;
4715 (arg1)->SuppressOutput();
4724 PyObject *resultobj = 0;
4728 PyObject *swig_obj[1] ;
4747 PyObject *resultobj = 0;
4751 PyObject *swig_obj[1] ;
4770 PyObject *resultobj = 0;
4774 PyObject *swig_obj[1] ;
4781 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "Solver_ComputeExactConditionNumber" "', argument " "1"" of type '" "operations_research::MPSolver const *""'");
4793 PyObject *resultobj = 0;
4797 PyObject *swig_obj[1] ;
4816 PyObject *resultobj = 0;
4823 PyObject *swig_obj[2] ;
4835 arg2 =
static_cast< int64 >(val2);
4836 (arg1)->set_time_limit(arg2);
4845 PyObject *resultobj = 0;
4849 PyObject *swig_obj[1] ;
4868 PyObject *resultobj = 0;
4869 std::string *arg1 = 0 ;
4871 PyObject *swig_obj[1] ;
4876 std::string *ptr = (std::string *)0;
4897 PyObject *resultobj = 0;
4902 PyObject *swig_obj[2] ;
4913 PyObject*
const pyresult = PyObject_CallMethod(
4914 swig_obj[1],
const_cast<char*
>(
"SerializeToString"),
nullptr);
4915 if (pyresult !=
nullptr) {
4916 char* buffer =
nullptr;
4917 Py_ssize_t length = 0;
4918 int result = PyString_AsStringAndSize(pyresult, &buffer, &length);
4919 if (buffer !=
nullptr) {
4920 arg2->ParseFromArray(buffer, length);
4922 Py_DECREF(pyresult);
4940 PyObject *resultobj = 0;
4947 PyObject *swig_obj[2] ;
4953 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "Solver_ExportModelAsLpFormat" "', argument " "1"" of type '" "operations_research::MPSolver *""'");
4960 arg2 =
static_cast< bool >(val2);
4970 PyObject *resultobj = 0;
4980 PyObject *swig_obj[3] ;
4986 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "Solver_ExportModelAsMpsFormat" "', argument " "1"" of type '" "operations_research::MPSolver *""'");
4993 arg2 =
static_cast< bool >(val2);
4998 arg3 =
static_cast< bool >(val3);
5008 PyObject *resultobj = 0;
5010 std::vector< operations_research::MPVariable * > *arg2 = 0 ;
5011 std::vector< double > *arg3 = 0 ;
5014 std::vector< operations_research::MPVariable * > temp2 ;
5015 std::vector< double > temp3 ;
5016 PyObject *swig_obj[3] ;
5025 if (!vector_input_helper(swig_obj[1], &temp2, PyObjAs<operations_research::MPVariable*>)) {
5026 if (!PyErr_Occurred())
5033 if (!vector_input_helper(swig_obj[2], &temp3, PyObjAs<double>)) {
5034 if (!PyErr_Occurred())
5049 PyObject *resultobj = 0;
5056 PyObject *swig_obj[2] ;
5069 arg2 =
static_cast< int >(val2);
5079 PyObject *resultobj = 0;
5092 PyObject *resultobj = 0;
5099 PyObject *swig_obj[2] ;
5111 arg2 =
static_cast< int64 >(val2);
5121 PyObject *resultobj = 0;
5125 PyObject *swig_obj[1] ;
5144 PyObject *resultobj = 0;
5148 PyObject *swig_obj[1] ;
5178 PyObject *resultobj = 0;
5179 std::ostream *arg1 = 0 ;
5185 std::ostream *result = 0 ;
5187 if ((nobjs < 2) || (nobjs > 2))
SWIG_fail;
5195 arg1 =
reinterpret_cast< std::ostream *
>(argp1);
5198 SWIG_exception_fail(
SWIG_ArgError(ecode2),
"in method '" "__lshift__" "', argument " "2"" of type '" "operations_research::MPSolver::OptimizationProblemType""'");
5201 result = (std::ostream *) &operations_research::operator <<(*arg1,arg2);
5206 Py_INCREF(Py_NotImplemented);
5207 return Py_NotImplemented;
5212 PyObject *resultobj = 0;
5213 std::ostream *arg1 = 0 ;
5219 std::ostream *result = 0 ;
5221 if ((nobjs < 2) || (nobjs > 2))
SWIG_fail;
5229 arg1 =
reinterpret_cast< std::ostream *
>(argp1);
5235 result = (std::ostream *) &operations_research::operator <<(*arg1,arg2);
5240 Py_INCREF(Py_NotImplemented);
5241 return Py_NotImplemented;
5247 PyObject *argv[3] = {
5285 Py_INCREF(Py_NotImplemented);
5286 return Py_NotImplemented;
5291 PyObject *resultobj = 0;
5295 PyObject *swig_obj[1] ;
5313 PyObject *resultobj = 0;
5321 PyObject *swig_obj[3] ;
5336 arg3 =
static_cast< double >(val3);
5346 PyObject *resultobj = 0;
5351 PyObject *swig_obj[2] ;
5357 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "Objective_GetCoefficient" "', argument " "1"" of type '" "operations_research::MPObjective const *""'");
5372 PyObject *resultobj = 0;
5379 PyObject *swig_obj[2] ;
5391 arg2 =
static_cast< double >(val2);
5392 (arg1)->SetOffset(arg2);
5401 PyObject *resultobj = 0;
5405 PyObject *swig_obj[1] ;
5424 PyObject *resultobj = 0;
5431 PyObject *swig_obj[2] ;
5436 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "Objective_SetOptimizationDirection" "', argument " "1"" of type '" "operations_research::MPObjective *""'");
5443 arg2 =
static_cast< bool >(val2);
5444 (arg1)->SetOptimizationDirection(arg2);
5453 PyObject *resultobj = 0;
5457 PyObject *swig_obj[1] ;
5463 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "Objective_SetMinimization" "', argument " "1"" of type '" "operations_research::MPObjective *""'");
5466 (arg1)->SetMinimization();
5475 PyObject *resultobj = 0;
5479 PyObject *swig_obj[1] ;
5485 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "Objective_SetMaximization" "', argument " "1"" of type '" "operations_research::MPObjective *""'");
5488 (arg1)->SetMaximization();
5497 PyObject *resultobj = 0;
5501 PyObject *swig_obj[1] ;
5508 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "Objective_maximization" "', argument " "1"" of type '" "operations_research::MPObjective const *""'");
5520 PyObject *resultobj = 0;
5524 PyObject *swig_obj[1] ;
5531 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "Objective_minimization" "', argument " "1"" of type '" "operations_research::MPObjective const *""'");
5543 PyObject *resultobj = 0;
5547 PyObject *swig_obj[1] ;
5566 PyObject *resultobj = 0;
5570 PyObject *swig_obj[1] ;
5577 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "Objective_BestBound" "', argument " "1"" of type '" "operations_research::MPObjective const *""'");
5589 PyObject *resultobj = 0;
5593 PyObject *swig_obj[1] ;
5612 PyObject *resultobj = 0;
5616 PyObject *swig_obj[1] ;
5641 PyObject *resultobj = 0;
5645 PyObject *swig_obj[1] ;
5646 std::string *result = 0 ;
5664 PyObject *resultobj = 0;
5671 PyObject *swig_obj[2] ;
5683 arg2 =
static_cast< bool >(val2);
5684 (arg1)->SetInteger(arg2);
5693 PyObject *resultobj = 0;
5697 PyObject *swig_obj[1] ;
5716 PyObject *resultobj = 0;
5720 PyObject *swig_obj[1] ;
5727 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "Variable_solution_value" "', argument " "1"" of type '" "operations_research::MPVariable const *""'");
5739 PyObject *resultobj = 0;
5743 PyObject *swig_obj[1] ;
5762 PyObject *resultobj = 0;
5766 PyObject *swig_obj[1] ;
5785 PyObject *resultobj = 0;
5789 PyObject *swig_obj[1] ;
5808 PyObject *resultobj = 0;
5818 PyObject *swig_obj[3] ;
5830 arg2 =
static_cast< double >(val2);
5835 arg3 =
static_cast< double >(val3);
5836 (arg1)->SetBounds(arg2,arg3);
5845 PyObject *resultobj = 0;
5849 PyObject *swig_obj[1] ;
5856 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "Variable_reduced_cost" "', argument " "1"" of type '" "operations_research::MPVariable const *""'");
5868 PyObject *resultobj = 0;
5872 PyObject *swig_obj[1] ;
5879 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "Variable_basis_status" "', argument " "1"" of type '" "operations_research::MPVariable const *""'");
5891 PyObject *resultobj = 0;
5895 PyObject *swig_obj[1] ;
5902 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "Variable_branching_priority" "', argument " "1"" of type '" "operations_research::MPVariable const *""'");
5914 PyObject *resultobj = 0;
5921 PyObject *swig_obj[2] ;
5926 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "Variable_SetBranchingPriority" "', argument " "1"" of type '" "operations_research::MPVariable *""'");
5933 arg2 =
static_cast< int >(val2);
5934 (arg1)->SetBranchingPriority(arg2);
5943 PyObject *resultobj = 0;
5947 PyObject *swig_obj[1] ;
5966 PyObject *resultobj = 0;
5970 PyObject *swig_obj[1] ;
5989 PyObject *resultobj = 0;
5993 PyObject *swig_obj[1] ;
6000 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "Variable_SolutionValue" "', argument " "1"" of type '" "operations_research::MPVariable const *""'");
6012 PyObject *resultobj = 0;
6016 PyObject *swig_obj[1] ;
6035 PyObject *resultobj = 0;
6039 PyObject *swig_obj[1] ;
6058 PyObject *resultobj = 0;
6062 PyObject *swig_obj[1] ;
6081 PyObject *resultobj = 0;
6088 PyObject *swig_obj[2] ;
6100 arg2 =
static_cast< double >(val2);
6110 PyObject *resultobj = 0;
6117 PyObject *swig_obj[2] ;
6129 arg2 =
static_cast< double >(val2);
6139 PyObject *resultobj = 0;
6143 PyObject *swig_obj[1] ;
6150 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "Variable_ReducedCost" "', argument " "1"" of type '" "operations_research::MPVariable const *""'");
6162 PyObject *resultobj = 0;
6166 PyObject *swig_obj[1] ;
6191 PyObject *resultobj = 0;
6195 PyObject *swig_obj[1] ;
6196 std::string *result = 0 ;
6214 PyObject *resultobj = 0;
6218 PyObject *swig_obj[1] ;
6236 PyObject *resultobj = 0;
6244 PyObject *swig_obj[3] ;
6249 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "Constraint_SetCoefficient" "', argument " "1"" of type '" "operations_research::MPConstraint *""'");
6259 arg3 =
static_cast< double >(val3);
6269 PyObject *resultobj = 0;
6274 PyObject *swig_obj[2] ;
6280 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "Constraint_GetCoefficient" "', argument " "1"" of type '" "operations_research::MPConstraint const *""'");
6295 PyObject *resultobj = 0;
6299 PyObject *swig_obj[1] ;
6318 PyObject *resultobj = 0;
6322 PyObject *swig_obj[1] ;
6341 PyObject *resultobj = 0;
6351 PyObject *swig_obj[3] ;
6363 arg2 =
static_cast< double >(val2);
6368 arg3 =
static_cast< double >(val3);
6369 (arg1)->SetBounds(arg2,arg3);
6378 PyObject *resultobj = 0;
6385 PyObject *swig_obj[2] ;
6397 arg2 =
static_cast< bool >(val2);
6398 (arg1)->set_is_lazy(arg2);
6407 PyObject *resultobj = 0;
6411 PyObject *swig_obj[1] ;
6430 PyObject *resultobj = 0;
6434 PyObject *swig_obj[1] ;
6441 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "Constraint_dual_value" "', argument " "1"" of type '" "operations_research::MPConstraint const *""'");
6453 PyObject *resultobj = 0;
6457 PyObject *swig_obj[1] ;
6464 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "Constraint_basis_status" "', argument " "1"" of type '" "operations_research::MPConstraint const *""'");
6476 PyObject *resultobj = 0;
6480 PyObject *swig_obj[1] ;
6499 PyObject *resultobj = 0;
6503 PyObject *swig_obj[1] ;
6522 PyObject *resultobj = 0;
6529 PyObject *swig_obj[2] ;
6541 arg2 =
static_cast< double >(val2);
6551 PyObject *resultobj = 0;
6558 PyObject *swig_obj[2] ;
6570 arg2 =
static_cast< double >(val2);
6580 PyObject *resultobj = 0;
6584 PyObject *swig_obj[1] ;
6591 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "Constraint_DualValue" "', argument " "1"" of type '" "operations_research::MPConstraint const *""'");
6603 PyObject *resultobj = 0;
6607 PyObject *swig_obj[1] ;
6638 PyObject *pyobj = 0;
6652 PyObject *pyobj = 0;
6666 PyObject *pyobj = 0;
6680 PyObject *pyobj = 0;
6694 PyObject *pyobj = 0;
6702 PyObject *resultobj = 0;
6715 PyObject *resultobj = 0;
6725 PyObject *swig_obj[3] ;
6730 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "MPSolverParameters_SetDoubleParam" "', argument " "1"" of type '" "operations_research::MPSolverParameters *""'");
6735 SWIG_exception_fail(
SWIG_ArgError(ecode2),
"in method '" "MPSolverParameters_SetDoubleParam" "', argument " "2"" of type '" "operations_research::MPSolverParameters::DoubleParam""'");
6742 arg3 =
static_cast< double >(val3);
6743 (arg1)->SetDoubleParam(arg2,arg3);
6752 PyObject *resultobj = 0;
6762 PyObject *swig_obj[3] ;
6767 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "MPSolverParameters_SetIntegerParam" "', argument " "1"" of type '" "operations_research::MPSolverParameters *""'");
6772 SWIG_exception_fail(
SWIG_ArgError(ecode2),
"in method '" "MPSolverParameters_SetIntegerParam" "', argument " "2"" of type '" "operations_research::MPSolverParameters::IntegerParam""'");
6779 arg3 =
static_cast< int >(val3);
6780 (arg1)->SetIntegerParam(arg2,arg3);
6789 PyObject *resultobj = 0;
6796 PyObject *swig_obj[2] ;
6802 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "MPSolverParameters_GetDoubleParam" "', argument " "1"" of type '" "operations_research::MPSolverParameters const *""'");
6807 SWIG_exception_fail(
SWIG_ArgError(ecode2),
"in method '" "MPSolverParameters_GetDoubleParam" "', argument " "2"" of type '" "operations_research::MPSolverParameters::DoubleParam""'");
6819 PyObject *resultobj = 0;
6826 PyObject *swig_obj[2] ;
6832 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "MPSolverParameters_GetIntegerParam" "', argument " "1"" of type '" "operations_research::MPSolverParameters const *""'");
6837 SWIG_exception_fail(
SWIG_ArgError(ecode2),
"in method '" "MPSolverParameters_GetIntegerParam" "', argument " "2"" of type '" "operations_research::MPSolverParameters::IntegerParam""'");
6849 PyObject *resultobj = 0;
6853 PyObject *swig_obj[1] ;
6859 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "delete_MPSolverParameters" "', argument " "1"" of type '" "operations_research::MPSolverParameters *""'");
6882 PyObject *resultobj = 0;
6895 PyObject *resultobj = 0;
6899 PyObject *swig_obj[1] ;
6905 SWIG_exception_fail(
SWIG_ArgError(res1),
"in method '" "delete_ModelExportOptions" "', argument " "1"" of type '" "operations_research::MPModelExportOptions *""'");
6928 PyObject *resultobj = 0;
6935 if ((nobjs < 2) || (nobjs > 2))
SWIG_fail;
6938 PyObject*
const pyresult = PyObject_CallMethod(
6939 swig_obj[0],
const_cast<char*
>(
"SerializeToString"),
nullptr);
6940 if (pyresult !=
nullptr) {
6941 char* buffer =
nullptr;
6942 Py_ssize_t length = 0;
6943 int result = PyString_AsStringAndSize(pyresult, &buffer, &length);
6944 if (buffer !=
nullptr) {
6945 arg1->ParseFromArray(buffer, length);
6947 Py_DECREF(pyresult);
6952 SWIG_exception_fail(
SWIG_ArgError(res2),
"in method '" "ExportModelAsLpFormat" "', argument " "2"" of type '" "operations_research::MPModelExportOptions const &""'");
6955 SWIG_exception_fail(
SWIG_ValueError,
"invalid null reference " "in method '" "ExportModelAsLpFormat" "', argument " "2"" of type '" "operations_research::MPModelExportOptions const &""'");
6973 PyObject *resultobj = 0;
6977 if ((nobjs < 1) || (nobjs > 1))
SWIG_fail;
6980 PyObject*
const pyresult = PyObject_CallMethod(
6981 swig_obj[0],
const_cast<char*
>(
"SerializeToString"),
nullptr);
6982 if (pyresult !=
nullptr) {
6983 char* buffer =
nullptr;
6984 Py_ssize_t length = 0;
6985 int result = PyString_AsStringAndSize(pyresult, &buffer, &length);
6986 if (buffer !=
nullptr) {
6987 arg1->ParseFromArray(buffer, length);
6989 Py_DECREF(pyresult);
7008 PyObject *argv[3] = {
7018 PyObject*
const module = PyImport_ImportModule(
"ortools.linear_solver.linear_solver_pb2");
7019 if (module !=
nullptr) {
7020 PyObject*
const dict = PyModule_GetDict(module);
7021 if (dict !=
nullptr) {
7022 PyObject*
const clss = PyDict_GetItemString(dict,
"MPModelProto");
7023 if (clss !=
nullptr) {
7024 if (PyObject_IsInstance(argv[0], clss)) {
7041 PyObject*
const module = PyImport_ImportModule(
"ortools.linear_solver.linear_solver_pb2");
7042 if (module !=
nullptr) {
7043 PyObject*
const dict = PyModule_GetDict(module);
7044 if (dict !=
nullptr) {
7045 PyObject*
const clss = PyDict_GetItemString(dict,
"MPModelProto");
7046 if (clss !=
nullptr) {
7047 if (PyObject_IsInstance(argv[0], clss)) {
7067 " Possible C/C++ prototypes are:\n"
7068 " operations_research::ExportModelAsLpFormatReturnString(operations_research::MPModelProto const &,operations_research::MPModelExportOptions const &)\n"
7069 " operations_research::ExportModelAsLpFormatReturnString(operations_research::MPModelProto const &)\n");
7075 PyObject *resultobj = 0;
7082 if ((nobjs < 2) || (nobjs > 2))
SWIG_fail;
7085 PyObject*
const pyresult = PyObject_CallMethod(
7086 swig_obj[0],
const_cast<char*
>(
"SerializeToString"),
nullptr);
7087 if (pyresult !=
nullptr) {
7088 char* buffer =
nullptr;
7089 Py_ssize_t length = 0;
7090 int result = PyString_AsStringAndSize(pyresult, &buffer, &length);
7091 if (buffer !=
nullptr) {
7092 arg1->ParseFromArray(buffer, length);
7094 Py_DECREF(pyresult);
7099 SWIG_exception_fail(
SWIG_ArgError(res2),
"in method '" "ExportModelAsMpsFormat" "', argument " "2"" of type '" "operations_research::MPModelExportOptions const &""'");
7102 SWIG_exception_fail(
SWIG_ValueError,
"invalid null reference " "in method '" "ExportModelAsMpsFormat" "', argument " "2"" of type '" "operations_research::MPModelExportOptions const &""'");
7120 PyObject *resultobj = 0;
7124 if ((nobjs < 1) || (nobjs > 1))
SWIG_fail;
7127 PyObject*
const pyresult = PyObject_CallMethod(
7128 swig_obj[0],
const_cast<char*
>(
"SerializeToString"),
nullptr);
7129 if (pyresult !=
nullptr) {
7130 char* buffer =
nullptr;
7131 Py_ssize_t length = 0;
7132 int result = PyString_AsStringAndSize(pyresult, &buffer, &length);
7133 if (buffer !=
nullptr) {
7134 arg1->ParseFromArray(buffer, length);
7136 Py_DECREF(pyresult);
7155 PyObject *argv[3] = {
7165 PyObject*
const module = PyImport_ImportModule(
"ortools.linear_solver.linear_solver_pb2");
7166 if (module !=
nullptr) {
7167 PyObject*
const dict = PyModule_GetDict(module);
7168 if (dict !=
nullptr) {
7169 PyObject*
const clss = PyDict_GetItemString(dict,
"MPModelProto");
7170 if (clss !=
nullptr) {
7171 if (PyObject_IsInstance(argv[0], clss)) {
7188 PyObject*
const module = PyImport_ImportModule(
"ortools.linear_solver.linear_solver_pb2");
7189 if (module !=
nullptr) {
7190 PyObject*
const dict = PyModule_GetDict(module);
7191 if (dict !=
nullptr) {
7192 PyObject*
const clss = PyDict_GetItemString(dict,
"MPModelProto");
7193 if (clss !=
nullptr) {
7194 if (PyObject_IsInstance(argv[0], clss)) {
7214 " Possible C/C++ prototypes are:\n"
7215 " operations_research::ExportModelAsMpsFormatReturnString(operations_research::MPModelProto const &,operations_research::MPModelExportOptions const &)\n"
7216 " operations_research::ExportModelAsMpsFormatReturnString(operations_research::MPModelProto const &)\n");
7222 PyObject *resultobj = 0;
7224 PyObject *swig_obj[1] ;
7231 PyObject*
const pyresult = PyObject_CallMethod(
7232 swig_obj[0],
const_cast<char*
>(
"SerializeToString"),
nullptr);
7233 if (pyresult !=
nullptr) {
7234 char* buffer =
nullptr;
7235 Py_ssize_t length = 0;
7236 int result = PyString_AsStringAndSize(pyresult, &buffer, &length);
7237 if (buffer !=
nullptr) {
7238 arg1->ParseFromArray(buffer, length);
7240 Py_DECREF(pyresult);
7259 {
"new_Solver",
_wrap_new_Solver, METH_VARARGS,
" Create a solver with the given name and underlying solver backend."},
7262 "Recommended factory method to create a MPSolver instance, especially in\n"
7263 "non C++ languages.\n"
7265 "It returns a newly created solver instance if successful, or a nullptr\n"
7266 "otherwise. This can occur if the relevant interface is not linked in, or if\n"
7267 "a needed license is not accessible for commercial solvers.\n"
7269 "Ownership of the solver is passed on to the caller of this method.\n"
7270 "It will accept both string names of the OptimizationProblemType enum, as\n"
7271 "well as a short version (i.e. \"SCIP_MIXED_INTEGER_PROGRAMMING\" or \"SCIP\").\n"
7273 "solver_id is case insensitive, and the following names are supported:\n"
7274 " - CLP_LINEAR_PROGRAMMING or CLP\n"
7275 " - CBC_MIXED_INTEGER_PROGRAMMING or CBC\n"
7276 " - GLOP_LINEAR_PROGRAMMING or GLOP\n"
7277 " - BOP_INTEGER_PROGRAMMING or BOP\n"
7278 " - SAT_INTEGER_PROGRAMMING or SAT or CP_SAT\n"
7279 " - SCIP_MIXED_INTEGER_PROGRAMMING or SCIP\n"
7280 " - GUROBI_LINEAR_PROGRAMMING or GUROBI_LP\n"
7281 " - GUROBI_MIXED_INTEGER_PROGRAMMING or GUROBI or GUROBI_MIP\n"
7282 " - CPLEX_LINEAR_PROGRAMMING or CPLEX_LP\n"
7283 " - CPLEX_MIXED_INTEGER_PROGRAMMING or CPLEX or CPLEX_MIP\n"
7284 " - XPRESS_LINEAR_PROGRAMMING or XPRESS_LP\n"
7285 " - XPRESS_MIXED_INTEGER_PROGRAMMING or XPRESS or XPRESS_MIP\n"
7286 " - GLPK_LINEAR_PROGRAMMING or GLPK_LP\n"
7287 " - GLPK_MIXED_INTEGER_PROGRAMMING or GLPK or GLPK_MIP\n"
7290 "Whether the given problem type is supported (this will depend on the\n"
7291 "targets that you linked).\n"
7294 "Clears the objective (including the optimization direction), all variables\n"
7295 "and constraints. All the other properties of the MPSolver (like the time\n"
7296 "limit) are kept untouched.\n"
7300 "Returns the array of variables handled by the MPSolver. (They are listed in\n"
7301 "the order in which they were created.)\n"
7304 "Looks up a variable by name, and returns nullptr if it does not exist. The\n"
7305 "first call has a O(n) complexity, as the variable name index is lazily\n"
7306 "created upon first use. Will crash if variable names are not unique.\n"
7309 "Creates a variable with the given bounds, integrality requirement and\n"
7310 "name. Bounds can be finite or +/- MPSolver::infinity(). The MPSolver owns\n"
7311 "the variable (i.e. the returned pointer is borrowed). Variable names are\n"
7312 "optional. If you give an empty name, name() will auto-generate one for you\n"
7320 "Returns the array of constraints handled by the MPSolver.\n"
7322 "They are listed in the order in which they were created.\n"
7325 " Looks up a constraint by name, and returns nullptr if it does not exist.\n"
7327 "The first call has a O(n) complexity, as the constraint name index is\n"
7328 "lazily created upon first use. Will crash if constraint names are not\n"
7334 "Creates a linear constraint with given bounds.\n"
7336 "Bounds can be finite or +/- MPSolver::infinity(). The MPSolver class\n"
7337 "assumes ownership of the constraint.\n"
7339 ":rtype: :py:class:`MPConstraint`\n"
7340 ":return: a pointer to the newly created constraint.\n"
7345 " Creates a constraint with -infinity and +infinity bounds.\n"
7350 " Creates a named constraint with given bounds.\n"
7355 " Creates a named constraint with -infinity and +infinity bounds.\n"
7360 "Solves the problem using the default parameter values.\n"
7365 "Solves the problem using the specified parameter values.\n"
7368 "Advanced usage: compute the \"activities\" of all constraints, which are the\n"
7369 "sums of their linear terms. The activities are returned in the same order\n"
7370 "as constraints(), which is the order in which constraints were added; but\n"
7371 "you can also use MPConstraint::index() to get a constraint's index.\n"
7374 "Advanced usage: Verifies the *correctness* of the solution.\n"
7376 "It verifies that all variables must be within their domains, all\n"
7377 "constraints must be satisfied, and the reported objective value must be\n"
7381 "- This can only be called after Solve() was called.\n"
7382 "- \"tolerance\" is interpreted as an absolute error threshold.\n"
7383 "- For the objective value only, if the absolute error is too large,\n"
7384 " the tolerance is interpreted as a relative error threshold instead.\n"
7385 "- If \"log_errors\" is true, every single violation will be logged.\n"
7386 "- If \"tolerance\" is negative, it will be set to infinity().\n"
7388 "Most users should just set the --verify_solution flag and not bother using\n"
7389 "this method directly.\n"
7392 " Interrupts the Solve() execution to terminate processing if possible.\n"
7394 "If the underlying interface supports interruption; it does that and returns\n"
7395 "true regardless of whether there's an ongoing Solve() or not. The Solve()\n"
7396 "call may still linger for a while depending on the conditions. If\n"
7397 "interruption is not supported; returns false and does nothing.\n"
7401 "Solves the model encoded by a MPModelRequest protocol buffer and fills the\n"
7402 "solution encoded as a MPSolutionResponse.\n"
7404 "Note(user): This creates a temporary MPSolver and destroys it at the end.\n"
7405 "If you want to keep the MPSolver alive (for debugging, or for incremental\n"
7406 "solving), you should write another version of this function that creates\n"
7407 "the MPSolver object on the heap and returns it.\n"
7409 "Note(user): This attempts to first use `DirectlySolveProto()` (if\n"
7410 "implemented). Consequently, this most likely does *not* override any of\n"
7411 "the default parameters of the underlying solver. This behavior *differs*\n"
7412 "from `MPSolver::Solve()` which by default sets the feasibility tolerance\n"
7413 "and the gap limit (as of 2020/02/11, to 1e-7 and 0.0001, respectively).\n"
7417 "Load a solution encoded in a protocol buffer onto this solver for easy\n"
7418 " access via the MPSolver interface.\n"
7420 "IMPORTANT: This may only be used in conjunction with ExportModel(),\n"
7421 " following this example:\n"
7423 " .. code-block:: c++\n"
7425 " MPSolver my_solver;\n"
7426 " ... add variables and constraints ...\n"
7427 " MPModelProto model_proto;\n"
7428 " my_solver.ExportModelToProto(&model_proto);\n"
7429 " MPSolutionResponse solver_response;\n"
7430 " MPSolver::SolveWithProto(model_proto, &solver_response);\n"
7431 " if (solver_response.result_status() == MPSolutionResponse::OPTIMAL) {\n"
7432 " CHECK_OK(my_solver.LoadSolutionFromProto(solver_response));\n"
7433 " ... inspect the solution using the usual API: solution_value(), etc...\n"
7436 "The response must be in OPTIMAL or FEASIBLE status.\n"
7438 "Returns a non-OK status if a problem arised (typically, if it wasn't used\n"
7439 " like it should be):\n"
7440 "- loading a solution whose variables don't correspond to the solver's\n"
7441 " current variables\n"
7442 "- loading a solution with a status other than OPTIMAL / FEASIBLE.\n"
7444 "Note: the objective value isn't checked. You can use VerifySolution() for\n"
7448 "Advanced usage: pass solver specific parameters in text format.\n"
7450 "The format is solver-specific and is the same as the corresponding solver\n"
7451 "configuration file format. Returns true if the operation was successful.\n"
7456 "You can use -MPSolver::infinity() for negative infinity.\n"
7462 "Returns the number of branch-and-bound nodes evaluated during the solve.\n"
7464 "Only available for discrete problems.\n"
7467 " Advanced usage: computes the exact condition number of the current scaled\n"
7468 "basis: L1norm(B) * L1norm(inverse(B)), where B is the scaled basis.\n"
7470 "This method requires that a basis exists: it should be called after Solve.\n"
7471 "It is only available for continuous problems. It is implemented for GLPK\n"
7472 "but not CLP because CLP does not provide the API for doing it.\n"
7474 "The condition number measures how well the constraint matrix is conditioned\n"
7475 "and can be used to predict whether numerical issues will arise during the\n"
7476 "solve: the model is declared infeasible whereas it is feasible (or\n"
7477 "vice-versa), the solution obtained is not optimal or violates some\n"
7478 "constraints, the resolution is slow because of repeated singularities.\n"
7480 "The rule of thumb to interpret the condition number kappa is:\n"
7481 " - o kappa <= 1e7: virtually no chance of numerical issues\n"
7482 " - o 1e7 < kappa <= 1e10: small chance of numerical issues\n"
7483 " - o 1e10 < kappa <= 1e13: medium chance of numerical issues\n"
7484 " - o kappa > 1e13: high chance of numerical issues\n"
7486 "The computation of the condition number depends on the quality of the LU\n"
7487 "decomposition, so it is not very accurate when the matrix is ill\n"
7491 "Some solvers (MIP only, not LP) can produce multiple solutions to the\n"
7492 "problem. Returns true when another solution is available, and updates the\n"
7493 "MPVariable* objects to make the new solution queryable. Call only after\n"
7496 "The optimality properties of the additional solutions found, and whether or\n"
7497 "not the solver computes them ahead of time or when NextSolution() is called\n"
7498 "is solver specific.\n"
7500 "As of 2020-02-10, only Gurobi and SCIP support NextSolution(), see\n"
7501 "linear_solver_interfaces_test for an example of how to configure these\n"
7502 "solvers for multiple solutions. Other solvers return false unconditionally.\n"
7511 "Set a hint for solution.\n"
7513 "If a feasible or almost-feasible solution to the problem is already known,\n"
7514 "it may be helpful to pass it to the solver so that it can be used. A\n"
7515 "solver that supports this feature will try to use this information to\n"
7516 "create its initial feasible solution.\n"
7518 "Note that it may not always be faster to give a hint like this to the\n"
7519 "solver. There is also no guarantee that the solver will use this hint or\n"
7520 "try to return a solution \"close\" to this assignment in case of multiple\n"
7521 "optimal solutions.\n"
7523 {
"Solver_SetNumThreads",
_wrap_Solver_SetNumThreads, METH_VARARGS,
" Sets the number of threads to be used by the solver."},
7532 " Clears the offset, all variables and coefficients, and the optimization\n"
7536 "Sets the coefficient of the variable in the objective.\n"
7538 "If the variable does not belong to the solver, the function just returns,\n"
7539 "or crashes in non-opt mode.\n"
7542 " Gets the coefficient of a given variable in the objective\n"
7544 "It returns 0 if the variable does not appear in the objective).\n"
7554 "Returns the objective value of the best solution found so far.\n"
7556 "It is the optimal objective value if the problem has been solved to\n"
7559 "Note: the objective value may be slightly different than what you could\n"
7560 "compute yourself using ``MPVariable::solution_value();`` please use the\n"
7561 "--verify_solution flag to gain confidence about the numerical stability of\n"
7565 "Returns the best objective bound.\n"
7567 "In case of minimization, it is a lower bound on the objective value of the\n"
7568 "optimal integer solution. Only available for discrete problems.\n"
7574 {
"Variable_SetInteger",
_wrap_Variable_SetInteger, METH_VARARGS,
" Sets the integrality requirement of the variable."},
7575 {
"Variable_integer",
_wrap_Variable_integer, METH_O,
" Returns the integrality requirement of the variable."},
7577 "Returns the value of the variable in the current solution.\n"
7579 "If the variable is integer, then the value will always be an integer (the\n"
7580 "underlying solver handles floating-point values only, but this function\n"
7581 "automatically rounds it to the nearest integer; see: man 3 round).\n"
7583 {
"Variable_index",
_wrap_Variable_index, METH_O,
" Returns the index of the variable in the MPSolver::variables_."},
7588 "Advanced usage: returns the reduced cost of the variable in the current\n"
7589 "solution (only available for continuous problems).\n"
7592 "Advanced usage: returns the basis status of the variable in the current\n"
7593 "solution (only available for continuous problems).\n"
7595 "See also: MPSolver::BasisStatus.\n"
7598 "Advanced usage: Certain MIP solvers (e.g. Gurobi or SCIP) allow you to set\n"
7599 "a per-variable priority for determining which variable to branch on.\n"
7601 "A value of 0 is treated as default, and is equivalent to not setting the\n"
7602 "branching priority. The solver looks first to branch on fractional\n"
7603 "variables in higher priority levels. As of 2019-05, only Gurobi and SCIP\n"
7604 "support setting branching priority; all other solvers will simply ignore\n"
7605 "this annotation.\n"
7620 {
"Constraint_Clear",
_wrap_Constraint_Clear, METH_O,
" Clears all variables and coefficients. Does not clear the bounds."},
7622 "Sets the coefficient of the variable on the constraint.\n"
7624 "If the variable does not belong to the solver, the function just returns,\n"
7625 "or crashes in non-opt mode.\n"
7628 "Gets the coefficient of a given variable on the constraint (which is 0 if\n"
7629 "the variable does not appear in the constraint).\n"
7635 "Advanced usage: sets the constraint \"laziness\".\n"
7637 "**This is only supported for SCIP and has no effect on other\n"
7640 "When **laziness** is true, the constraint is only considered by the Linear\n"
7641 "Programming solver if its current solution violates the constraint. In this\n"
7642 "case, the constraint is definitively added to the problem. This may be\n"
7643 "useful in some MIP problems, and may have a dramatic impact on performance.\n"
7645 "For more info see: http://tinyurl.com/lazy-constraints.\n"
7647 {
"Constraint_index",
_wrap_Constraint_index, METH_O,
" Returns the index of the constraint in the MPSolver::constraints_."},
7649 "Advanced usage: returns the dual value of the constraint in the current\n"
7650 "solution (only available for continuous problems).\n"
7653 "Advanced usage: returns the basis status of the constraint.\n"
7655 "It is only available for continuous problems).\n"
7657 "Note that if a constraint \"linear_expression in [lb, ub]\" is transformed\n"
7658 "into \"linear_expression + slack = 0\" with slack in [-ub, -lb], then this\n"
7659 "status is the same as the status of the slack variable with AT_UPPER_BOUND\n"
7660 "and AT_LOWER_BOUND swapped.\n"
7662 "See also: MPSolver::BasisStatus.\n"
7671 {
"new_MPSolverParameters",
_wrap_new_MPSolverParameters, METH_NOARGS,
" The constructor sets all parameters to their default value."},
7686 { NULL, NULL, 0, NULL }
7690 { NULL, NULL, 0, NULL }
7699 static swig_type_info _swigt__p_long = {
"_p_long",
"intptr_t *|int_least64_t *|int_fast32_t *|int_fast64_t *|int64 *|int64_t *|long *|int_fast16_t *|intmax_t *", 0, 0, (
void*)0, 0};
7712 static swig_type_info _swigt__p_unsigned_long = {
"_p_unsigned_long",
"uintptr_t *|uint_least64_t *|uint_fast32_t *|uint_fast64_t *|uint64 *|uint64_t *|unsigned long *|uint_fast16_t *|uintmax_t *", 0, 0, (
void*)0, 0};
7780 {0, 0, 0, 0.0, 0, 0}};
7834 #define SWIGRUNTIME_DEBUG
7870 }
while (iter!= module_head);
7881 if (init == 0)
return;
7884 #ifdef SWIGRUNTIME_DEBUG
7885 printf(
"SWIG_InitializeModule: size %lu\n", (
unsigned long)
swig_module.
size);
7892 #ifdef SWIGRUNTIME_DEBUG
7902 #ifdef SWIGRUNTIME_DEBUG
7903 printf(
"SWIG_InitializeModule: found type %s\n", type->
name);
7907 #ifdef SWIGRUNTIME_DEBUG
7908 printf(
"SWIG_InitializeModule: found and overwrite type %s \n", type->
name);
7917 while (cast->
type) {
7920 #ifdef SWIGRUNTIME_DEBUG
7921 printf(
"SWIG_InitializeModule: look cast %s\n", cast->
type->
name);
7925 #ifdef SWIGRUNTIME_DEBUG
7926 if (ret) printf(
"SWIG_InitializeModule: found cast %s\n", ret->
name);
7931 #ifdef SWIGRUNTIME_DEBUG
7932 printf(
"SWIG_InitializeModule: skip old type %s\n", ret->
name);
7939 #ifdef SWIGRUNTIME_DEBUG
7940 if (ocast) printf(
"SWIG_InitializeModule: skip old cast %s\n", ret->
name);
7942 if (!ocast) ret = 0;
7947 #ifdef SWIGRUNTIME_DEBUG
7948 printf(
"SWIG_InitializeModule: adding cast %s\n", cast->
type->
name);
7963 #ifdef SWIGRUNTIME_DEBUG
7964 printf(
"**** SWIG_InitializeModule: Cast List ******\n");
7969 while (cast->
type) {
7970 printf(
"SWIG_InitializeModule: cast type %s\n", cast->
type->
name);
7974 printf(
"---- Total casts: %d\n",j);
7976 printf(
"**** SWIG_InitializeModule: Cast List ******\n");
7989 static int init_run = 0;
7991 if (init_run)
return;
8002 equiv = equiv->
next;
8023 #define SWIG_newvarlink() SWIG_Python_newvarlink()
8024 #define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr)
8025 #define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants)
8033 PyObject *(*get_attr)(void);
8045 #if PY_VERSION_HEX >= 0x03000000
8046 return PyUnicode_InternFromString(
"<Swig global variables>");
8048 return PyString_FromString(
"<Swig global variables>");
8054 #if PY_VERSION_HEX >= 0x03000000
8055 PyObject *str = PyUnicode_InternFromString(
"(");
8060 tail = PyUnicode_FromString(
var->name);
8061 joined = PyUnicode_Concat(str,
tail);
8066 tail = PyUnicode_InternFromString(
", ");
8067 joined = PyUnicode_Concat(str,
tail);
8073 tail = PyUnicode_InternFromString(
")");
8074 joined = PyUnicode_Concat(str,
tail);
8079 PyObject *str = PyString_FromString(
"(");
8082 PyString_ConcatAndDel(&str,PyString_FromString(
var->name));
8083 if (
var->next) PyString_ConcatAndDel(&str,PyString_FromString(
", "));
8085 PyString_ConcatAndDel(&str,PyString_FromString(
")"));
8103 PyObject *res = NULL;
8106 if (strcmp(
var->name,n) == 0) {
8107 res = (*
var->get_attr)();
8112 if (res == NULL && !PyErr_Occurred()) {
8113 PyErr_Format(PyExc_AttributeError,
"Unknown C global variable '%s'", n);
8123 if (strcmp(
var->name,n) == 0) {
8124 res = (*
var->set_attr)(p);
8129 if (res == 1 && !PyErr_Occurred()) {
8130 PyErr_Format(PyExc_AttributeError,
"Unknown C global variable '%s'", n);
8137 static char varlink__doc__[] =
"Swig var link object";
8138 static PyTypeObject varlink_type;
8139 static int type_init = 0;
8141 const PyTypeObject tmp = {
8142 #if PY_VERSION_HEX >= 0x03000000
8143 PyVarObject_HEAD_INIT(NULL, 0)
8145 PyObject_HEAD_INIT(NULL)
8172 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
8175 #if PY_VERSION_HEX >= 0x03040000
8178 #if PY_VERSION_HEX >= 0x03080000
8181 #if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000)
8194 if (PyType_Ready(&varlink_type) < 0)
8197 return &varlink_type;
8207 return ((PyObject*) result);
8215 size_t size = strlen(
name)+1;
8229 static PyObject *globals = 0;
8245 for (i = 0; constants[i].
type; ++i) {
8246 switch(constants[i].type) {
8251 obj =
SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype));
8258 PyDict_SetItemString(d, constants[i].
name, obj);
8274 for (i = 0; methods[i].ml_name; ++i) {
8275 const char *c = methods[i].ml_doc;
8277 c = strstr(c,
"swig_ptr: ");
8281 const char *
name = c + 10;
8282 for (j = 0; const_table[j].
type; ++j) {
8283 if (strncmp(const_table[j].
name,
name,
8284 strlen(const_table[j].
name)) == 0) {
8285 ci = &(const_table[j]);
8292 size_t shift = (ci->
ptype) - types;
8294 size_t ldoc = (c - methods[i].ml_doc);
8295 size_t lptr = strlen(ty->
name)+2*
sizeof(
void*)+2;
8296 char *ndoc = (
char*)
malloc(ldoc + lptr + 10);
8299 memcpy(buff, methods[i].ml_doc, ldoc);
8301 memcpy(buff,
"swig_ptr: ", 10);
8304 methods[i].ml_doc = ndoc;
8342 if (PyCFunction_Check(func)) {
8343 PyCFunctionObject *funcobj = (PyCFunctionObject *)func;
8346 func = PyCFunction_NewEx(ml, funcobj->m_self, funcobj->m_module);
8348 #if PY_VERSION_HEX >= 0x03000000
8349 return PyInstanceMethod_New(func);
8351 return PyMethod_New(func, NULL, NULL);
8361 if (PyCFunction_Check(func)) {
8362 PyCFunctionObject *funcobj = (PyCFunctionObject *)func;
8365 func = PyCFunction_NewEx(ml, funcobj->m_self, funcobj->m_module);
8367 return PyStaticMethod_New(func);
8383 #if PY_VERSION_HEX >= 0x03000000
8389 PyObject *m, *d, *md, *globals;
8391 #if PY_VERSION_HEX >= 0x03000000
8392 static struct PyModuleDef SWIG_module = {
8393 PyModuleDef_HEAD_INIT,
8405 #if defined(SWIGPYTHON_BUILTIN)
8409 static PyGetSetDef this_getset_def = {
8410 (
char *)
"this", &SwigPyBuiltin_ThisClosure, NULL, NULL, NULL
8412 static SwigPyGetSet thisown_getset_closure = {
8416 static PyGetSetDef thisown_getset_def = {
8417 (
char *)
"thisown", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, NULL, &thisown_getset_closure
8419 PyTypeObject *builtin_pytype;
8420 int builtin_base_count;
8423 PyGetSetDescrObject *static_getset;
8424 PyTypeObject *metatype;
8425 PyTypeObject *swigpyobject;
8427 PyObject *public_interface, *public_symbol;
8428 PyObject *this_descr;
8429 PyObject *thisown_descr;
8433 (void)builtin_pytype;
8434 (void)builtin_base_count;
8435 (void)builtin_basetype;
8437 (void)static_getset;
8441 metatype = SwigPyObjectType();
8451 #ifndef SWIGPYTHON_BUILTIN
8458 #if PY_VERSION_HEX >= 0x03000000
8459 m = PyModule_Create(&SWIG_module);
8464 md = d = PyModule_GetDict(m);
8469 #ifdef SWIGPYTHON_BUILTIN
8473 assert(SwigPyObject_stype);
8476 SwigPyObject_stype->
clientdata = &SwigPyObject_clientdata;
8477 SwigPyObject_clientdata.
pytype = swigpyobject;
8478 }
else if (swigpyobject->tp_basicsize != cd->
pytype->tp_basicsize) {
8479 PyErr_SetString(PyExc_RuntimeError,
"Import error: attempted to load two incompatible swig-generated modules.");
8480 # if PY_VERSION_HEX >= 0x03000000
8493 (void)thisown_descr;
8495 public_interface = PyList_New(0);
8497 (void)public_symbol;
8499 PyDict_SetItemString(md,
"__all__", public_interface);
8500 Py_DECREF(public_interface);
8502 SwigPyBuiltin_AddPublicSymbol(public_interface,
SwigMethods[i].ml_name);
8552 PyErr_SetString(PyExc_TypeError,
"Failure to create SWIG globals.");
8553 #if PY_VERSION_HEX >= 0x03000000
8559 PyDict_SetItemString(md,
"cvar", globals);
8566 #if PY_VERSION_HEX >= 0x03000000